2021-03-03 21:48:23 +00:00
|
|
|
(
|
2024-01-28 01:42:02 +00:00
|
|
|
features: ["MAPPABLE_PRIMARY_BUFFERS"],
|
2021-03-03 21:48:23 +00:00
|
|
|
expectations: [
|
|
|
|
// Ensuring that mapping zero-inits buffers.
|
|
|
|
(
|
|
|
|
name: "mapped_at_creation: false, with MAP_WRITE",
|
|
|
|
buffer: (index: 0, epoch: 1),
|
|
|
|
offset: 0,
|
|
|
|
data: Raw([0x00, 0x00, 0x00, 0x00]),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
name: "mapped_at_creation: false, without MAP_WRITE",
|
|
|
|
buffer: (index: 1, epoch: 1),
|
|
|
|
offset: 0,
|
|
|
|
data: Raw([0x00, 0x00, 0x00, 0x00]),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
name: "partially written buffer",
|
|
|
|
buffer: (index: 2, epoch: 1),
|
|
|
|
offset: 0,
|
|
|
|
data: Raw([0x00, 0x00, 0x00, 0x00,
|
|
|
|
0x00, 0x00, 0x80, 0xBF,
|
|
|
|
0x00, 0x00, 0x80, 0xBF,
|
|
|
|
0x00, 0x00, 0x80, 0x3F,
|
|
|
|
0x00, 0x00, 0x80, 0x3F,
|
|
|
|
0x00, 0x00, 0x00, 0x00]),
|
|
|
|
),
|
|
|
|
// Ensuring that binding zero-inits buffers
|
|
|
|
// (by observing correct side effects of compute shader reading & writing values)
|
|
|
|
(
|
|
|
|
name: "buffer has correct values",
|
|
|
|
buffer: (index: 3, epoch: 1),
|
|
|
|
offset: 0,
|
|
|
|
data: Raw([0x00, 0x00, 0x00, 0x00,
|
|
|
|
0x01, 0x00, 0x00, 0x00,
|
|
|
|
0x02, 0x00, 0x00, 0x00,
|
|
|
|
0x03, 0x00, 0x00, 0x00]),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
actions: [
|
|
|
|
CreateBuffer(
|
2024-09-13 15:30:38 +00:00
|
|
|
Id(0, 1),
|
2021-03-03 21:48:23 +00:00
|
|
|
(
|
|
|
|
label: Some("mapped_at_creation: false, with MAP_WRITE"),
|
|
|
|
size: 16,
|
2021-12-03 15:58:53 +00:00
|
|
|
usage: 131, // STORAGE + MAP_READ + MAP_WRITE
|
2021-03-03 21:48:23 +00:00
|
|
|
mapped_at_creation: false,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
CreateBuffer(
|
2024-09-13 15:30:38 +00:00
|
|
|
Id(1, 1),
|
2021-03-03 21:48:23 +00:00
|
|
|
(
|
|
|
|
label: Some("mapped_at_creation: false, without MAP_WRITE"),
|
|
|
|
size: 16,
|
2021-12-03 15:58:53 +00:00
|
|
|
usage: 129, // STORAGE + MAP_READ
|
2021-03-03 21:48:23 +00:00
|
|
|
mapped_at_creation: false,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
CreateBuffer(
|
2024-09-13 15:30:38 +00:00
|
|
|
Id(2, 1),
|
2021-03-03 21:48:23 +00:00
|
|
|
(
|
|
|
|
label: Some("partially written"),
|
|
|
|
size: 24,
|
2021-12-03 15:58:53 +00:00
|
|
|
usage: 9, // MAP_READ + COPY_DST
|
2021-03-03 21:48:23 +00:00
|
|
|
mapped_at_creation: false,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
WriteBuffer(
|
2024-09-13 15:30:38 +00:00
|
|
|
id: Id(2, 1),
|
2021-03-03 21:48:23 +00:00
|
|
|
data: "data1.bin",
|
|
|
|
range: (
|
|
|
|
start: 4,
|
|
|
|
end: 20,
|
|
|
|
),
|
|
|
|
queued: true,
|
|
|
|
),
|
|
|
|
CreateShaderModule(
|
2024-09-13 15:30:38 +00:00
|
|
|
id: Id(0, 1),
|
2021-03-03 21:48:23 +00:00
|
|
|
desc: (
|
|
|
|
label: None,
|
|
|
|
flags: (bits: 3),
|
|
|
|
),
|
2021-10-28 13:15:53 +00:00
|
|
|
data: "zero-init-buffer-for-binding.wgsl",
|
2021-03-03 21:48:23 +00:00
|
|
|
),
|
2024-09-13 15:30:38 +00:00
|
|
|
CreateBuffer(Id(3, 1), (
|
2021-03-03 21:48:23 +00:00
|
|
|
label: Some("used in binding"),
|
|
|
|
size: 16,
|
2021-12-03 15:58:53 +00:00
|
|
|
usage: 129, // STORAGE + MAP_READ
|
2021-03-03 21:48:23 +00:00
|
|
|
mapped_at_creation: false,
|
|
|
|
)),
|
2024-09-13 15:30:38 +00:00
|
|
|
CreateBindGroupLayout(Id(0, 1), (
|
2021-03-03 21:48:23 +00:00
|
|
|
label: None,
|
|
|
|
entries: [
|
|
|
|
(
|
|
|
|
binding: 0,
|
2021-12-03 15:58:53 +00:00
|
|
|
visibility: 4,
|
2021-03-03 21:48:23 +00:00
|
|
|
ty: Buffer(
|
|
|
|
ty: Storage(
|
|
|
|
read_only: false,
|
|
|
|
),
|
|
|
|
has_dynamic_offset: false,
|
|
|
|
min_binding_size: Some(16),
|
|
|
|
),
|
|
|
|
count: None,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
)),
|
2024-09-13 15:30:38 +00:00
|
|
|
CreateBindGroup(Id(0, 1), (
|
2021-03-03 21:48:23 +00:00
|
|
|
label: None,
|
2024-09-13 15:30:38 +00:00
|
|
|
layout: Id(0, 1),
|
2021-03-03 21:48:23 +00:00
|
|
|
entries: [
|
|
|
|
(
|
|
|
|
binding: 0,
|
|
|
|
resource: Buffer((
|
2024-09-13 15:30:38 +00:00
|
|
|
buffer_id: Id(3, 1),
|
2021-03-03 21:48:23 +00:00
|
|
|
offset: 0,
|
|
|
|
size: Some(16),
|
|
|
|
)),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
)),
|
2024-09-13 15:30:38 +00:00
|
|
|
CreatePipelineLayout(Id(0, 1), (
|
2021-03-03 21:48:23 +00:00
|
|
|
label: None,
|
|
|
|
bind_group_layouts: [
|
2024-09-13 15:30:38 +00:00
|
|
|
Id(0, 1),
|
2021-03-03 21:48:23 +00:00
|
|
|
],
|
|
|
|
push_constant_ranges: [],
|
|
|
|
)),
|
|
|
|
CreateComputePipeline(
|
2024-09-13 15:30:38 +00:00
|
|
|
id: Id(0, 1),
|
2021-03-03 21:48:23 +00:00
|
|
|
desc: (
|
|
|
|
label: None,
|
2024-09-13 15:30:38 +00:00
|
|
|
layout: Some(Id(0, 1)),
|
2021-03-03 21:48:23 +00:00
|
|
|
stage: (
|
2024-09-13 15:30:38 +00:00
|
|
|
module: Id(0, 1),
|
2024-02-26 17:03:14 +00:00
|
|
|
entry_point: None,
|
2023-11-13 16:48:24 +00:00
|
|
|
constants: {},
|
2024-04-17 19:50:31 +00:00
|
|
|
zero_initialize_workgroup_memory: true,
|
2024-02-07 00:35:17 +00:00
|
|
|
vertex_pulling_transform: false,
|
2021-03-03 21:48:23 +00:00
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Submit(1, [
|
|
|
|
RunComputePass(
|
|
|
|
base: (
|
|
|
|
label: None,
|
|
|
|
commands: [
|
2024-09-13 15:30:38 +00:00
|
|
|
SetPipeline(Id(0, 1)),
|
2021-03-03 21:48:23 +00:00
|
|
|
SetBindGroup(
|
|
|
|
index: 0,
|
|
|
|
num_dynamic_offsets: 0,
|
2024-09-13 15:30:38 +00:00
|
|
|
bind_group_id: Some(Id(0, 1)),
|
2021-03-03 21:48:23 +00:00
|
|
|
),
|
|
|
|
Dispatch((4, 1, 1)),
|
|
|
|
],
|
|
|
|
dynamic_offsets: [],
|
|
|
|
string_data: [],
|
|
|
|
push_constant_data: [],
|
|
|
|
),
|
|
|
|
)
|
|
|
|
]),
|
|
|
|
]
|
|
|
|
)
|