Skip to content

Commit d221665

Browse files
authored
Native unclipped depth on supported platforms (#16095)
# Objective - Fixes #16078 ## Solution - Rename things to clarify that we _want_ unclipped depth for directional light shadow views, and need some way of disabling the GPU's builtin depth clipping - Use DEPTH_CLIP_CONTROL instead of the fragment shader emulation on supported platforms - Pass only the clip position depth instead of the whole clip position between vertex->fragment shader (no idea if this helps performance or not, compiler might optimize it anyways) - Meshlets - HW raster always uses DEPTH_CLIP_CONTROL since it targets a more limited set of platforms - SW raster was not handling DEPTH_CLAMP_ORTHO correctly, it ended up pretty much doing nothing. - This PR made me realize that SW raster technically should have depth clipping for all views that are not directional light shadows, but I decided not to bother writing it. I'm not sure that it ever matters in practice. If proven otherwise, I can add it. ## Testing - Did you test these changes? If so, how? - Lighting example. Both opaque (no fragment shader) and alpha masked geometry (fragment shader emulation) are working with depth_clip_control, and both work when it's turned off. Also tested meshlet example. - Are there any parts that need more testing? - Performance. I can't figure out a good test scene. - How can other people (reviewers) test your changes? Is there anything specific they need to know? - Toggle depth_clip_control_supported in prepass/mod.rs line 323 to turn this PR on or off. - If relevant, what platforms did you test these changes on, and are there any important ones you can't test? - Native --- ## Migration Guide - `MeshPipelineKey::DEPTH_CLAMP_ORTHO` is now `MeshPipelineKey::UNCLIPPED_DEPTH_ORTHO` - The `DEPTH_CLAMP_ORTHO` shaderdef has been renamed to `UNCLIPPED_DEPTH_ORTHO_EMULATION` - `clip_position_unclamped: vec4<f32>` is now `unclipped_depth: f32`
1 parent f375422 commit d221665

11 files changed

+60
-105
lines changed

crates/bevy_pbr/src/meshlet/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ impl MeshletPlugin {
142142
WgpuFeatures::SHADER_INT64_ATOMIC_MIN_MAX
143143
| WgpuFeatures::SHADER_INT64
144144
| WgpuFeatures::SUBGROUP
145+
| WgpuFeatures::DEPTH_CLIP_CONTROL
145146
| WgpuFeatures::PUSH_CONSTANTS
146147
}
147148
}

crates/bevy_pbr/src/meshlet/pipelines.rs

Lines changed: 7 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,9 @@ pub struct MeshletPipelines {
3434
downsample_depth_second_shadow_view: CachedComputePipelineId,
3535
visibility_buffer_software_raster: CachedComputePipelineId,
3636
visibility_buffer_software_raster_depth_only: CachedComputePipelineId,
37-
visibility_buffer_software_raster_depth_only_clamp_ortho: CachedComputePipelineId,
3837
visibility_buffer_hardware_raster: CachedRenderPipelineId,
3938
visibility_buffer_hardware_raster_depth_only: CachedRenderPipelineId,
40-
visibility_buffer_hardware_raster_depth_only_clamp_ortho: CachedRenderPipelineId,
39+
visibility_buffer_hardware_raster_depth_only_unclipped: CachedRenderPipelineId,
4140
resolve_depth: CachedRenderPipelineId,
4241
resolve_depth_shadow_view: CachedRenderPipelineId,
4342
resolve_material_depth: CachedRenderPipelineId,
@@ -215,29 +214,6 @@ impl FromWorld for MeshletPipelines {
215214
},
216215
),
217216

