xref: /aosp_15_r20/external/skia/tests/sksl/shared/UnaryPositiveNegative.hlsl (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1cbuffer _UniformBuffer : register(b0, space0)
2{
3    float4 _16_colorWhite : packoffset(c0);
4    float4 _16_colorGreen : packoffset(c1);
5    float4 _16_colorRed : packoffset(c2);
6    row_major float2x2 _16_testMatrix2x2 : packoffset(c3);
7    row_major float3x3 _16_testMatrix3x3 : packoffset(c5);
8    row_major float4x4 _16_testMatrix4x4 : packoffset(c8);
9};
10
11
12static float4 sk_FragColor;
13
14struct SPIRV_Cross_Output
15{
16    float4 sk_FragColor : SV_Target0;
17};
18
19bool test_iscalar_b()
20{
21    int _44 = int(_16_colorWhite.x);
22    int x = _44;
23    int _45 = -_44;
24    x = _45;
25    return _45 == (-1);
26}
27
28bool test_fvec_b()
29{
30    float2 x = _16_colorWhite.xy;
31    float2 _53 = -_16_colorWhite.xy;
32    x = _53;
33    return all(bool2(_53.x == (-1.0f).xx.x, _53.y == (-1.0f).xx.y));
34}
35
36bool test_ivec_b()
37{
38    int2 _67 = int(_16_colorWhite.x).xx;
39    int2 x = _67;
40    int2 _68 = -_67;
41    x = _68;
42    return all(bool2(_68.x == int2(-1, -1).x, _68.y == int2(-1, -1).y));
43}
44
45bool test_mat2_b()
46{
47    float2x2 negated = float2x2(float2(-1.0f, -2.0f), float2(-3.0f, -4.0f));
48    float2x2 x = _16_testMatrix2x2;
49    float2 _87 = -_16_testMatrix2x2[0];
50    float2 _89 = -_16_testMatrix2x2[1];
51    x = float2x2(_87, _89);
52    return all(bool2(_87.x == float2(-1.0f, -2.0f).x, _87.y == float2(-1.0f, -2.0f).y)) && all(bool2(_89.x == float2(-3.0f, -4.0f).x, _89.y == float2(-3.0f, -4.0f).y));
53}
54
55bool test_mat3_b()
56{
57    float3x3 negated = float3x3(float3(-1.0f, -2.0f, -3.0f), float3(-4.0f, -5.0f, -6.0f), float3(-7.0f, -8.0f, -9.0f));
58    float3x3 x = _16_testMatrix3x3;
59    float3 _114 = -_16_testMatrix3x3[0];
60    float3 _116 = -_16_testMatrix3x3[1];
61    float3 _118 = -_16_testMatrix3x3[2];
62    x = float3x3(_114, _116, _118);
63    return (all(bool3(_114.x == float3(-1.0f, -2.0f, -3.0f).x, _114.y == float3(-1.0f, -2.0f, -3.0f).y, _114.z == float3(-1.0f, -2.0f, -3.0f).z)) && all(bool3(_116.x == float3(-4.0f, -5.0f, -6.0f).x, _116.y == float3(-4.0f, -5.0f, -6.0f).y, _116.z == float3(-4.0f, -5.0f, -6.0f).z))) && all(bool3(_118.x == float3(-7.0f, -8.0f, -9.0f).x, _118.y == float3(-7.0f, -8.0f, -9.0f).y, _118.z == float3(-7.0f, -8.0f, -9.0f).z));
64}
65
66bool test_mat4_b()
67{
68    float4x4 negated = float4x4(float4(-1.0f, -2.0f, -3.0f, -4.0f), float4(-5.0f, -6.0f, -7.0f, -8.0f), float4(-9.0f, -10.0f, -11.0f, -12.0f), float4(-13.0f, -14.0f, -15.0f, -16.0f));
69    float4x4 x = _16_testMatrix4x4;
70    float4 _150 = -_16_testMatrix4x4[0];
71    float4 _152 = -_16_testMatrix4x4[1];
72    float4 _154 = -_16_testMatrix4x4[2];
73    float4 _156 = -_16_testMatrix4x4[3];
74    x = float4x4(_150, _152, _154, _156);
75    return ((all(bool4(_150.x == float4(-1.0f, -2.0f, -3.0f, -4.0f).x, _150.y == float4(-1.0f, -2.0f, -3.0f, -4.0f).y, _150.z == float4(-1.0f, -2.0f, -3.0f, -4.0f).z, _150.w == float4(-1.0f, -2.0f, -3.0f, -4.0f).w)) && all(bool4(_152.x == float4(-5.0f, -6.0f, -7.0f, -8.0f).x, _152.y == float4(-5.0f, -6.0f, -7.0f, -8.0f).y, _152.z == float4(-5.0f, -6.0f, -7.0f, -8.0f).z, _152.w == float4(-5.0f, -6.0f, -7.0f, -8.0f).w))) && all(bool4(_154.x == float4(-9.0f, -10.0f, -11.0f, -12.0f).x, _154.y == float4(-9.0f, -10.0f, -11.0f, -12.0f).y, _154.z == float4(-9.0f, -10.0f, -11.0f, -12.0f).z, _154.w == float4(-9.0f, -10.0f, -11.0f, -12.0f).w))) && all(bool4(_156.x == float4(-13.0f, -14.0f, -15.0f, -16.0f).x, _156.y == float4(-13.0f, -14.0f, -15.0f, -16.0f).y, _156.z == float4(-13.0f, -14.0f, -15.0f, -16.0f).z, _156.w == float4(-13.0f, -14.0f, -15.0f, -16.0f).w));
76}
77
78bool test_hmat2_b()
79{
80    float2x2 negated = float2x2(float2(-1.0f, -2.0f), float2(-3.0f, -4.0f));
81    float2x2 x = _16_testMatrix2x2;
82    float2 _176 = -_16_testMatrix2x2[0];
83    float2 _178 = -_16_testMatrix2x2[1];
84    x = float2x2(_176, _178);
85    return all(bool2(_176.x == float2(-1.0f, -2.0f).x, _176.y == float2(-1.0f, -2.0f).y)) && all(bool2(_178.x == float2(-3.0f, -4.0f).x, _178.y == float2(-3.0f, -4.0f).y));
86}
87
88bool test_hmat3_b()
89{
90    float3x3 negated = float3x3(float3(-1.0f, -2.0f, -3.0f), float3(-4.0f, -5.0f, -6.0f), float3(-7.0f, -8.0f, -9.0f));
91    float3x3 x = _16_testMatrix3x3;
92    float3 _191 = -_16_testMatrix3x3[0];
93    float3 _193 = -_16_testMatrix3x3[1];
94    float3 _195 = -_16_testMatrix3x3[2];
95    x = float3x3(_191, _193, _195);
96    return (all(bool3(_191.x == float3(-1.0f, -2.0f, -3.0f).x, _191.y == float3(-1.0f, -2.0f, -3.0f).y, _191.z == float3(-1.0f, -2.0f, -3.0f).z)) && all(bool3(_193.x == float3(-4.0f, -5.0f, -6.0f).x, _193.y == float3(-4.0f, -5.0f, -6.0f).y, _193.z == float3(-4.0f, -5.0f, -6.0f).z))) && all(bool3(_195.x == float3(-7.0f, -8.0f, -9.0f).x, _195.y == float3(-7.0f, -8.0f, -9.0f).y, _195.z == float3(-7.0f, -8.0f, -9.0f).z));
97}
98
99bool test_hmat4_b()
100{
101    float4x4 negated = float4x4(float4(-1.0f, -2.0f, -3.0f, -4.0f), float4(-5.0f, -6.0f, -7.0f, -8.0f), float4(-9.0f, -10.0f, -11.0f, -12.0f), float4(-13.0f, -14.0f, -15.0f, -16.0f));
102    float4x4 x = _16_testMatrix4x4;
103    float4 _211 = -_16_testMatrix4x4[0];
104    float4 _213 = -_16_testMatrix4x4[1];
105    float4 _215 = -_16_testMatrix4x4[2];
106    float4 _217 = -_16_testMatrix4x4[3];
107    x = float4x4(_211, _213, _215, _217);
108    return ((all(bool4(_211.x == float4(-1.0f, -2.0f, -3.0f, -4.0f).x, _211.y == float4(-1.0f, -2.0f, -3.0f, -4.0f).y, _211.z == float4(-1.0f, -2.0f, -3.0f, -4.0f).z, _211.w == float4(-1.0f, -2.0f, -3.0f, -4.0f).w)) && all(bool4(_213.x == float4(-5.0f, -6.0f, -7.0f, -8.0f).x, _213.y == float4(-5.0f, -6.0f, -7.0f, -8.0f).y, _213.z == float4(-5.0f, -6.0f, -7.0f, -8.0f).z, _213.w == float4(-5.0f, -6.0f, -7.0f, -8.0f).w))) && all(bool4(_215.x == float4(-9.0f, -10.0f, -11.0f, -12.0f).x, _215.y == float4(-9.0f, -10.0f, -11.0f, -12.0f).y, _215.z == float4(-9.0f, -10.0f, -11.0f, -12.0f).z, _215.w == float4(-9.0f, -10.0f, -11.0f, -12.0f).w))) && all(bool4(_217.x == float4(-13.0f, -14.0f, -15.0f, -16.0f).x, _217.y == float4(-13.0f, -14.0f, -15.0f, -16.0f).y, _217.z == float4(-13.0f, -14.0f, -15.0f, -16.0f).z, _217.w == float4(-13.0f, -14.0f, -15.0f, -16.0f).w));
109}
110
111float4 main(float2 _231)
112{
113    float _RESERVED_IDENTIFIER_FIXUP_0_x = _16_colorWhite.x;
114    float _238 = -_16_colorWhite.x;
115    _RESERVED_IDENTIFIER_FIXUP_0_x = _238;
116    bool _244 = false;
117    if (_238 == (-1.0f))
118    {
119        _244 = test_iscalar_b();
120    }
121    else
122    {
123        _244 = false;
124    }
125    bool _248 = false;
126    if (_244)
127    {
128        _248 = test_fvec_b();
129    }
130    else
131    {
132        _248 = false;
133    }
134    bool _252 = false;
135    if (_248)
136    {
137        _252 = test_ivec_b();
138    }
139    else
140    {
141        _252 = false;
142    }
143    bool _256 = false;
144    if (_252)
145    {
146        _256 = test_mat2_b();
147    }
148    else
149    {
150        _256 = false;
151    }
152    bool _260 = false;
153    if (_256)
154    {
155        _260 = test_mat3_b();
156    }
157    else
158    {
159        _260 = false;
160    }
161    bool _264 = false;
162    if (_260)
163    {
164        _264 = test_mat4_b();
165    }
166    else
167    {
168        _264 = false;
169    }
170    bool _268 = false;
171    if (_264)
172    {
173        _268 = test_hmat2_b();
174    }
175    else
176    {
177        _268 = false;
178    }
179    bool _272 = false;
180    if (_268)
181    {
182        _272 = test_hmat3_b();
183    }
184    else
185    {
186        _272 = false;
187    }
188    bool _276 = false;
189    if (_272)
190    {
191        _276 = test_hmat4_b();
192    }
193    else
194    {
195        _276 = false;
196    }
197    float4 _277 = 0.0f.xxxx;
198    if (_276)
199    {
200        _277 = _16_colorGreen;
201    }
202    else
203    {
204        _277 = _16_colorRed;
205    }
206    return _277;
207}
208
209void frag_main()
210{
211    float2 _30 = 0.0f.xx;
212    sk_FragColor = main(_30);
213}
214
215SPIRV_Cross_Output main()
216{
217    frag_main();
218    SPIRV_Cross_Output stage_output;
219    stage_output.sk_FragColor = sk_FragColor;
220    return stage_output;
221}
222