Skip to content

vkd3d-shader/hlsl: Stop using hlsl_type_get_regset().

Francisco Casas requested to merge fcasas/vkd3d:regset_improvements into master

As has been pointed out a couple of times, mainly by @zfigura, hlsl_type_get_regset() is not defined for structs. So it is responsibility of the programmer to ensure that the data type in question belongs to a single regset before calling that function.

Turns out that when we call this function we either have to handle the possibility of the type spanning across multiple regsets, or we want the regset of a single component or vector, so this MR replaces the calls to hlsl_type_get_regset() with either a for loop that goes through all the pertaining regsets, hlsl_type_get_component_offset(), or hlsl_deref_get_regset().

hlsl_type_get_regset() is still needed in the implementation of these functions, so it is downgraded to a static function for hlsl.c instead of being completely removed.

The tests in 3/5 (structs with multiple register reservations) are to explain why it makes sense to iterate over the regsets in 4/5 even if we don't have a proper implementation for register reservations on structs that span across mutiple regsets yet.

Edited by Francisco Casas

Merge request reports

Loading