( 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( Id(0, 1), ( label: Some("mapped_at_creation: false, with MAP_WRITE"), size: 16, usage: 131, // STORAGE + MAP_READ + MAP_WRITE mapped_at_creation: false, ), ), CreateBuffer( Id(1, 1), ( label: Some("mapped_at_creation: false, without MAP_WRITE"), size: 16, usage: 129, // STORAGE + MAP_READ mapped_at_creation: false, ), ), CreateBuffer( Id(2, 1), ( label: Some("partially written"), size: 24, usage: 9, // MAP_READ + COPY_DST mapped_at_creation: false, ), ), WriteBuffer( id: Id(2, 1), data: "data1.bin", range: ( start: 4, end: 20, ), queued: true, ), CreateShaderModule( id: Id(0, 1), desc: ( label: None, flags: (bits: 3), ), data: "zero-init-buffer-for-binding.wgsl", ), CreateBuffer(Id(3, 1), ( label: Some("used in binding"), size: 16, usage: 129, // STORAGE + MAP_READ mapped_at_creation: false, )), CreateBindGroupLayout(Id(0, 1), ( label: None, entries: [ ( binding: 0, visibility: 4, ty: Buffer( ty: Storage( read_only: false, ), has_dynamic_offset: false, min_binding_size: Some(16), ), count: None, ), ], )), CreateBindGroup(Id(0, 1), ( label: None, layout: Id(0, 1), entries: [ ( binding: 0, resource: Buffer(( buffer_id: Id(3, 1), offset: 0, size: Some(16), )), ), ], )), CreatePipelineLayout(Id(0, 1), ( label: None, bind_group_layouts: [ Id(0, 1), ], push_constant_ranges: [], )), CreateComputePipeline( id: Id(0, 1), desc: ( label: None, layout: Some(Id(0, 1)), stage: ( module: Id(0, 1), entry_point: None, constants: {}, zero_initialize_workgroup_memory: true, vertex_pulling_transform: false, ), ), ), Submit(1, [ RunComputePass( base: ( label: None, commands: [ SetPipeline(Id(0, 1)), SetBindGroup( index: 0, num_dynamic_offsets: 0, bind_group_id: Some(Id(0, 1)), ), Dispatch((4, 1, 1)), ], dynamic_offsets: [], string_data: [], push_constant_data: [], ), ) ]), ] )