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#define_import_path bevy_pbr::prepass_utils
3#import bevy_pbr::mesh_view_bindings as view_bindings
5#ifdef DEPTH_PREPASS
6fn prepass_depth(frag_coord: vec4<f32>, sample_index: u32) -> f32 {
7#ifdef MULTISAMPLED
8 return textureLoad(view_bindings::depth_prepass_texture, vec2<i32>(frag_coord.xy), i32(sample_index));
9#else // MULTISAMPLED
10 return textureLoad(view_bindings::depth_prepass_texture, vec2<i32>(frag_coord.xy), 0);
11#endif // MULTISAMPLED
13#endif // DEPTH_PREPASS
15#ifdef NORMAL_PREPASS
16fn prepass_normal(frag_coord: vec4<f32>, sample_index: u32) -> vec3<f32> {
17#ifdef MULTISAMPLED
18 let normal_sample = textureLoad(view_bindings::normal_prepass_texture, vec2<i32>(frag_coord.xy), i32(sample_index));
19#else
20 let normal_sample = textureLoad(view_bindings::normal_prepass_texture, vec2<i32>(frag_coord.xy), 0);
21#endif // MULTISAMPLED
22 return normalize(normal_sample.xyz * 2.0 - vec3(1.0));
24#endif // NORMAL_PREPASS
26#ifdef MOTION_VECTOR_PREPASS
27fn prepass_motion_vector(frag_coord: vec4<f32>, sample_index: u32) -> vec2<f32> {
28#ifdef MULTISAMPLED
29 let motion_vector_sample = textureLoad(view_bindings::motion_vector_prepass_texture, vec2<i32>(frag_coord.xy), i32(sample_index));
30#else
31 let motion_vector_sample = textureLoad(view_bindings::motion_vector_prepass_texture, vec2<i32>(frag_coord.xy), 0);
32#endif
33 return motion_vector_sample.rg;
35#endif // MOTION_VECTOR_PREPASS
Contents