vkd3d-shader/hlsl: Fix numeric offset of object fields.

This commit is contained in:
Francisco Casas 2023-04-11 12:01:02 -04:00 committed by Alexandre Julliard
parent 86893bc7f4
commit 0ceecd1225
Notes: Alexandre Julliard 2023-04-13 23:20:28 +02:00
Approved-by: Zebediah Figura (@zfigura)
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/154
2 changed files with 3 additions and 2 deletions

View File

@ -216,7 +216,8 @@ unsigned int hlsl_type_get_sm4_offset(const struct hlsl_type *type, unsigned int
* (b) the type would cross a vec4 boundary; i.e. a vec3 and a
* vec1 can be packed together, but not a vec3 and a vec2.
*/
if (type->class > HLSL_CLASS_LAST_NUMERIC || (offset & 3) + type->reg_size[HLSL_REGSET_NUMERIC] > 4)
if (type->class == HLSL_CLASS_STRUCT || type->class == HLSL_CLASS_ARRAY
|| (offset & 3) + type->reg_size[HLSL_REGSET_NUMERIC] > 4)
return align(offset, 4);
return offset;
}

View File

@ -20,7 +20,7 @@ float4 main() : sv_target
uniform 0 float4 1.0 2.0 3.0 4.0
uniform 4 float4 5.0 6.0 7.0 8.0
draw quad
todo probe all rgba (1.0, 2.0, 3.0, 0.0)
probe all rgba (1.0, 2.0, 3.0, 0.0)
[pixel shader]