mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-22 14:55:05 +00:00
d6c4d5c5c3
When the appropriate features are enabled, manually implement `serde::Serialize` and `serde::Deserialize`, such that the serialized form of `NonMaxU32::new(n).unwrap()` is the same as that of `n`. This eliminates the last trace of 1-based indices from Naga's snapshot tests, and aligns `std::fmt::Debug` with the serialized form.
333 lines
9.5 KiB
Plaintext
333 lines
9.5 KiB
Plaintext
(
|
|
types: [
|
|
(
|
|
name: None,
|
|
inner: Scalar((
|
|
kind: Uint,
|
|
width: 4,
|
|
)),
|
|
),
|
|
(
|
|
name: None,
|
|
inner: Array(
|
|
base: 0,
|
|
size: Dynamic,
|
|
stride: 4,
|
|
),
|
|
),
|
|
(
|
|
name: Some("PrimeIndices"),
|
|
inner: Struct(
|
|
members: [
|
|
(
|
|
name: Some("data"),
|
|
ty: 1,
|
|
binding: None,
|
|
offset: 0,
|
|
),
|
|
],
|
|
span: 4,
|
|
),
|
|
),
|
|
(
|
|
name: None,
|
|
inner: Vector(
|
|
size: Tri,
|
|
scalar: (
|
|
kind: Uint,
|
|
width: 4,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
special_types: (
|
|
ray_desc: None,
|
|
ray_intersection: None,
|
|
predeclared_types: {},
|
|
),
|
|
constants: [],
|
|
overrides: [],
|
|
global_variables: [
|
|
(
|
|
name: Some("v_indices"),
|
|
space: Storage(
|
|
access: ("LOAD | STORE"),
|
|
),
|
|
binding: Some((
|
|
group: 0,
|
|
binding: 0,
|
|
)),
|
|
ty: 2,
|
|
init: None,
|
|
),
|
|
],
|
|
global_expressions: [],
|
|
functions: [
|
|
(
|
|
name: Some("collatz_iterations"),
|
|
arguments: [
|
|
(
|
|
name: Some("n_base"),
|
|
ty: 0,
|
|
binding: None,
|
|
),
|
|
],
|
|
result: Some((
|
|
ty: 0,
|
|
binding: None,
|
|
)),
|
|
local_variables: [
|
|
(
|
|
name: Some("n"),
|
|
ty: 0,
|
|
init: None,
|
|
),
|
|
(
|
|
name: Some("i"),
|
|
ty: 0,
|
|
init: Some(2),
|
|
),
|
|
],
|
|
expressions: [
|
|
FunctionArgument(0),
|
|
LocalVariable(0),
|
|
Literal(U32(0)),
|
|
LocalVariable(1),
|
|
Load(
|
|
pointer: 1,
|
|
),
|
|
Literal(U32(1)),
|
|
Binary(
|
|
op: Greater,
|
|
left: 4,
|
|
right: 5,
|
|
),
|
|
Load(
|
|
pointer: 1,
|
|
),
|
|
Literal(U32(2)),
|
|
Binary(
|
|
op: Modulo,
|
|
left: 7,
|
|
right: 8,
|
|
),
|
|
Literal(U32(0)),
|
|
Binary(
|
|
op: Equal,
|
|
left: 9,
|
|
right: 10,
|
|
),
|
|
Load(
|
|
pointer: 1,
|
|
),
|
|
Literal(U32(2)),
|
|
Binary(
|
|
op: Divide,
|
|
left: 12,
|
|
right: 13,
|
|
),
|
|
Literal(U32(3)),
|
|
Load(
|
|
pointer: 1,
|
|
),
|
|
Binary(
|
|
op: Multiply,
|
|
left: 15,
|
|
right: 16,
|
|
),
|
|
Literal(U32(1)),
|
|
Binary(
|
|
op: Add,
|
|
left: 17,
|
|
right: 18,
|
|
),
|
|
Load(
|
|
pointer: 3,
|
|
),
|
|
Literal(U32(1)),
|
|
Binary(
|
|
op: Add,
|
|
left: 20,
|
|
right: 21,
|
|
),
|
|
Load(
|
|
pointer: 3,
|
|
),
|
|
],
|
|
named_expressions: {
|
|
0: "n_base",
|
|
},
|
|
body: [
|
|
Store(
|
|
pointer: 1,
|
|
value: 0,
|
|
),
|
|
Loop(
|
|
body: [
|
|
Emit((
|
|
start: 4,
|
|
end: 5,
|
|
)),
|
|
Emit((
|
|
start: 6,
|
|
end: 7,
|
|
)),
|
|
If(
|
|
condition: 6,
|
|
accept: [],
|
|
reject: [
|
|
Break,
|
|
],
|
|
),
|
|
Block([
|
|
Emit((
|
|
start: 7,
|
|
end: 8,
|
|
)),
|
|
Emit((
|
|
start: 9,
|
|
end: 10,
|
|
)),
|
|
Emit((
|
|
start: 11,
|
|
end: 12,
|
|
)),
|
|
If(
|
|
condition: 11,
|
|
accept: [
|
|
Emit((
|
|
start: 12,
|
|
end: 13,
|
|
)),
|
|
Emit((
|
|
start: 14,
|
|
end: 15,
|
|
)),
|
|
Store(
|
|
pointer: 1,
|
|
value: 14,
|
|
),
|
|
],
|
|
reject: [
|
|
Emit((
|
|
start: 16,
|
|
end: 18,
|
|
)),
|
|
Emit((
|
|
start: 19,
|
|
end: 20,
|
|
)),
|
|
Store(
|
|
pointer: 1,
|
|
value: 19,
|
|
),
|
|
],
|
|
),
|
|
Emit((
|
|
start: 20,
|
|
end: 21,
|
|
)),
|
|
Emit((
|
|
start: 22,
|
|
end: 23,
|
|
)),
|
|
Store(
|
|
pointer: 3,
|
|
value: 22,
|
|
),
|
|
]),
|
|
],
|
|
continuing: [],
|
|
break_if: None,
|
|
),
|
|
Emit((
|
|
start: 23,
|
|
end: 24,
|
|
)),
|
|
Return(
|
|
value: Some(23),
|
|
),
|
|
],
|
|
),
|
|
],
|
|
entry_points: [
|
|
(
|
|
name: "main",
|
|
stage: Compute,
|
|
early_depth_test: None,
|
|
workgroup_size: (1, 1, 1),
|
|
function: (
|
|
name: Some("main"),
|
|
arguments: [
|
|
(
|
|
name: Some("global_id"),
|
|
ty: 3,
|
|
binding: Some(BuiltIn(GlobalInvocationId)),
|
|
),
|
|
],
|
|
result: None,
|
|
local_variables: [],
|
|
expressions: [
|
|
FunctionArgument(0),
|
|
GlobalVariable(0),
|
|
AccessIndex(
|
|
base: 1,
|
|
index: 0,
|
|
),
|
|
AccessIndex(
|
|
base: 0,
|
|
index: 0,
|
|
),
|
|
Access(
|
|
base: 2,
|
|
index: 3,
|
|
),
|
|
GlobalVariable(0),
|
|
AccessIndex(
|
|
base: 5,
|
|
index: 0,
|
|
),
|
|
AccessIndex(
|
|
base: 0,
|
|
index: 0,
|
|
),
|
|
Access(
|
|
base: 6,
|
|
index: 7,
|
|
),
|
|
Load(
|
|
pointer: 8,
|
|
),
|
|
CallResult(0),
|
|
],
|
|
named_expressions: {
|
|
0: "global_id",
|
|
},
|
|
body: [
|
|
Emit((
|
|
start: 2,
|
|
end: 5,
|
|
)),
|
|
Emit((
|
|
start: 6,
|
|
end: 10,
|
|
)),
|
|
Call(
|
|
function: 0,
|
|
arguments: [
|
|
9,
|
|
],
|
|
result: Some(10),
|
|
),
|
|
Store(
|
|
pointer: 4,
|
|
value: 10,
|
|
),
|
|
Return(
|
|
value: None,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
) |