2021-06-24 19:01:06 +00:00
|
|
|
[[block]] struct DrawIndirectArgs {
|
|
|
|
vertexCount : atomic<u32>;
|
|
|
|
};
|
|
|
|
[[group(0), binding(5)]] var<storage, read_write> drawOut : DrawIndirectArgs;
|
|
|
|
|
|
|
|
var<private> cubeVerts : u32 = 0u;
|
|
|
|
|
2021-06-29 18:39:44 +00:00
|
|
|
[[stage(compute), workgroup_size(1)]]
|
2021-06-24 19:01:06 +00:00
|
|
|
fn computeMain([[builtin(global_invocation_id)]] global_id : vec3<u32>) {
|
|
|
|
// Increment cubeVerts based on some criteria...
|
|
|
|
|
|
|
|
// This fails SPIR-V validation
|
|
|
|
let firstVertex : u32 = atomicAdd(&drawOut.vertexCount, cubeVerts);
|
|
|
|
}
|