This commit is part of a series of commits intended to remove all uses of hlsl_type_get_regset(). However, I think it deserves to be upstreamed sooner since it solves a rather important SM1 regression (explained below) introduced in e0031d2a1f40792ac85619a495bf5197f248b0e1 . --- In SM1 we can expect all variables to always belong to a single regset. structs in particular, should always be allocated to HLSL_REGSET_NUM, since they are only allowed if all their components are numeric. We are not covering the structs case because of the use of hlsl_type_get_regset(), which is currently not defined for structs. So the current shader ```hlsl struct { float4 a; float4 b; } apple; float4 main() : sv_target { return apple.a + apple.b; } ``` fails with ``` vkd3d/libs/vkd3d-shader/hlsl.c:224: Aborting, reached unreachable code. ``` The solution is to iterate over all regsets to find the one where the variable is allocated (if any), and ignore all others. -- https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/236