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.
1import bevy_core_pipeline::fullscreen_vertex_shader::FullscreenVertexOutput;
2import package::meshlet::bindings::InstancedOffset;
4@if(MESHLET_VISIBILITY_BUFFER_RASTER_PASS_OUTPUT)
5@group(0) @binding(0) var meshlet_visibility_buffer: texture_storage_2d<r64uint, read>;
6@else
7@group(0) @binding(0) var meshlet_visibility_buffer: texture_storage_2d<r32uint, read>;
8@group(0) @binding(1) var<storage, read> meshlet_raster_clusters: array<InstancedOffset>; // Per cluster
9@group(0) @binding(2) var<storage, read> meshlet_instance_material_ids: array<u32>; // Per entity instance
11/// This pass writes out the depth texture.
12@fragment
13fn resolve_depth(in: FullscreenVertexOutput) -> @builtin(frag_depth) f32 {
14 let visibility = textureLoad(meshlet_visibility_buffer, vec2<u32>(in.position.xy)).r;
15 @if(MESHLET_VISIBILITY_BUFFER_RASTER_PASS_OUTPUT)
16 let depth = u32(visibility >> 32u);
17 @else
18 let depth = visibility;
20 if depth == 0u { discard; }
22 return bitcast<f32>(depth);
25/// This pass writes out the material depth texture.
26@if(MESHLET_VISIBILITY_BUFFER_RASTER_PASS_OUTPUT)
27@fragment
28fn resolve_material_depth(in: FullscreenVertexOutput) -> @builtin(frag_depth) f32 {
29 let visibility = textureLoad(meshlet_visibility_buffer, vec2<u32>(in.position.xy)).r;
31 let depth = visibility >> 32u;
32 if depth == 0lu { discard; }
34 let cluster_id = u32(visibility) >> 7u;
35 let instance_id = meshlet_raster_clusters[cluster_id].instance_id;
36 let material_id = meshlet_instance_material_ids[instance_id];
37 return f32(material_id) / 65535.0;
Contents