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 package::render::mesh_view_bindings as view_bindings;
3@if(DEPTH_PREPASS)
4fn prepass_depth(frag_coord: vec4<f32>, sample_index: u32) -> f32 {
5 @if(MULTISAMPLED)
6 return textureLoad(view_bindings::depth_prepass_texture, vec2<i32>(frag_coord.xy), i32(sample_index));
7 @else // MULTISAMPLED
8 return textureLoad(view_bindings::depth_prepass_texture, vec2<i32>(frag_coord.xy), 0);
9}
11@if(NORMAL_PREPASS)
12fn prepass_normal(frag_coord: vec4<f32>, sample_index: u32) -> vec3<f32> {
13 @if(MULTISAMPLED)
14 let normal_sample = textureLoad(view_bindings::normal_prepass_texture, vec2<i32>(frag_coord.xy), i32(sample_index));
15 @else
16 let normal_sample = textureLoad(view_bindings::normal_prepass_texture, vec2<i32>(frag_coord.xy), 0);
17 return normalize(normal_sample.xyz * 2.0 - vec3(1.0));
20@if(MOTION_VECTOR_PREPASS)
21fn prepass_motion_vector(frag_coord: vec4<f32>, sample_index: u32) -> vec2<f32> {
22 @if(MULTISAMPLED)
23 let motion_vector_sample = textureLoad(view_bindings::motion_vector_prepass_texture, vec2<i32>(frag_coord.xy), i32(sample_index));
24 @else
25 let motion_vector_sample = textureLoad(view_bindings::motion_vector_prepass_texture, vec2<i32>(frag_coord.xy), 0);
26 return motion_vector_sample.rg;
Contents