vkd3d-shader/hlsl: Use a block in hlsl_normalize_binary_exprs().
[vkd3d.git] / tests / hlsl / lhs-cast.shader_test
blob7ced985d58e12af793cfb3c65039684f8e2ab87e
1 % lhs casts to the same type don't have effect.
2 [pixel shader]
3 float4 main() : sv_target
5     float4 p = 0;
7     (float4) p = float4(1, 2, 3, 4);
8     return p;
11 [test]
12 draw quad
13 probe (0, 0) rgba(1, 2, 3, 4)
16 % Casts with base type changes are only valid on SM1.
17 [pixel shader fail(sm>=4)]
18 float4 main() : sv_target
20     float4 p = 0;
22     (int4) p = float4(-1.5, -2.3, 4.7, 0.4);
23     return p;
26 [test]
27 draw quad
28 probe (0, 0) rgba(-1, -2, 4, 0)
31 % Casts don't actually perform base type changes, only the outtermost one, which
32 % I suspect is because the implicit cast on the assignment and not the cast itself.
33 [pixel shader fail(sm>=4)]
34 float4 main() : sv_target
36     float4 f = 0;
38     (float2x2)(int4)(half4) f = float4(1.3, -2.4, 3.3, 4.7);
39     return f;
42 [test]
43 draw quad
44 probe (0, 0) rgba(1.3, -2.4, 3.3, 4.7)
47 [pixel shader fail(sm>=4)]
48 float4 main() : sv_target
50     float4 f = 0;
52     (int4)(float4)(half4) f = float4(1.3, -2.4, 3.3, 4.7);
53     return f;
56 [test]
57 draw quad
58 probe (0, 0) rgba(1, -2, 3, 4)
61 [pixel shader fail]
62 float4 main() : sv_target
64     float p[5] = {-1, -2, -3, -4, -5};
65     float arr[5] = {1.5, 2.5, 3.5, 4.5, 5.5};
67     (int[5]) p = arr;
68     return 0;
72 [pixel shader fail(sm>=6) todo(sm>=4)]
73 float4 main() : sv_target
75     float4 f = 0;
77     (float2x2) f = float3x2(1, 2, 3, 4, 5, 6);
78     return f;
81 [test]
82 todo(sm>=4) draw quad
83 probe (0, 0) rgba(1, 2, 3, 4)
86 [pixel shader fail(sm>=4)]
87 float4 main() : sv_target
89     float4 f = 0;
91     ((int4) f).xy = float2(1.4, 3.8);
92     return f;
95 [test]
96 draw quad
97 probe (0, 0) rgba(1, 3, 0, 0);
100 [pixel shader fail(sm>=4)]
101 float4 main() : sv_target
103     float4 f = 0;
105     ((float3)((int4) f).xyz).xy = float2(1.4, 2.8);
106     return f;
109 [test]
110 draw quad
111 probe (0, 0) rgba(1.4, 2.8, 0, 0);