Skip to content

Commit

Permalink
Workaround for ICE in the DXC shader compiler in debug builds with an…
Browse files Browse the repository at this point in the history
… `EnvironmentMapLight` (#11487)

# Objective

DXC+DX12 debug builds with an environment map have been broken since
#11366 merged due to an internal
compiler error in DXC. I tracked it down to a single `break` statement
and reported it upstream
(microsoft/DirectXShaderCompiler#6183)

## Solution

Workaround the ICE by setting the for loop index variable to the max
value of the loop to avoid the `break` that's causing the ICE.

This works because it's the last thing in the for loop.

The `reflection_probes` and `pbr` examples both appear to still work
correctly.
  • Loading branch information
Elabajaba authored Jan 27, 2024
1 parent c227fc9 commit 45e920c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion crates/bevy_pbr/src/light_probe/environment_map.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,12 @@ fn compute_radiances(
if (all(abs(probe_space_pos) <= vec3(0.5))) {
cubemap_index = reflection_probe.cubemap_index;
intensity = reflection_probe.intensity;
break;
// TODO: Workaround for ICE in DXC https://github.com/microsoft/DirectXShaderCompiler/issues/6183
// This works because it's the last thing that happens in the for loop, and will break as soon as it
// goes back to the top of the loop.
// We can't use `break` here because of the ICE.
// break;
reflection_probe_index = light_probes.reflection_probe_count;
}
}

Expand Down

0 comments on commit 45e920c

Please sign in to comment.