vkd3d/tests/hlsl/lhs-cast.shader_test
Francisco Casas c2e224c5fb 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.
2025-01-22 14:34:19 +01:00

112 lines
1.8 KiB
Plaintext

% lhs casts to the same type don't have effect.
[pixel shader]
float4 main() : sv_target
{
float4 p = 0;
(float4) p = float4(1, 2, 3, 4);
return p;
}
[test]
draw quad
probe (0, 0) rgba(1, 2, 3, 4)
% Casts with base type changes are only valid on SM1.
[pixel shader fail(sm>=4) todo]
float4 main() : sv_target
{
float4 p = 0;
(int4) p = float4(-1.5, -2.3, 4.7, 0.4);
return p;
}
[test]
todo draw quad
probe (0, 0) rgba(-1, -2, 4, 0)
% Casts don't actually perform base type changes, only the outtermost one, which
% I suspect is because the implicit cast on the assignment and not the cast itself.
[pixel shader fail(sm>=4) todo]
float4 main() : sv_target
{
float4 f = 0;
(float2x2)(int4)(half4) f = float4(1.3, -2.4, 3.3, 4.7);
return f;
}
[test]
todo draw quad
probe (0, 0) rgba(1.3, -2.4, 3.3, 4.7)
[pixel shader fail(sm>=4) todo]
float4 main() : sv_target
{
float4 f = 0;
(int4)(float4)(half4) f = float4(1.3, -2.4, 3.3, 4.7);
return f;
}
[test]
todo draw quad
probe (0, 0) rgba(1, -2, 3, 4)
[pixel shader fail]
float4 main() : sv_target
{
float p[5] = {-1, -2, -3, -4, -5};
float arr[5] = {1.5, 2.5, 3.5, 4.5, 5.5};
(int[5]) p = arr;
return 0;
}
[pixel shader fail(sm>=6) todo]
float4 main() : sv_target
{
float4 f = 0;
(float2x2) f = float3x2(1, 2, 3, 4, 5, 6);
return f;
}
[test]
todo draw quad
probe (0, 0) rgba(1, 2, 3, 4)
[pixel shader fail(sm>=4) todo]
float4 main() : sv_target
{
float4 f = 0;
((int4) f).xy = float2(1.4, 3.8);
return f;
}
[test]
todo draw quad
probe (0, 0) rgba(1, 3, 0, 0);
[pixel shader fail(sm>=4) todo]
float4 main() : sv_target
{
float4 f = 0;
((float3)((int4) f).xyz).xy = float2(1.4, 2.8);
return f;
}
[test]
todo draw quad
probe (0, 0) rgba(1.4, 2.8, 0, 0);