Skip to content

vkd3d-shader/ir: Transform clip/cull input/outputs into arrays, version 3.

Rewrite of !1540 (closed), which is a rewrite of Conor's !564 (closed). It also supersedes !1506 (closed). !1285 is blocked by the issue this solves.

This takes care of translating clip/cull sysvals in the DirectX convention of two 4-component registers, into the SPIR-V/GLSL convention of two 8-element arrays.

For more information on the current behavior see !1506 (closed). There was discussion on !1548 which was then moved to !1540 (closed).

The approach in !1540 (closed) consisted on replacing every src and dst with temps on every instruction that referenced input/output clip/cull sysvals; adding instructions right before to copy the input components from the new input array into the temp, and instructions right after to store the output temp components into the new output array.

I discarded this approach because the discussion got a bit stuck and there seemed to be more push to copy from the input to the temps at the beginning of the program and from the temps to the outputs at the return points, so I did that. Indexable temps are required for this, and some arithmetic to account for the fact that we don't have multi-dimensional indexable temps, but I think it is way cleaner than my initial out-of-branch implementation of this idea, thanks to Giovanni's insights.

While this does not implement Henri's idea of creating new register types as a layer of indirection, I think I made this version a simple as I could so it could work as a starting point if that is required, also I think is general enough if the same issue appears for other sysvals.

Merge request reports

Loading