d3d12, microsoft/compiler: More shader compiler support for Vulkan/WebGPU shaders
The first commit of this series makes the DXIL backend use sampler variable binding data for emitting SRVs and samplers into DXIL. This breaks the d3d12
driver for GL pretty badly, so this commit also updates the GL driver to expect this behavior. /cc @kusma and @billkris.ms if you have time/interest to take a look. Note that currently this is structured a bit differently from D3D11On12, which always binds from 0 -> max (using nulls for all gaps in that range), instead this goes from min -> max.
The second commit updates the sampler splitting pass that the d3d12
driver uses. In GL, samplers are always combined into texture + sampler. In CL, they're always split. The DXIL backend currently always expects them to be split. The previous pass was dumb, and, if called, added a "bare" sampler for every texture (sampler with return type). That's not right for VK, because each texture isn't 1:1 with a sampler anymore. Also, the pass didn't modify instructions, assuming that just using the existing sampler_id
binding was sufficient after adding a new variable. The pass has been rewritten to support derefs and lowered samplers, including references to typed samplers, and references to already-bare samplers. Doing this without the previous change would also break GL pretty badly, as it can cause sampler bindings to no longer match up with SRVs, since we now don't split samplers for things like txf
.
After that, things get simpler:
- A bugfix for
bufferStore
- Support for Vulkan's "descriptor set" concept, which we map to DXIL's "binding space" concept. This is the inverse mapping that DXC does when going from HLSL -> SPIR-V.
- Handle resource arrays declared as
[]
, or unbounded. The size here is 0, which trips up some pre-existing assumptions.
With this, we no longer assert on the vast majority of DXC's HLSL filecheck test suite, though we still fail to compile large portions, or otherwise produce "incorrect" codegen (TBD how many of those are just being way too specific).