Search across packages, versions, files, declarations, and comments. Use multiple terms to narrow results (AND), and add @vertex, @fragment, or @compute to filter by shader stage.
1//! This shader is used for the gpu_readback example
2//! The actual work it does is not important for the example
4/// This is the data that lives in the gpu only buffer
5@group(0) @binding(0) var<storage, read_write> data: array<u32>;
6@group(0) @binding(1) var texture: texture_storage_2d<r32uint, write>;
8@compute @workgroup_size(1)
9fn main(@builtin(global_invocation_id) global_id: vec3<u32>) {
10 // We use the global_id to index the array to make sure we don't
11 // access data used in another workgroup
12 data[global_id.x] += 1u;
13 // Write the same data to the texture
14 textureStore(texture, vec2<i32>(i32(global_id.x), 0), vec4<u32>(data[global_id.x], 0, 0, 0));
Contents