Skip to content

d3d12, dxil: Rework clip/cull distance handling

Jesse Natalie requested to merge jenatali/mesa:clip-distance into master

Clip/cull distance in DXIL is similar to GLSL in that it's up to 8 scalar floats between clip and cull, but looks a little different in that they're required to be chunked as 2 float4s, largely because that's how D3D has always expressed its I/O signatures. This series:

  • Adds support for "compact" arrays of scalars to nir_to_dxil, under the assumption that each compact array doesn't straddle a 4-component boundary.
  • Adds a lowering pass to break apart arrays that would otherwise not be handled by nir_to_dxil.
  • Adds lowering/optimization passes to spirv_to_dxil so that the above lowering pass can realistically work (requires a direct set of derefs from array var -> store).
  • Opts the d3d12 driver into using compact arrays instead of the float4 representation, largely just for testing.

The goal here is to be able to handle clip/cull from SPIR-V, which currently always outputs the compact array scalars. Rather than try to back-convert them to the float4 approach, we can just handle the compact array directly.

Edited by Jesse Natalie

Merge request reports