Skip to content

vkd3d-shader/hlsl: Parse state blocks, part 1.

I am still working on parsing the remaining features of the effects framework, such as the FX functions for the state block entries -- such as SetBlendState() -- and the "compile" and "Compileshader()" syntax. However, after adding the many tests included in 2/7 and reading the feedback from !708 (closed), I think that this first batch of patches are going in the right direction in terms of parsing the state blocks and how to represent them internally.

As Nikolay mentioned in !708 (comment 64421) and !708 (comment 64444) there are many types of state blocks entries, which should be identified for writing the effect metadata.

A part that may cause discussion on this series is that I kept the representation of struct hlsl_state_block_entry using a hlsl_block to keep it general enough to represent all these types of state block entries, thinking on later implementing a helper to identify which type of entry we are dealing with.

Even though, as Nikolay pointed out, the instruction set of fx shaders is different, I still think that HLSL IR should be enough to represent the rhs of state blocks, and hopefully we won't need to pollute it too much (apart from the introduction of hlsl_ir_undeclared_load in 4/7 to avoid creating a new variable) if we find operations that are fx-specific, since I intend to represent calls to FX functions with the same struct hlsl_state_block_entry, given that they cannot be called in regular HLSL code. There are many validations that are applied on regular HLSL that still should be applied to state blocks, such as the use of valid swizzles and the correct use of operators.

Merge request reports

Loading