vkd3d-shader: Avoid left shifting signed integers. (ubsan)

Otherwise ubsan reports these errors on the bitwise.shader_test:

    libs/vkd3d-shader/hlsl_constant_ops.c:970:50: runtime error: left shift of 1 by 31 places cannot be represented in type 'int'
    libs/vkd3d-shader/hlsl_constant_ops.c:970:50: runtime error: left shift of negative value -12
This commit is contained in:
Francisco Casas
2024-12-18 17:25:31 -03:00
committed by Henri Verbeet
parent 8056058aa1
commit 9b3b47b1b8
Notes: Henri Verbeet 2025-01-10 20:15:12 +01:00
Approved-by: Elizabeth Figura (@zfigura)
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1327
2 changed files with 12 additions and 3 deletions

View File

@@ -129,6 +129,18 @@ float4 main() : SV_TARGET
draw quad
probe (0, 0) rgba (0.0, 0.0, 163840.0, 480.0)
[pixel shader]
float4 main() : SV_TARGET
{
int i = 7;
return float4(i << 32, i << 30, i << 28, i << 26);
}
[test]
draw quad
probe (0, 0) rgba(7, -1073741824, 1879048192, 469762048)
[pixel shader fail]
% Make sure that bitshifts DON'T work with floats
float4 main() : SV_TARGET