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_io
3// Most of these attributes are not used in the default prepass fragment shader, but they are still needed so we can
4// pass them to custom prepass shaders like pbr_prepass.wgsl.
5struct Vertex {
6 @builtin(instance_index) instance_index: u32,
7 @location(0) position: vec3<f32>,
9#ifdef VERTEX_UVS_A
10 @location(1) uv: vec2<f32>,
11#endif
13#ifdef VERTEX_UVS_B
14 @location(2) uv_b: vec2<f32>,
15#endif
17#ifdef NORMAL_PREPASS_OR_DEFERRED_PREPASS
18#ifdef VERTEX_NORMALS
19 @location(3) normal: vec3<f32>,
20#endif
21#ifdef VERTEX_TANGENTS
22 @location(4) tangent: vec4<f32>,
23#endif
24#endif // NORMAL_PREPASS_OR_DEFERRED_PREPASS
26#ifdef SKINNED
27 @location(5) joint_indices: vec4<u32>,
28 @location(6) joint_weights: vec4<f32>,
29#endif
31#ifdef VERTEX_COLORS
32 @location(7) color: vec4<f32>,
33#endif
35#ifdef MORPH_TARGETS
36 @builtin(vertex_index) index: u32,
37#endif // MORPH_TARGETS
40struct VertexOutput {
41 // This is `clip position` when the struct is used as a vertex stage output
42 // and `frag coord` when used as a fragment stage input
43 @builtin(position) position: vec4<f32>,
45#ifdef VERTEX_UVS_A
46 @location(0) uv: vec2<f32>,
47#endif
49#ifdef VERTEX_UVS_B
50 @location(1) uv_b: vec2<f32>,
51#endif
53#ifdef NORMAL_PREPASS_OR_DEFERRED_PREPASS
54 @location(2) world_normal: vec3<f32>,
55#ifdef VERTEX_TANGENTS
56 @location(3) world_tangent: vec4<f32>,
57#endif
58#endif // NORMAL_PREPASS_OR_DEFERRED_PREPASS
60 @location(4) world_position: vec4<f32>,
61#ifdef MOTION_VECTOR_PREPASS
62 @location(5) previous_world_position: vec4<f32>,
63#endif
65#ifdef UNCLIPPED_DEPTH_ORTHO_EMULATION
66 @location(6) unclipped_depth: f32,
67#endif // UNCLIPPED_DEPTH_ORTHO_EMULATION
68#ifdef VERTEX_OUTPUT_INSTANCE_INDEX
69 @location(7) instance_index: u32,
70#endif
72#ifdef VERTEX_COLORS
73 @location(8) color: vec4<f32>,
74#endif
76#ifdef VISIBILITY_RANGE_DITHER
77 @location(9) @interpolate(flat) visibility_range_dither: i32,
78#endif // VISIBILITY_RANGE_DITHER
81#ifdef PREPASS_FRAGMENT
82struct FragmentOutput {
83#ifdef NORMAL_PREPASS
84 @location(0) normal: vec4<f32>,
85#endif
87#ifdef MOTION_VECTOR_PREPASS
88 @location(1) motion_vector: vec2<f32>,
89#endif
91#ifdef DEFERRED_PREPASS
92 @location(2) deferred: vec4<u32>,
93 @location(3) deferred_lighting_pass_id: u32,
94#endif
96#ifdef UNCLIPPED_DEPTH_ORTHO_EMULATION
97 @builtin(frag_depth) frag_depth: f32,
98#endif // UNCLIPPED_DEPTH_ORTHO_EMULATION
100#endif //PREPASS_FRAGMENT
Contents