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// Resets the indirect draw counts to zero.
2//
3// This shader is needed because we reuse the same indirect batch set count
4// buffer (i.e. the buffer that gets passed to `multi_draw_indirect_count` to
5// determine how many objects to draw) between phases (early, late, and main).
6// Before launching `build_indirect_params.wgsl`, we need to reinitialize the
7// value to 0.
9#import bevy_pbr::mesh_preprocess_types::IndirectBatchSet
11@group(0) @binding(0) var<storage, read_write> indirect_batch_sets: array<IndirectBatchSet>;
13@compute
14@workgroup_size(64)
15fn main(@builtin(global_invocation_id) global_invocation_id: vec3<u32>) {
16 // Figure out our instance index. If this thread doesn't correspond to any
17 // index, bail.
18 let instance_index = global_invocation_id.x;
19 if (instance_index >= arrayLength(&indirect_batch_sets)) {
20 return;
21 }
23 // Reset the number of batch sets to 0.
24 atomicStore(&indirect_batch_sets[instance_index].indirect_parameters_count, 0u);
Contents