vkd3d-shader/hlsl: Delay lowering complex casts until after parse time.

While so far it has been posible to do this at parse time, this must
happen after knowing if the complex cast is on the lhs or not.

The modified tests show that before this patch we are currently
miscompiling when this happens, because a complex lhs cast is transformed
into a load, and add_assigment() just stores to the generated "cast"
temp.
This commit is contained in:
Francisco Casas
2025-01-16 17:08:24 -03:00
committed by Henri Verbeet
parent dc37d90190
commit c2e224c5fb
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
5 changed files with 111 additions and 93 deletions

View File

@@ -32,7 +32,7 @@ todo(sm<6) draw quad
probe (0, 0) rgba(1, -2, -3, -4)
[pixel shader]
[pixel shader todo]
float4 main() : sv_target
{
float p[5] = {-1, -2, -3, -4, -5};
@@ -43,8 +43,8 @@ float4 main() : sv_target
}
[test]
draw quad
todo(sm<6) probe (0, 0) rgba(1, 2, -3, -5)
todo(sm<6) draw quad
probe (0, 0) rgba(1, 2, -3, -5)
[pixel shader]
@@ -75,7 +75,7 @@ float4 main() : sv_target
% Matrix partial assignment.
[pixel shader fail(sm>=6)]
[pixel shader fail(sm>=6) todo]
float3x4 a;
float4 main() : sv_target
@@ -91,12 +91,12 @@ uniform 0 float4 1 5 9 0
uniform 4 float4 2 6 10 0
uniform 8 float4 3 7 11 0
uniform 12 float4 4 8 12 0
draw quad
todo probe (0, 0) rgba(1050000, 2060000, 3070000, 0)
todo draw quad
probe (0, 0) rgba(1050000, 2060000, 3070000, 0)
% Multiple cast partial assigment.
[pixel shader fail(sm>=6)]
[pixel shader fail(sm>=6) todo]
float4 main() : sv_target
{
float4x4 g = 0;
@@ -106,8 +106,8 @@ float4 main() : sv_target
}
[test]
draw quad
todo probe (0, 0) rgba(1, 2, 5, 6)
todo draw quad
probe (0, 0) rgba(1, 2, 5, 6)
[pixel shader fail(sm>=4) todo]
@@ -134,7 +134,7 @@ float4 main() : sv_target
}
[pixel shader]
[pixel shader todo]
float4 main() : sv_target
{
float p[4][3] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};
@@ -145,8 +145,8 @@ float4 main() : sv_target
}
[test]
draw quad
todo(sm<6) probe (0, 0) rgba(10, 5, 40, 9)
todo(sm<6) draw quad
probe (0, 0) rgba(10, 5, 40, 9)
% For some reason this acts as .z swizzle on the rhs.