vkd3d-shader/dxil: Handle forward pointer references in a fixup pass.

In DXIL pointers (as any other value) can be forward references. This is makes it a little bit harder for us, because in order to generate VSIR we have to know the pointer value (basically, what resource it points to and with which offset), not just its type. That's because VSIR doesn't have the concept of a pointer, each specific resource type has their own way to express access, possibly even using different instructions. We solve this problem by deferring code generation to a fixup pass for instructions that dereference pointers. In the first pass the instruction is validated, but no instruction is written. The relevant information is stored along with an iterator to the instruction location in a table. When the whole code has been parsed we have enough information to dereference all pointers the table is replayed.

Unfortunately we don't have test cases for this. So far I never managed to deliberately generate a forward reference with DXC, and indeed even in my collection of shaders only a small minority has forward references.

Merge request reports

Loading