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 @location(3) normal: vec3<f32>,
19#ifdef VERTEX_TANGENTS
20 @location(4) tangent: vec4<f32>,
21#endif
22#endif // NORMAL_PREPASS_OR_DEFERRED_PREPASS
24#ifdef SKINNED
25 @location(5) joint_indices: vec4<u32>,
26 @location(6) joint_weights: vec4<f32>,
27#endif
29#ifdef VERTEX_COLORS
30 @location(7) color: vec4<f32>,
31#endif
33#ifdef MORPH_TARGETS
34 @builtin(vertex_index) index: u32,
35#endif // MORPH_TARGETS
38struct VertexOutput {
39 // This is `clip position` when the struct is used as a vertex stage output
40 // and `frag coord` when used as a fragment stage input
41 @builtin(position) position: vec4<f32>,
43#ifdef VERTEX_UVS_A
44 @location(0) uv: vec2<f32>,
45#endif
47#ifdef VERTEX_UVS_B
48 @location(1) uv_b: vec2<f32>,
49#endif
51#ifdef NORMAL_PREPASS_OR_DEFERRED_PREPASS
52 @location(2) world_normal: vec3<f32>,
53#ifdef VERTEX_TANGENTS
54 @location(3) world_tangent: vec4<f32>,
55#endif
56#endif // NORMAL_PREPASS_OR_DEFERRED_PREPASS
58 @location(4) world_position: vec4<f32>,
59#ifdef MOTION_VECTOR_PREPASS
60 @location(5) previous_world_position: vec4<f32>,
61#endif
63#ifdef DEPTH_CLAMP_ORTHO
64 @location(6) clip_position_unclamped: vec4<f32>,
65#endif // DEPTH_CLAMP_ORTHO
66#ifdef VERTEX_OUTPUT_INSTANCE_INDEX
67 @location(7) instance_index: u32,
68#endif
70#ifdef VERTEX_COLORS
71 @location(8) color: vec4<f32>,
72#endif
75#ifdef PREPASS_FRAGMENT
76struct FragmentOutput {
77#ifdef NORMAL_PREPASS
78 @location(0) normal: vec4<f32>,
79#endif
81#ifdef MOTION_VECTOR_PREPASS
82 @location(1) motion_vector: vec2<f32>,
83#endif
85#ifdef DEFERRED_PREPASS
86 @location(2) deferred: vec4<u32>,
87 @location(3) deferred_lighting_pass_id: u32,
88#endif
90#ifdef DEPTH_CLAMP_ORTHO
91 @builtin(frag_depth) frag_depth: f32,
92#endif // DEPTH_CLAMP_ORTHO
94#endif //PREPASS_FRAGMENT
Contents