vkd3d-shader/hlsl: Calculate the bind count from the vector width.

Scalars have a reg_size of 4 on sm1. In the case of a deref of a vector or
matrix resulting in a scalar, however, this yields a required_bind_count that is
one higher than it should be. reg_size is the wrong thing to be using here,
since it describes the size of a type in isolation, but this is conceptually an
embedded type that doesn't include any padding. Since we're only dealing with
scalars and vectors here, just use their width.
This commit is contained in:
Elizabeth Figura
2025-11-21 16:53:14 -06:00
committed by Henri Verbeet
parent 8a0e578f64
commit 73c8529e6e
Notes: Henri Verbeet 2025-11-25 20:41:38 +01:00
Approved-by: Francisco Casas (@fcasas)
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1843

View File

@@ -6439,8 +6439,9 @@ static void register_deref_usage(struct hlsl_ctx *ctx, const struct hlsl_deref *
else if (regset == HLSL_REGSET_NUMERIC) else if (regset == HLSL_REGSET_NUMERIC)
{ {
type = hlsl_deref_get_type(ctx, deref); type = hlsl_deref_get_type(ctx, deref);
VKD3D_ASSERT(type->class <= HLSL_CLASS_VECTOR);
required_bind_count = align(index + type->reg_size[regset], 4) / 4; required_bind_count = align(index + type->e.numeric.dimx, 4) / 4;
var->bind_count[regset] = max(var->bind_count[regset], required_bind_count); var->bind_count[regset] = max(var->bind_count[regset], required_bind_count);
} }
else else