On Tue Jan 31 18:37:19 2023 +0000, Zebediah Figura wrote:
So, I don't see much reason to have them represent another level of
indirection using values such as `HLSL_REGSET_RESOURCES` since they are used pass this point of backend-specific-ness. I don't see how this is another level of indirection. The idea is HLSL_REGSET_RESOURCE would map to VKD3DSPR_RESOURCE / VKD3D_SM4_RT_RESOURCE for sm4, and VKD3DSPR_SAMPLER for sm1.
What I am currently doing is to have each regset represent a single letter used for register reservations (and thus, in the assembly), which also matches the "space" that is used for calculating the register offsets of the object components within a struct.
So, SM1 would be mapping samplers (and the textures that result from combining sampler+texture, in following patches) to `HLSL_REGSET_S`, while for SM4 we would be mapping samplers to `HLSL_REGSET_S` and textures to `HLSL_REGSET_T`. This mapping is done now in `hlsl_type_get_regset()`.
``` SM1: Texture -> HLSL_REGSET_S -> D3DSPR_SAMPLER Sampler -> HLSL_REGSET_S -> D3DSPR_SAMPLER
SM4: Texture -> HLSL_REGSET_T -> VKD3D_SM4_RT_RESOURCE Sampler -> HLSL_REGSET_S -> VKD3D_SM4_RT_SAMPLER UAV -> HLSL_REGSET_U -> VKD3D_SM5_RT_UAV ```
If I am understanding correctly, based on your last comment, you are suggesting doing:
``` SM1: Texture -> HLSL_REGSET_RESOURCE -> D3DSPR_SAMPLER Sampler -> HLSL_REGSET_SAMPLER -> D3DSPR_SAMPLER
SM4: Texture -> HLSL_REGSET_RESOURCE -> VKD3D_SM4_RT_RESOURCE Sampler -> HLSL_REGSET_SAMPLER -> VKD3D_SM4_RT_SAMPLER UAV -> HLSL_REGSET_UAV -> VKD3D_SM5_RT_UAV ```
which means, always assigning each type to the same regset, regardless of the shader model, deferring the mapping to a unique register type until writing the binary. But if we do this, we would require an intermediate mapping from `HLSL_REGSET_*` to the letters used for register reservations and the different register spaces used for calculating offsets. Because, in SM1, sampler and texture indexes are not separated.