218-
visibility_buffer_software_raster_depth_only_clamp_ortho: pipeline_cache
219-
.queue_compute_pipeline(ComputePipelineDescriptor {
220-
label: Some(
221-
"meshlet_visibility_buffer_software_raster_depth_only_clamp_ortho_pipeline"
222-
.into(),
223-
),
224-
layout: vec![visibility_buffer_raster_layout.clone()],
225-
push_constant_ranges: vec![],
226-
shader: MESHLET_VISIBILITY_BUFFER_SOFTWARE_RASTER_SHADER_HANDLE,
227-
shader_defs: vec![
228-
"MESHLET_VISIBILITY_BUFFER_RASTER_PASS".into(),
229-
"DEPTH_CLAMP_ORTHO".into(),
230-
if remap_1d_to_2d_dispatch_layout.is_some() {
231-
"MESHLET_2D_DISPATCH"
232-
} else {
233-
""
234-
}
235-
.into(),
236-
],
237-
entry_point: "rasterize_cluster".into(),
238-
zero_initialize_workgroup_memory: false,
239-
}),
240-
241217
visibility_buffer_hardware_raster: pipeline_cache.queue_render_pipeline(
242218
RenderPipelineDescriptor {
243219
label: Some("meshlet_visibility_buffer_hardware_raster_pipeline".into()),
@@ -324,10 +300,10 @@ impl FromWorld for MeshletPipelines {
324300
},
325301
),
326302

327-
visibility_buffer_hardware_raster_depth_only_clamp_ortho: pipeline_cache
303+
visibility_buffer_hardware_raster_depth_only_unclipped: pipeline_cache
328304
.queue_render_pipeline(RenderPipelineDescriptor {
329305
label: Some(
330-
"meshlet_visibility_buffer_hardware_raster_depth_only_clamp_ortho_pipeline"
306+
"meshlet_visibility_buffer_hardware_raster_depth_only_unclipped_pipeline"
331307
.into(),
332308
),
333309
layout: vec![visibility_buffer_raster_layout],
@@ -337,10 +313,7 @@ impl FromWorld for MeshletPipelines {
337313
}],
338314
vertex: VertexState {
339315
shader: MESHLET_VISIBILITY_BUFFER_HARDWARE_RASTER_SHADER_HANDLE,
340-
shader_defs: vec![
341-
"MESHLET_VISIBILITY_BUFFER_RASTER_PASS".into(),
342-
"DEPTH_CLAMP_ORTHO".into(),
343-
],
316+
shader_defs: vec!["MESHLET_VISIBILITY_BUFFER_RASTER_PASS".into()],
344317
entry_point: "vertex".into(),
345318
buffers: vec![],
346319
},
@@ -349,18 +322,15 @@ impl FromWorld for MeshletPipelines {
349322
strip_index_format: None,
350323
front_face: FrontFace::Ccw,
351324
cull_mode: Some(Face::Back),
352-
unclipped_depth: false,
325+
unclipped_depth: true,
353326
polygon_mode: PolygonMode::Fill,
354327
conservative: false,
355328
},
356329
depth_stencil: None,
357330
multisample: MultisampleState::default(),
358331
fragment: Some(FragmentState {
359332
shader: MESHLET_VISIBILITY_BUFFER_HARDWARE_RASTER_SHADER_HANDLE,
360-
shader_defs: vec![
361-
"MESHLET_VISIBILITY_BUFFER_RASTER_PASS".into(),
362-
"DEPTH_CLAMP_ORTHO".into(),
363-
],
333+
shader_defs: vec!["MESHLET_VISIBILITY_BUFFER_RASTER_PASS".into()],
364334
entry_point: "fragment".into(),
365335
targets: vec![Some(ColorTargetState {
366336
format: TextureFormat::R8Uint,
@@ -484,7 +454,6 @@ impl MeshletPipelines {
484454
&ComputePipeline,
485455
&ComputePipeline,
486456
&ComputePipeline,
487-
&ComputePipeline,
488457
&RenderPipeline,
489458
&RenderPipeline,
490459
&RenderPipeline,
@@ -506,14 +475,11 @@ impl MeshletPipelines {
506475
pipeline_cache.get_compute_pipeline(pipeline.visibility_buffer_software_raster)?,
507476
pipeline_cache
508477
.get_compute_pipeline(pipeline.visibility_buffer_software_raster_depth_only)?,
509-
pipeline_cache.get_compute_pipeline(
510-
pipeline.visibility_buffer_software_raster_depth_only_clamp_ortho,
511-
)?,
512478
pipeline_cache.get_render_pipeline(pipeline.visibility_buffer_hardware_raster)?,
513479
pipeline_cache
514480
.get_render_pipeline(pipeline.visibility_buffer_hardware_raster_depth_only)?,
515481
pipeline_cache.get_render_pipeline(
516-
pipeline.visibility_buffer_hardware_raster_depth_only_clamp_ortho,
482+
pipeline.visibility_buffer_hardware_raster_depth_only_unclipped,
517483
)?,
518484
pipeline_cache.get_render_pipeline(pipeline.resolve_depth)?,
519485
pipeline_cache.get_render_pipeline(pipeline.resolve_depth_shadow_view)?,

crates/bevy_pbr/src/meshlet/visibility_buffer_hardware_raster.wgsl

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ struct VertexOutput {
2323
#ifdef MESHLET_VISIBILITY_BUFFER_RASTER_PASS_OUTPUT
2424
@location(0) @interpolate(flat) packed_ids: u32,
2525
#endif
26-
#ifdef DEPTH_CLAMP_ORTHO
27-
@location(0) unclamped_clip_depth: f32,
28-
#endif
2926
}
3027

3128
@vertex
@@ -45,19 +42,12 @@ fn vertex(@builtin(instance_index) instance_index: u32, @builtin(vertex_index) v
4542
let vertex_position = get_meshlet_vertex_position(&meshlet, vertex_id);
4643
let world_from_local = affine3_to_square(instance_uniform.world_from_local);
4744
let world_position = mesh_position_local_to_world(world_from_local, vec4(vertex_position, 1.0));
48-
var clip_position = view.clip_from_world * vec4(world_position.xyz, 1.0);
49-
#ifdef DEPTH_CLAMP_ORTHO
50-
let unclamped_clip_depth = clip_position.z;
51-
clip_position.z = min(clip_position.z, 1.0);
52-
#endif
45+
let clip_position = view.clip_from_world * vec4(world_position.xyz, 1.0);
5346

5447
return VertexOutput(
5548
clip_position,
5649
#ifdef MESHLET_VISIBILITY_BUFFER_RASTER_PASS_OUTPUT
5750
(cluster_id << 7u) | triangle_id,
58-
#endif
59-
#ifdef DEPTH_CLAMP_ORTHO
60-
unclamped_clip_depth,
6151
#endif
6252
);
6353
}
@@ -70,9 +60,6 @@ fn fragment(vertex_output: VertexOutput) {
7060
let depth = bitcast<u32>(vertex_output.position.z);
7161
let visibility = (u64(depth) << 32u) | u64(vertex_output.packed_ids);
7262
atomicMax(&meshlet_visibility_buffer[frag_coord_1d], visibility);
73-
#else ifdef DEPTH_CLAMP_ORTHO
74-
let depth = bitcast<u32>(vertex_output.unclamped_clip_depth);
75-
atomicMax(&meshlet_visibility_buffer[frag_coord_1d], depth);
7663
#else
7764
let depth = bitcast<u32>(vertex_output.position.z);
7865
atomicMax(&meshlet_visibility_buffer[frag_coord_1d], depth);
@@ -84,9 +71,6 @@ fn dummy_vertex() -> VertexOutput {
8471
vec4(divide(0.0, 0.0)), // NaN vertex position
8572
#ifdef MESHLET_VISIBILITY_BUFFER_RASTER_PASS_OUTPUT
8673
0u,
87-
#endif
88-
#ifdef DEPTH_CLAMP_ORTHO
89-
0.0,
9074
#endif
9175
);
9276
}

crates/bevy_pbr/src/meshlet/visibility_buffer_raster_node.rs

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,9 @@ impl Node for MeshletVisibilityBufferRasterPassNode {
8585
downsample_depth_second_shadow_view_pipeline,
8686
visibility_buffer_software_raster_pipeline,
8787
visibility_buffer_software_raster_depth_only_pipeline,
88-
visibility_buffer_software_raster_depth_only_clamp_ortho,
8988
visibility_buffer_hardware_raster_pipeline,
9089
visibility_buffer_hardware_raster_depth_only_pipeline,
91-
visibility_buffer_hardware_raster_depth_only_clamp_ortho,
90+
visibility_buffer_hardware_raster_depth_only_unclipped_pipeline,
9291
resolve_depth_pipeline,
9392
resolve_depth_shadow_view_pipeline,
9493
resolve_material_depth_pipeline,
@@ -223,19 +222,12 @@ impl Node for MeshletVisibilityBufferRasterPassNode {
223222
continue;
224223
};
225224

226-
let (
227-
shadow_visibility_buffer_software_raster_pipeline,
228-
shadow_visibility_buffer_hardware_raster_pipeline,
229-
) = match light_type {
230-
LightEntity::Directional { .. } => (
231-
visibility_buffer_software_raster_depth_only_clamp_ortho,
232-
visibility_buffer_hardware_raster_depth_only_clamp_ortho,
233-
),
234-
_ => (
235-
visibility_buffer_software_raster_depth_only_pipeline,
236-
visibility_buffer_hardware_raster_depth_only_pipeline,
237-
),
238-
};
225+
let shadow_visibility_buffer_hardware_raster_pipeline =
226+
if let LightEntity::Directional { .. } = light_type {
227+
visibility_buffer_hardware_raster_depth_only_unclipped_pipeline
228+
} else {
229+
visibility_buffer_hardware_raster_depth_only_pipeline
230+
};
239231

240232
render_context.command_encoder().push_debug_group(&format!(
241233
"meshlet_visibility_buffer_raster: {}",
@@ -270,7 +262,7 @@ impl Node for MeshletVisibilityBufferRasterPassNode {
270262
&meshlet_view_resources.dummy_render_target.default_view,
271263
meshlet_view_bind_groups,
272264
view_offset,
273-
shadow_visibility_buffer_software_raster_pipeline,
265+
visibility_buffer_software_raster_depth_only_pipeline,
274266
shadow_visibility_buffer_hardware_raster_pipeline,
275267
None,
276268
meshlet_view_resources.raster_cluster_rightmost_slot,
@@ -306,7 +298,7 @@ impl Node for MeshletVisibilityBufferRasterPassNode {
306298
&meshlet_view_resources.dummy_render_target.default_view,
307299
meshlet_view_bind_groups,
308300
view_offset,
309-
shadow_visibility_buffer_software_raster_pipeline,
301+
visibility_buffer_software_raster_depth_only_pipeline,
310302
shadow_visibility_buffer_hardware_raster_pipeline,
311303
None,
312304
meshlet_view_resources.raster_cluster_rightmost_slot,

crates/bevy_pbr/src/meshlet/visibility_buffer_software_raster.wgsl

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,7 @@ fn rasterize_cluster(
5757
// Project vertex to viewport space
5858
let world_position = mesh_position_local_to_world(world_from_local, vec4(vertex_position, 1.0));
5959
let clip_position = view.clip_from_world * vec4(world_position.xyz, 1.0);
60-
var ndc_position = clip_position.xyz / clip_position.w;
61-
#ifdef DEPTH_CLAMP_ORTHO
62-
ndc_position.z = 1.0 / clip_position.z;
63-
#endif
60+
let ndc_position = clip_position.xyz / clip_position.w;
6461
let viewport_position_xy = ndc_to_uv(ndc_position.xy) * view.viewport.zw;
6562

6663
// Write vertex to workgroup shared memory
@@ -176,9 +173,6 @@ fn write_visibility_buffer_pixel(x: f32, y: f32, z: f32, packed_ids: u32) {
176173
let depth = bitcast<u32>(z);
177174
let visibility = (u64(depth) << 32u) | u64(packed_ids);
178175
atomicMax(&meshlet_visibility_buffer[frag_coord_1d], visibility);
179-
#else ifdef DEPTH_CLAMP_ORTHO
180-
let depth = bitcast<u32>(1.0 / z);
181-
atomicMax(&meshlet_visibility_buffer[frag_coord_1d], depth);
182176
#else
183177
let depth = bitcast<u32>(z);
184178
atomicMax(&meshlet_visibility_buffer[frag_coord_1d], depth);

crates/bevy_pbr/src/prepass/mod.rs

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,7 @@ pub struct PrepassPipeline<M: Material> {
251251
pub deferred_material_vertex_shader: Option<Handle<Shader>>,
252252
pub deferred_material_fragment_shader: Option<Handle<Shader>>,
253253
pub material_pipeline: MaterialPipeline<M>,
254+
pub depth_clip_control_supported: bool,
254255
_marker: PhantomData<M>,
255256
}
256257

@@ -289,6 +290,10 @@ impl<M: Material> FromWorld for PrepassPipeline<M> {
289290

290291
let mesh_pipeline = world.resource::<MeshPipeline>();
291292

293+
let depth_clip_control_supported = render_device
294+
.features()
295+
.contains(WgpuFeatures::DEPTH_CLIP_CONTROL);
296+
292297
PrepassPipeline {
293298
view_layout_motion_vectors,
294299
view_layout_no_motion_vectors,
@@ -315,6 +320,7 @@ impl<M: Material> FromWorld for PrepassPipeline<M> {
315320
},
316321
material_layout: M::bind_group_layout(render_device),
317322
material_pipeline: world.resource::<MaterialPipeline<M>>().clone(),
323+
depth_clip_control_supported,
318324
_marker: PhantomData,
319325
}
320326
}
@@ -379,8 +385,14 @@ where
379385
vertex_attributes.push(Mesh::ATTRIBUTE_POSITION.at_shader_location(0));
380386
}
381387

382-
if key.mesh_key.contains(MeshPipelineKey::DEPTH_CLAMP_ORTHO) {
383-
shader_defs.push("DEPTH_CLAMP_ORTHO".into());
388+
// For directional light shadow map views, use unclipped depth via either the native GPU feature,
389+
// or emulated by setting depth in the fragment shader for GPUs that don't support it natively.
390+
let emulate_unclipped_depth = key
391+
.mesh_key
392+
.contains(MeshPipelineKey::UNCLIPPED_DEPTH_ORTHO)
393+
&& !self.depth_clip_control_supported;
394+
if emulate_unclipped_depth {
395+
shader_defs.push("UNCLIPPED_DEPTH_ORTHO_EMULATION".into());
384396
// PERF: This line forces the "prepass fragment shader" to always run in
385397
// common scenarios like "directional light calculation". Doing so resolves
386398
// a pretty nasty depth clamping bug, but it also feels a bit excessive.
@@ -389,6 +401,10 @@ where
389401
// https://github.com/bevyengine/bevy/pull/8877
390402
shader_defs.push("PREPASS_FRAGMENT".into());
391403
}
404+
let unclipped_depth = key
405+
.mesh_key
406+
.contains(MeshPipelineKey::UNCLIPPED_DEPTH_ORTHO)
407+
&& self.depth_clip_control_supported;
392408

393409
if layout.0.contains(Mesh::ATTRIBUTE_UV_0) {
394410
shader_defs.push("VERTEX_UVS".into());
@@ -488,10 +504,10 @@ where
488504
}
489505

490506
// The fragment shader is only used when the normal prepass or motion vectors prepass
491-
// is enabled or the material uses alpha cutoff values and doesn't rely on the standard
492-
// prepass shader or we are clamping the orthographic depth.
507+
// is enabled, the material uses alpha cutoff values and doesn't rely on the standard
508+
// prepass shader, or we are emulating unclipped depth in the fragment shader.
493509
let fragment_required = !targets.is_empty()
494-
|| key.mesh_key.contains(MeshPipelineKey::DEPTH_CLAMP_ORTHO)
510+
|| emulate_unclipped_depth
495511
|| (key.mesh_key.contains(MeshPipelineKey::MAY_DISCARD)
496512
&& self.prepass_material_fragment_shader.is_some());
497513

@@ -544,7 +560,7 @@ where
544560
strip_index_format: None,
545561
front_face: FrontFace::Ccw,
546562
cull_mode: None,
547-
unclipped_depth: false,
563+
unclipped_depth,
548564
polygon_mode: PolygonMode::Fill,
549565
conservative: false,
550566
},

crates/bevy_pbr/src/prepass/prepass.wgsl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,10 @@ fn vertex(vertex_no_morph: Vertex) -> VertexOutput {
7676

7777
out.world_position = mesh_functions::mesh_position_local_to_world(world_from_local, vec4<f32>(vertex.position, 1.0));
7878
out.position = position_world_to_clip(out.world_position.xyz);
79-
#ifdef DEPTH_CLAMP_ORTHO
80-
out.clip_position_unclamped = out.position;
81-
out.position.z = min(out.position.z, 1.0);
82-
#endif // DEPTH_CLAMP_ORTHO
79+
#ifdef UNCLIPPED_DEPTH_ORTHO_EMULATION
80+
out.unclipped_depth = out.position.z;
81+
out.position.z = min(out.position.z, 1.0); // Clamp depth to avoid clipping
82+
#endif // UNCLIPPED_DEPTH_ORTHO_EMULATION
8383

8484
#ifdef VERTEX_UVS_A
8585
out.uv = vertex.uv;
@@ -173,9 +173,9 @@ fn fragment(in: VertexOutput) -> FragmentOutput {
173173
out.normal = vec4(in.world_normal * 0.5 + vec3(0.5), 1.0);
174174
#endif
175175

176-
#ifdef DEPTH_CLAMP_ORTHO
177-
out.frag_depth = in.clip_position_unclamped.z;
178-
#endif // DEPTH_CLAMP_ORTHO
176+
#ifdef UNCLIPPED_DEPTH_ORTHO_EMULATION
177+
out.frag_depth = in.unclipped_depth;
178+
#endif // UNCLIPPED_DEPTH_ORTHO_EMULATION
179179

180180
#ifdef MOTION_VECTOR_PREPASS
181181
let clip_position_t = view.unjittered_clip_from_world * in.world_position;

crates/bevy_pbr/src/prepass/prepass_io.wgsl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ struct VertexOutput {
6060
@location(5) previous_world_position: vec4<f32>,
6161
#endif
6262

63-
#ifdef DEPTH_CLAMP_ORTHO
64-
@location(6) clip_position_unclamped: vec4<f32>,
65-
#endif // DEPTH_CLAMP_ORTHO
63+
#ifdef UNCLIPPED_DEPTH_ORTHO_EMULATION
64+
@location(6) unclipped_depth: f32,
65+
#endif // UNCLIPPED_DEPTH_ORTHO_EMULATION
6666
#ifdef VERTEX_OUTPUT_INSTANCE_INDEX
6767
@location(7) instance_index: u32,
6868
#endif
@@ -87,8 +87,8 @@ struct FragmentOutput {
8787
@location(3) deferred_lighting_pass_id: u32,
8888
#endif
8989

90-
#ifdef DEPTH_CLAMP_ORTHO
90+
#ifdef UNCLIPPED_DEPTH_ORTHO_EMULATION
9191
@builtin(frag_depth) frag_depth: f32,
92-
#endif // DEPTH_CLAMP_ORTHO
92+
#endif // UNCLIPPED_DEPTH_ORTHO_EMULATION
9393
}
9494
#endif //PREPASS_FRAGMENT

crates/bevy_pbr/src/render/light.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1554,7 +1554,7 @@ pub fn queue_shadows<M: Material>(
15541554
.expect("Failed to get spot light visible entities"),
15551555
};
15561556
let mut light_key = MeshPipelineKey::DEPTH_PREPASS;
1557-
light_key.set(MeshPipelineKey::DEPTH_CLAMP_ORTHO, is_directional_light);
1557+
light_key.set(MeshPipelineKey::UNCLIPPED_DEPTH_ORTHO, is_directional_light);
15581558

15591559
// NOTE: Lights with shadow mapping disabled will have no visible entities
15601560
// so no meshes will be queued

crates/bevy_pbr/src/render/mesh.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1489,7 +1489,9 @@ bitflags::bitflags! {
14891489
// See: https://www.khronos.org/opengl/wiki/Early_Fragment_Test
14901490
const ENVIRONMENT_MAP = 1 << 8;
14911491
const SCREEN_SPACE_AMBIENT_OCCLUSION = 1 << 9;
1492-
const DEPTH_CLAMP_ORTHO = 1 << 10;
1492+
const UNCLIPPED_DEPTH_ORTHO = 1 << 10; // Disables depth clipping for use with directional light shadow views
1493+
// Emulated via fragment shader depth on hardware that doesn't support it natively
1494+
// See: https://www.w3.org/TR/webgpu/#depth-clipping and https://therealmjp.github.io/posts/shadow-maps/#disabling-z-clipping
14931495
const TEMPORAL_JITTER = 1 << 11;
14941496
const READS_VIEW_TRANSMISSION_TEXTURE = 1 << 12;
14951497
const LIGHTMAPPED = 1 << 13;

0 commit comments

Comments
 (0)