wgpu/player/tests/data/clear-buffer-texture.ron

122 lines
3.3 KiB
Plaintext
Raw Permalink Normal View History

(
features: ["MAPPABLE_PRIMARY_BUFFERS", "CLEAR_TEXTURE"],
expectations: [
(
name: "Quad",
buffer: (index: 0, epoch: 1),
offset: 0,
data: File("clear-texture.bin", 16384),
),
(
name: "buffer clear",
buffer: (index: 1, epoch: 1),
offset: 0,
data: Raw([
0x00, 0x00, 0x80, 0xBF,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x80, 0x3F,
]),
)
],
actions: [
2024-09-13 15:30:38 +00:00
CreateTexture(Id(0, 1), (
label: Some("Output Texture"),
size: (
width: 64,
height: 64,
),
mip_level_count: 1,
sample_count: 1,
2021-12-03 15:58:53 +00:00
dimension: r#2d,
format: "rgba8unorm",
2021-12-03 15:58:53 +00:00
usage: 27,
view_formats: [],
)),
// First fill the texture to ensure it wasn't just zero initialized or "happened" to be zero.
WriteTexture(
to: (
2024-09-13 15:30:38 +00:00
texture: Id(0, 1),
mip_level: 0,
array_layer: 0,
),
data: "quad.bin",
layout: (
offset: 0,
bytes_per_row: Some(256),
rows_per_image: None,
),
size: (
width: 64,
height: 64,
),
),
CreateBuffer(
2024-09-13 15:30:38 +00:00
Id(0, 1),
(
label: Some("Output Buffer"),
size: 16384,
2021-12-03 15:58:53 +00:00
usage: 9,
mapped_at_creation: false,
),
),
CreateBuffer(
2024-09-13 15:30:38 +00:00
Id(1, 1),
(
label: Some("Buffer to be cleared"),
size: 16,
2021-12-03 15:58:53 +00:00
usage: 41,
mapped_at_creation: false,
),
),
// Make sure there is something in the buffer, otherwise it might be just zero init!
WriteBuffer(
2024-09-13 15:30:38 +00:00
id: Id(1, 1),
data: "data1.bin",
range: (
start: 0,
end: 16,
),
queued: true,
),
Submit(1, [
ClearTexture(
2024-09-13 15:30:38 +00:00
dst: Id(0, 1),
subresource_range: ImageSubresourceRange(
2021-12-03 15:58:53 +00:00
aspect: all,
baseMipLevel: 0,
mipLevelCount: None,
baseArrayLayer: 0,
arrayLayerCount: None,
),
),
CopyTextureToBuffer(
src: (
2024-09-13 15:30:38 +00:00
texture: Id(0, 1),
mip_level: 0,
array_layer: 0,
),
dst: (
2024-09-13 15:30:38 +00:00
buffer: Id(0, 1),
layout: (
offset: 0,
bytes_per_row: Some(256),
rows_per_image: None,
),
),
size: (
width: 64,
height: 64,
),
),
2021-10-07 22:52:56 +00:00
// Partial clear to prove
ClearBuffer(
2024-09-13 15:30:38 +00:00
dst: Id(1, 1),
offset: 4,
size: Some(8),
)
]),
],
)