vkd3d-shader/hlsl: Support non-size-changing lhs casts.

This commit is contained in:
Francisco Casas
2025-01-20 14:52:22 -03:00
committed by Henri Verbeet
parent c2e224c5fb
commit b55fe1950e
Notes: Henri Verbeet 2025-01-22 15:04:09 +01:00
Approved-by: Elizabeth Figura (@zfigura)
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1350
4 changed files with 57 additions and 32 deletions

View File

@ -1,6 +1,6 @@
% Test implicit and explicit casts on function output parameters.
[pixel shader todo]
[pixel shader todo(sm>=4)]
uniform float4 f;
@ -18,14 +18,14 @@ float4 main() : sv_target
[test]
uniform 0 float4 -1.9 -1.0 2.9 4.0
todo(sm<6) draw quad
todo(sm>=4 & sm<6) draw quad
probe (0, 0) rgba (-1.0, -1.0, 2.0, 4.0)
% As above, but cast "x" to float4 first.
% In SM 6 a cast seems to implicitly promote the type to const,
% so it fails to match the parameter of func().
[pixel shader todo fail(sm>=6)]
[pixel shader fail(sm>=6) todo(sm>=4)]
uniform float4 f;
@ -43,12 +43,12 @@ float4 main() : sv_target
[test]
uniform 0 float4 -1.9 -1.0 2.9 4.0
todo draw quad
todo(sm>=4) draw quad
probe (0, 0) rgba (-1.0, -1.0, 2.0, 4.0)
% As above, but declare "x" as float4 and cast it to int4.
[pixel shader todo fail(sm>=6)]
[pixel shader fail(sm>=6) todo(sm>=4)]
uniform float4 f;
@ -66,11 +66,11 @@ float4 main() : sv_target
[test]
uniform 0 float4 -1.9 -1.0 2.9 4.0
todo draw quad
probe (0, 0) rgba (-1.0, -1.0, 2.0, 4.0)
todo(sm>=4) draw quad
todo(sm<4) probe (0, 0) rgba (-1.0, -1.0, 2.0, 4.0)
[pixel shader todo]
[pixel shader todo(sm>=4)]
uniform int4 i;
void func(inout float4 a)
@ -88,12 +88,12 @@ float4 main() : sv_target
[test]
if(sm<4) uniform 0 float4 -2 0 1 -3000000
if(sm>=4) uniform 0 int4 -2 0 1 -3000000
todo(sm<6) draw quad
todo(sm>=4 & sm<6) draw quad
probe (0, 0) rgba (-1.0, 0.0, 1.0, -3000000.0) 4
% An explicit cast gets applied right before assignment, as if it was on the lhs.
[pixel shader todo fail(sm>=6)]
[pixel shader fail(sm>=6) todo(sm>=4)]
void fun(out float4 f)
{
f = float4(1.4, 2.6, 3.9, 4.3);
@ -108,8 +108,8 @@ float4 main() : sv_target
}
[test]
todo draw quad
probe (0, 0) rgba(1, 2, 3, 4)
todo(sm>=4) draw quad
todo probe (0, 0) rgba(1, 2, 3, 4)
[pixel shader todo fail]
@ -176,7 +176,7 @@ float4 main() : sv_target
}
[pixel shader fail(sm>=4) todo]
[pixel shader fail(sm>=4)]
void fun(out float4 f)
{
f = float4(1.1, 2.3, 3.6, 4.3);
@ -191,5 +191,5 @@ float4 main() : sv_target
}
[test]
todo draw quad
draw quad
probe (0, 0) rgba(1.1, 2.3, 3.6, 4.3)