2021-05-30 15:03:33 +00:00
|
|
|
(
|
2024-01-28 01:42:02 +00:00
|
|
|
features: ["MAPPABLE_PRIMARY_BUFFERS", "CLEAR_TEXTURE"],
|
2021-05-30 15:03:33 +00:00
|
|
|
expectations: [
|
|
|
|
(
|
|
|
|
name: "Quad",
|
|
|
|
buffer: (index: 0, epoch: 1),
|
|
|
|
offset: 0,
|
2021-09-07 01:14:40 +00:00
|
|
|
data: File("clear-texture.bin", 16384),
|
2021-05-30 15:03:33 +00:00
|
|
|
),
|
|
|
|
(
|
|
|
|
name: "buffer clear",
|
|
|
|
buffer: (index: 1, epoch: 1),
|
|
|
|
offset: 0,
|
|
|
|
data: Raw([
|
2021-09-07 01:14:40 +00:00
|
|
|
0x00, 0x00, 0x80, 0xBF,
|
2021-05-30 15:03:33 +00:00
|
|
|
0x00, 0x00, 0x00, 0x00,
|
|
|
|
0x00, 0x00, 0x00, 0x00,
|
2021-09-07 01:14:40 +00:00
|
|
|
0x00, 0x00, 0x80, 0x3F,
|
2021-05-30 15:03:33 +00:00
|
|
|
]),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
actions: [
|
2024-09-13 15:30:38 +00:00
|
|
|
CreateTexture(Id(0, 1), (
|
2021-05-30 15:03:33 +00:00
|
|
|
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,
|
2022-09-29 17:43:50 +00:00
|
|
|
format: "rgba8unorm",
|
2021-12-03 15:58:53 +00:00
|
|
|
usage: 27,
|
2023-01-18 21:03:56 +00:00
|
|
|
view_formats: [],
|
2021-05-30 15:03:33 +00:00
|
|
|
)),
|
2021-09-07 01:14:40 +00:00
|
|
|
// 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),
|
2021-09-07 01:14:40 +00:00
|
|
|
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,
|
|
|
|
),
|
|
|
|
),
|
2021-05-30 15:03:33 +00:00
|
|
|
CreateBuffer(
|
2024-09-13 15:30:38 +00:00
|
|
|
Id(0, 1),
|
2021-05-30 15:03:33 +00:00
|
|
|
(
|
|
|
|
label: Some("Output Buffer"),
|
|
|
|
size: 16384,
|
2021-12-03 15:58:53 +00:00
|
|
|
usage: 9,
|
2021-05-30 15:03:33 +00:00
|
|
|
mapped_at_creation: false,
|
|
|
|
),
|
|
|
|
),
|
2021-09-07 01:14:40 +00:00
|
|
|
|
2021-05-30 15:03:33 +00:00
|
|
|
CreateBuffer(
|
2024-09-13 15:30:38 +00:00
|
|
|
Id(1, 1),
|
2021-05-30 15:03:33 +00:00
|
|
|
(
|
|
|
|
label: Some("Buffer to be cleared"),
|
|
|
|
size: 16,
|
2021-12-03 15:58:53 +00:00
|
|
|
usage: 41,
|
2021-05-30 15:03:33 +00:00
|
|
|
mapped_at_creation: false,
|
|
|
|
),
|
|
|
|
),
|
2021-09-07 01:14:40 +00:00
|
|
|
// 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),
|
2021-09-07 01:14:40 +00:00
|
|
|
data: "data1.bin",
|
|
|
|
range: (
|
|
|
|
start: 0,
|
|
|
|
end: 16,
|
|
|
|
),
|
|
|
|
queued: true,
|
|
|
|
),
|
2021-05-30 15:03:33 +00:00
|
|
|
Submit(1, [
|
2021-09-07 01:14:40 +00:00
|
|
|
ClearTexture(
|
2024-09-13 15:30:38 +00:00
|
|
|
dst: Id(0, 1),
|
2021-05-30 15:03:33 +00:00
|
|
|
subresource_range: ImageSubresourceRange(
|
2021-12-03 15:58:53 +00:00
|
|
|
aspect: all,
|
2023-10-04 04:25:56 +00:00
|
|
|
baseMipLevel: 0,
|
|
|
|
mipLevelCount: None,
|
|
|
|
baseArrayLayer: 0,
|
|
|
|
arrayLayerCount: None,
|
2021-05-30 15:03:33 +00:00
|
|
|
),
|
|
|
|
),
|
|
|
|
CopyTextureToBuffer(
|
|
|
|
src: (
|
2024-09-13 15:30:38 +00:00
|
|
|
texture: Id(0, 1),
|
2021-05-30 15:03:33 +00:00
|
|
|
mip_level: 0,
|
|
|
|
array_layer: 0,
|
|
|
|
),
|
|
|
|
dst: (
|
2024-09-13 15:30:38 +00:00
|
|
|
buffer: Id(0, 1),
|
2021-05-30 15:03:33 +00:00
|
|
|
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
|
2021-05-30 15:03:33 +00:00
|
|
|
ClearBuffer(
|
2024-09-13 15:30:38 +00:00
|
|
|
dst: Id(1, 1),
|
2021-05-30 15:03:33 +00:00
|
|
|
offset: 4,
|
|
|
|
size: Some(8),
|
|
|
|
)
|
|
|
|
]),
|
|
|
|
],
|
2021-06-28 11:12:12 +00:00
|
|
|
)
|