( 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: [ CreateTexture(Id(0, 1), ( label: Some("Output Texture"), size: ( width: 64, height: 64, ), mip_level_count: 1, sample_count: 1, dimension: r#2d, format: "rgba8unorm", usage: 27, view_formats: [], )), // First fill the texture to ensure it wasn't just zero initialized or "happened" to be zero. WriteTexture( to: ( 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( Id(0, 1), ( label: Some("Output Buffer"), size: 16384, usage: 9, mapped_at_creation: false, ), ), CreateBuffer( Id(1, 1), ( label: Some("Buffer to be cleared"), size: 16, usage: 41, mapped_at_creation: false, ), ), // Make sure there is something in the buffer, otherwise it might be just zero init! WriteBuffer( id: Id(1, 1), data: "data1.bin", range: ( start: 0, end: 16, ), queued: true, ), Submit(1, [ ClearTexture( dst: Id(0, 1), subresource_range: ImageSubresourceRange( aspect: all, baseMipLevel: 0, mipLevelCount: None, baseArrayLayer: 0, arrayLayerCount: None, ), ), CopyTextureToBuffer( src: ( texture: Id(0, 1), mip_level: 0, array_layer: 0, ), dst: ( buffer: Id(0, 1), layout: ( offset: 0, bytes_per_row: Some(256), rows_per_image: None, ), ), size: ( width: 64, height: 64, ), ), // Partial clear to prove ClearBuffer( dst: Id(1, 1), offset: 4, size: Some(8), ) ]), ], )