On Mon Feb 6 23:44:57 2023 +0000, Zebediah Figura wrote:
Yeah, that's about what I was envisioning. No worries, glad we're on the same page.
Ugh, I hate to come back to this :( ... but while working on rebasing master6 (it takes some time because they are 26 patches) with the new scheme for the regset enum, I found a good reason for going for this instead:
``` SM1: Texture -> HLSL_REGSET_SAMPLERS -> D3DSPR_SAMPLER ('s') Sampler -> HLSL_REGSET_SAMPLERS -> D3DSPR_SAMPLER ('s')
SM4: Texture -> HLSL_REGSET_TEXTURES -> VKD3D_SM4_RT_RESOURCE ('t') Sampler -> HLSL_REGSET_SAMPLERS -> VKD3D_SM4_RT_SAMPLER ('s') UAV -> HLSL_REGSET_UAVS -> VKD3D_SM5_RT_UAV ('u') ```
The reason is that SM1 textures and samples, and SM4 samplers have in common the rule that multi-register variables (such as arrays of these types) only allocate registers until the last one used. If I go for `HLSL_REGSET_RESOURCE`, I would have to add many `ctx->profile->major_vesion < 4` conditionals for this regset to behave one way or the other.
In short, SM1 textures and samplers have more in common with SM4 samplers regarding register allocation than with SM4 textures (`HLSL_REGSET_RESOURCES` is a fuzzier division, it pertains to where these types are present in IR resource loads).
I understand that this matching the letters in the assembly is just serendipity! Hence I accept that using single letter in the enum names is wrong, but perhaps it was okay to match types to regsets this way.
Furthermore, perhaps it even makes sense to consider SM1 and SM4 regsets as different enum values ``` SM1: Texture -> HLSL_REGSET_SM1_RESOURCES -> D3DSPR_SAMPLER ('s') Sampler -> HLSL_REGSET_SM1_RESOURCES -> D3DSPR_SAMPLER ('s')
SM4: Texture -> HLSL_REGSET_SM4_TEXTURES -> VKD3D_SM4_RT_RESOURCE ('t') Sampler -> HLSL_REGSET_SM4_SAMPLERS -> VKD3D_SM4_RT_SAMPLER ('s') UAV -> HLSL_REGSET_SM4_UAVS -> VKD3D_SM5_RT_UAV ('u') ```
but so far seems that this `HLSL_REGSET_SM4_SAMPLERS` is similar enough to `HLSL_REGSET_SM1_RESOURCES` to allow the recycling.