1//! Resets the indirect draw counts to zero.2//!3//! This shader is needed because we reuse the same indirect batch set count4//! buffer (i.e. the buffer that gets passed to `multi_draw_indirect_count` to5//! determine how many objects to draw) between phases (early, late, and main).6//! Before launching `build_indirect_params.wesl`, we need to reinitialize the7//! value to 0.9import bevy_render::occlusion_culling::mesh_preprocess_types::IndirectBatchSet;11@group(0) @binding(0) var<storage, read_write> indirect_batch_sets: array<IndirectBatchSet>;13@compute14@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 any17 // 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);25}