xref: /aosp_15_r20/external/skia/tests/sksl/shared/MatrixIndexStore.hlsl (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1cbuffer _UniformBuffer : register(b0, space0)
2{
3    float4 _9_colorGreen : packoffset(c0);
4    float4 _9_colorRed : packoffset(c1);
5    row_major float3x3 _9_testMatrix3x3 : packoffset(c2);
6    row_major float4x4 _9_testMatrix4x4 : packoffset(c5);
7};
8
9
10static float4 sk_FragColor;
11
12struct SPIRV_Cross_Output
13{
14    float4 sk_FragColor : SV_Target0;
15};
16
17bool test3x3_b()
18{
19    float3 values = float3(1.0f, 2.0f, 3.0f);
20    float3x3 _matrix = float3x3(0.0f.xxx, 0.0f.xxx, 0.0f.xxx);
21    for (int index = 0; index < 3; index++)
22    {
23        _matrix[index] = values;
24        values += 3.0f.xxx;
25    }
26    return (all(bool3(_matrix[0].x == _9_testMatrix3x3[0].x, _matrix[0].y == _9_testMatrix3x3[0].y, _matrix[0].z == _9_testMatrix3x3[0].z)) && all(bool3(_matrix[1].x == _9_testMatrix3x3[1].x, _matrix[1].y == _9_testMatrix3x3[1].y, _matrix[1].z == _9_testMatrix3x3[1].z))) && all(bool3(_matrix[2].x == _9_testMatrix3x3[2].x, _matrix[2].y == _9_testMatrix3x3[2].y, _matrix[2].z == _9_testMatrix3x3[2].z));
27}
28
29bool test4x4_b()
30{
31    float4 values = float4(1.0f, 2.0f, 3.0f, 4.0f);
32    float4x4 _matrix = float4x4(0.0f.xxxx, 0.0f.xxxx, 0.0f.xxxx, 0.0f.xxxx);
33    for (int index = 0; index < 4; index++)
34    {
35        _matrix[index] = values;
36        values += 4.0f.xxxx;
37    }
38    return ((all(bool4(_matrix[0].x == _9_testMatrix4x4[0].x, _matrix[0].y == _9_testMatrix4x4[0].y, _matrix[0].z == _9_testMatrix4x4[0].z, _matrix[0].w == _9_testMatrix4x4[0].w)) && all(bool4(_matrix[1].x == _9_testMatrix4x4[1].x, _matrix[1].y == _9_testMatrix4x4[1].y, _matrix[1].z == _9_testMatrix4x4[1].z, _matrix[1].w == _9_testMatrix4x4[1].w))) && all(bool4(_matrix[2].x == _9_testMatrix4x4[2].x, _matrix[2].y == _9_testMatrix4x4[2].y, _matrix[2].z == _9_testMatrix4x4[2].z, _matrix[2].w == _9_testMatrix4x4[2].w))) && all(bool4(_matrix[3].x == _9_testMatrix4x4[3].x, _matrix[3].y == _9_testMatrix4x4[3].y, _matrix[3].z == _9_testMatrix4x4[3].z, _matrix[3].w == _9_testMatrix4x4[3].w));
39}
40
41float4 main(float2 _126)
42{
43    bool _133 = false;
44    if (test3x3_b())
45    {
46        _133 = test4x4_b();
47    }
48    else
49    {
50        _133 = false;
51    }
52    float4 _134 = 0.0f.xxxx;
53    if (_133)
54    {
55        _134 = _9_colorGreen;
56    }
57    else
58    {
59        _134 = _9_colorRed;
60    }
61    return _134;
62}
63
64void frag_main()
65{
66    float2 _22 = 0.0f.xx;
67    sk_FragColor = main(_22);
68}
69
70SPIRV_Cross_Output main()
71{
72    frag_main();
73    SPIRV_Cross_Output stage_output;
74    stage_output.sk_FragColor = sk_FragColor;
75    return stage_output;
76}
77