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.
1struct mesh_vertex_output__MeshVertexOutput {
2 @location(0) world_position: vec4<f32>,
3 @location(1) world_normal: vec3<f32>,
4 @location(2) uv: vec2<f32>,
5}
7struct pbr_types__StandardMaterial {
8 base_color: vec4<f32>,
9 emissive: vec4<f32>,
10 perceptual_roughness: f32,
11 metallic: f32,
12 reflectance: f32,
13 flags: u32,
14 alpha_cutoff: f32,
17struct mesh_types__Mesh {
18 model: mat4x4<f32>,
19 inverse_transpose_model: mat4x4<f32>,
20 flags: u32,
23struct mesh_view_types__View {
24 view_proj: mat4x4<f32>,
25 inverse_view_proj: mat4x4<f32>,
26 view: mat4x4<f32>,
27 inverse_view: mat4x4<f32>,
28 projection: mat4x4<f32>,
29 inverse_projection: mat4x4<f32>,
30 world_position: vec3<f32>,
31 width: f32,
32 height: f32,
35struct mesh_view_types__PointLight {
36 light_custom_data: vec4<f32>,
37 color_inverse_square_range: vec4<f32>,
38 position_radius: vec4<f32>,
39 flags: u32,
40 shadow_depth_bias: f32,
41 shadow_normal_bias: f32,
42 spot_light_tan_angle: f32,
45struct mesh_view_types__DirectionalLight {
46 view_projection: mat4x4<f32>,
47 color: vec4<f32>,
48 direction_to_light: vec3<f32>,
49 flags: u32,
50 shadow_depth_bias: f32,
51 shadow_normal_bias: f32,
54struct mesh_view_types__Lights {
55 directional_lights: array<mesh_view_types__DirectionalLight,1u>,
56 ambient_color: vec4<f32>,
57 cluster_dimensions: vec4<u32>,
58 cluster_factors: vec4<f32>,
59 n_directional_lights: u32,
60 spot_light_shadowmap_offset: i32,
63struct mesh_view_types__PointLights {
64 data: array<mesh_view_types__PointLight>,
67struct mesh_view_types__ClusterLightIndexLists {
68 data: array<u32>,
71struct mesh_view_types__ClusterOffsetsAndCounts {
72 data: array<vec4<u32>>,
75struct pbr_functions__PbrInput {
76 material: pbr_types__StandardMaterial,
77 occlusion: f32,
78 frag_coord: vec4<f32>,
79 world_position: vec4<f32>,
80 world_normal: vec3<f32>,
81 N: vec3<f32>,
82 V: vec3<f32>,
83 is_orthographic: bool,
86const pbr_types__STANDARD_MATERIAL_FLAGS_EMISSIVE_TEXTURE_BIT: u32 = 2u;
88const pbr_types__STANDARD_MATERIAL_FLAGS_UNLIT_BIT: u32 = 32u;
90const pbr_types__STANDARD_MATERIAL_FLAGS_ALPHA_MODE_BLEND: u32 = 256u;
92const pbr_types__STANDARD_MATERIAL_FLAGS_TWO_COMPONENT_NORMAL_MAP: u32 = 512u;
94const pbr_types__STANDARD_MATERIAL_FLAGS_ALPHA_MODE_MASK: u32 = 128u;
96const pbr_types__STANDARD_MATERIAL_FLAGS_DOUBLE_SIDED_BIT: u32 = 16u;
98const pbr_types__STANDARD_MATERIAL_FLAGS_BASE_COLOR_TEXTURE_BIT: u32 = 1u;
100const pbr_types__STANDARD_MATERIAL_FLAGS_METALLIC_ROUGHNESS_TEXTURE_BIT: u32 = 4u;
102const pbr_types__STANDARD_MATERIAL_FLAGS_OCCLUSION_TEXTURE_BIT: u32 = 8u;
104const pbr_types__STANDARD_MATERIAL_FLAGS_ALPHA_MODE_OPAQUE: u32 = 64u;
106const pbr_types__STANDARD_MATERIAL_FLAGS_FLIP_NORMAL_MAP_Y: u32 = 1024u;
108const mesh_types__MESH_FLAGS_SHADOW_RECEIVER_BIT: u32 = 1u;
110const mesh_view_types__POINT_LIGHT_FLAGS_SPOT_LIGHT_Y_NEGATIVE: u32 = 2u;
112const mesh_view_types__DIRECTIONAL_LIGHT_FLAGS_SHADOWS_ENABLED_BIT: u32 = 1u;
114const mesh_view_types__POINT_LIGHT_FLAGS_SHADOWS_ENABLED_BIT: u32 = 1u;
116const utils__PI: f32 = 3.1415927410125732;
118const clustered_forward__CLUSTER_COUNT_SIZE: u32 = 9u;
120@group(2) @binding(0)
121var<uniform> mesh_bindings__mesh: mesh_types__Mesh;
122@group(0) @binding(0)
123var<uniform> mesh_view_bindings__view: mesh_view_types__View;
124@group(0) @binding(2)
125var mesh_view_bindings__point_shadow_textures: texture_depth_cube_array;
126@group(0) @binding(5)
127var mesh_view_bindings__directional_shadow_textures_sampler: sampler_comparison;
128@group(0) @binding(6)
129var<storage> mesh_view_bindings__point_lights: mesh_view_types__PointLights;
130@group(0) @binding(1)
131var<uniform> mesh_view_bindings__lights: mesh_view_types__Lights;
132@group(0) @binding(3)
133var mesh_view_bindings__point_shadow_textures_sampler: sampler_comparison;
134@group(0) @binding(4)
135var mesh_view_bindings__directional_shadow_textures: texture_depth_2d_array;
136@group(0) @binding(7)
137var<storage> mesh_view_bindings__cluster_light_index_lists: mesh_view_types__ClusterLightIndexLists;
138@group(0) @binding(8)
139var<storage> mesh_view_bindings__cluster_offsets_and_counts: mesh_view_types__ClusterOffsetsAndCounts;
140@group(1) @binding(8)
141var pbr_bindings__occlusion_sampler: sampler;
142@group(1) @binding(0)
143var<uniform> pbr_bindings__material: pbr_types__StandardMaterial;
144@group(1) @binding(3)
145var pbr_bindings__emissive_texture: texture_2d<f32>;
146@group(1) @binding(1)
147var pbr_bindings__base_color_texture: texture_2d<f32>;
148@group(1) @binding(5)
149var pbr_bindings__metallic_roughness_texture: texture_2d<f32>;
150@group(1) @binding(4)
151var pbr_bindings__emissive_sampler: sampler;
152@group(1) @binding(6)
153var pbr_bindings__metallic_roughness_sampler: sampler;
154@group(1) @binding(2)
155var pbr_bindings__base_color_sampler: sampler;
156@group(1) @binding(10)
157var pbr_bindings__normal_map_sampler: sampler;
158@group(1) @binding(9)
159var pbr_bindings__normal_map_texture: texture_2d<f32>;
160@group(1) @binding(7)
161var pbr_bindings__occlusion_texture: texture_2d<f32>;
164fn pbr_functions__pbr(in: pbr_functions__PbrInput) -> vec4<f32> {
165 var output_color_2: vec4<f32>;
166 output_color_2 = in.material.base_color;
168 if ((in.material.flags & pbr_types__STANDARD_MATERIAL_FLAGS_ALPHA_MODE_OPAQUE) != 0u) {
169 output_color_2.w = 1.0;
170 } else {
171 if ((in.material.flags & pbr_types__STANDARD_MATERIAL_FLAGS_ALPHA_MODE_MASK) != 0u) {
172 let _e52: f32 = output_color_2.w;
173 if (_e52 >= in.material.alpha_cutoff) {
174 output_color_2.w = 1.0;
175 } else {
176 discard;
177 }
178 }
179 }
181 return output_color_2;
184@fragment
185fn fragment(mesh: mesh_vertex_output__MeshVertexOutput, @builtin(front_facing) is_front: bool, @builtin(position) frag_coord: vec4<f32>) -> @location(0) vec4<f32> {
186 var output_color: vec4<f32>;
187 var pbr_input: pbr_functions__PbrInput;
189 output_color = pbr_bindings__material.base_color;
191 if ((pbr_bindings__material.flags & pbr_types__STANDARD_MATERIAL_FLAGS_UNLIT_BIT) == 0u) {
192 pbr_input.material.base_color = output_color;
193 pbr_input.material.flags = pbr_bindings__material.flags;
194 pbr_input.material.metallic = 15.0; // unused
195 pbr_input.V = vec3<f32>(1.0, 2.0, 3.0); // unused
196 pbr_input.material.alpha_cutoff = pbr_bindings__material.alpha_cutoff;
198 output_color = pbr_functions__pbr(pbr_input);
199 }
200 return output_color;
Contents