wgpu/player/tests/data/zero-init-buffer.ron

164 lines
4.9 KiB
Plaintext
Raw Normal View History

(
features: ["MAPPABLE_PRIMARY_BUFFERS"],
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),
(
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
mapped_at_creation: false,
),
),
CreateBuffer(
2024-09-13 15:30:38 +00:00
Id(1, 1),
(
label: Some("mapped_at_creation: false, without MAP_WRITE"),
size: 16,
2021-12-03 15:58:53 +00:00
usage: 129, // STORAGE + MAP_READ
mapped_at_creation: false,
),
),
CreateBuffer(
2024-09-13 15:30:38 +00:00
Id(2, 1),
(
label: Some("partially written"),
size: 24,
2021-12-03 15:58:53 +00:00
usage: 9, // MAP_READ + COPY_DST
mapped_at_creation: false,
),
),
WriteBuffer(
2024-09-13 15:30:38 +00:00
id: Id(2, 1),
data: "data1.bin",
range: (
start: 4,
end: 20,
),
queued: true,
),
CreateShaderModule(
2024-09-13 15:30:38 +00:00
id: Id(0, 1),
desc: (
label: None,
flags: (bits: 3),
),
Zero init textures (#1688) * Added tests for texture zero init sadly, they are typically passing even if texture zero init isn't doing its job However, they form nice isolated examples for testing out texture initialization It could be possible to dirty texture memory prior to ensure zero init did the job * texture init tracker * tracking texture init requirements for bind group, transfer and rendertarget * texture clears for texture init * queue submit * write_texture * Enforce presence of either render target or copy_dst flag * clear render targets also with using buffer copies enforce COPY_DST usage now on all textures * adjust ImageSubresourceRange.layer_range calculation for 3D textures init_tracker has now a `discard` function to get single data points back to uninitialized use new standardized partition_point function * track init state for discarded textures from renderpasses missing: * init on the fly if discarded is found within command buffer * handle discarding only stencil or only depth * added tests for zero init after discard * tracking discarded surfaces now in separate struct, piping all inits through utility function allows to resolve discard/init_action interactions * Move various memory init code to separate mod CommandBufferTextureMemoryActions is now fully encapsulated * implemented discard init fixups for everything but renderpass * render passes also cause now discard fixups * fixup_discarded_surfaces takes now an iterator instead of Drain * Add memory init test for discarding depth targets * handle divergently discarded depth/stencil target * comment & clippy fixes * fix collect_zero_buffer_copies_for_clear_texture yielding block breaking copies * [pr feedback] minor cleanup in zero_init_texture_after_discard, `use` hygenie * [pr feedback] fix bug in ImageSubresourceRange range utils * [pr feedback] fix texture tracker check, bundle transition_texture on init, cleanups * Implemented drop for InitTrackerDrain * remove incorrect comment about extents in add_pass_texture_init_actions * Fix unit test & clippy issues in init_tracker
2021-10-28 13:15:53 +00:00
data: "zero-init-buffer-for-binding.wgsl",
),
2024-09-13 15:30:38 +00:00
CreateBuffer(Id(3, 1), (
label: Some("used in binding"),
size: 16,
2021-12-03 15:58:53 +00:00
usage: 129, // STORAGE + MAP_READ
mapped_at_creation: false,
)),
2024-09-13 15:30:38 +00:00
CreateBindGroupLayout(Id(0, 1), (
label: None,
entries: [
(
binding: 0,
2021-12-03 15:58:53 +00:00
visibility: 4,
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), (
label: None,
2024-09-13 15:30:38 +00:00
layout: Id(0, 1),
entries: [
(
binding: 0,
resource: Buffer((
2024-09-13 15:30:38 +00:00
buffer_id: Id(3, 1),
offset: 0,
size: Some(16),
)),
),
],
)),
2024-09-13 15:30:38 +00:00
CreatePipelineLayout(Id(0, 1), (
label: None,
bind_group_layouts: [
2024-09-13 15:30:38 +00:00
Id(0, 1),
],
push_constant_ranges: [],
)),
CreateComputePipeline(
2024-09-13 15:30:38 +00:00
id: Id(0, 1),
desc: (
label: None,
2024-09-13 15:30:38 +00:00
layout: Some(Id(0, 1)),
stage: (
2024-09-13 15:30:38 +00:00
module: Id(0, 1),
entry_point: None,
2023-11-13 16:48:24 +00:00
constants: {},
zero_initialize_workgroup_memory: true,
vertex_pulling_transform: false,
),
),
),
Submit(1, [
RunComputePass(
base: (
label: None,
commands: [
2024-09-13 15:30:38 +00:00
SetPipeline(Id(0, 1)),
SetBindGroup(
index: 0,
num_dynamic_offsets: 0,
2024-09-13 15:30:38 +00:00
bind_group_id: Some(Id(0, 1)),
),
Dispatch((4, 1, 1)),
],
dynamic_offsets: [],
string_data: [],
push_constant_data: [],
),
)
]),
]
)