2021-12-09 15:45:03 +00:00
|
|
|
struct DrawIndirectArgs {
|
2022-03-28 14:31:22 +00:00
|
|
|
vertexCount : atomic<u32>,
|
2021-06-24 19:01:06 +00:00
|
|
|
};
|
2022-01-19 22:46:57 +00:00
|
|
|
@group(0) @binding(5) var<storage, read_write> drawOut : DrawIndirectArgs;
|
2021-06-24 19:01:06 +00:00
|
|
|
|
|
|
|
var<private> cubeVerts : u32 = 0u;
|
|
|
|
|
2022-01-19 22:46:57 +00:00
|
|
|
@stage(compute) @workgroup_size(1)
|
|
|
|
fn computeMain(@builtin(global_invocation_id) global_id : vec3<u32>) {
|
2021-06-24 19:01:06 +00:00
|
|
|
// Increment cubeVerts based on some criteria...
|
|
|
|
|
|
|
|
// This fails SPIR-V validation
|
|
|
|
let firstVertex : u32 = atomicAdd(&drawOut.vertexCount, cubeVerts);
|
|
|
|
}
|