Skip to main content

allocate_uniforms

Function allocate_uniforms 

Source
pub fn allocate_uniforms(
    current_view: ViewQuery<'_, '_, Option<&ViewLightEntities>, Without<SkipGpuPreprocess>>,
    view_query: Query<'_, '_, &ExtractedView, Without<SkipGpuPreprocess>>,
    light_query: Query<'_, '_, &LightEntity>,
    batched_instance_buffers: Res<'_, BatchedInstanceBuffers<MeshUniform, MeshInputUniform>>,
    pipeline_cache: Res<'_, PipelineCache>,
    preprocess_pipelines: Res<'_, PreprocessPipelines>,
    uniform_allocation_bind_groups: Res<'_, UniformAllocationBindGroups>,
    render_context: RenderContext<'_, '_>,
)
Expand description

A rendering system that invokes a compute shader for each batch set in order to determine where MeshUniforms should be placed.

This shader exists because a single batch set could contain many meshes. By performing this on the GPU, we avoid having to traverse every visible mesh on the CPU every frame.