vkd3d-shader/hlsl: Check that a partial register's mask is also available in is_range_available().

This commit is contained in:
Zebediah Figura 2023-10-27 10:27:37 -05:00 committed by Alexandre Julliard
parent 7d49f9637a
commit c683fc9402
Notes: Alexandre Julliard 2023-11-07 22:40:26 +01:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/448

View File

@ -3556,13 +3556,19 @@ static struct hlsl_reg allocate_register(struct hlsl_ctx *ctx, struct register_a
static bool is_range_available(const struct register_allocator *allocator,
unsigned int first_write, unsigned int last_read, uint32_t reg_idx, unsigned int reg_size)
{
unsigned int last_reg_mask = (1u << (reg_size % 4)) - 1;
unsigned int writemask;
uint32_t i;
for (i = 0; i < (reg_size / 4); ++i)
{
if (get_available_writemask(allocator, first_write, last_read, reg_idx + i) != VKD3DSP_WRITEMASK_ALL)
writemask = get_available_writemask(allocator, first_write, last_read, reg_idx + i);
if (writemask != VKD3DSP_WRITEMASK_ALL)
return false;
}
writemask = get_available_writemask(allocator, first_write, last_read, reg_idx + (reg_size / 4));
if ((writemask & last_reg_mask) != last_reg_mask)
return false;
return true;
}