xref: /aosp_15_r20/external/skia/tests/sksl/shared/MatrixSwizzleStore.hlsl (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1*c8dee2aaSAndroid Build Coastguard Workercbuffer _UniformBuffer : register(b0, space0)
2*c8dee2aaSAndroid Build Coastguard Worker{
3*c8dee2aaSAndroid Build Coastguard Worker    float4 _8_colorGreen : packoffset(c0);
4*c8dee2aaSAndroid Build Coastguard Worker    float4 _8_colorRed : packoffset(c1);
5*c8dee2aaSAndroid Build Coastguard Worker    row_major float3x3 _8_testMatrix3x3 : packoffset(c2);
6*c8dee2aaSAndroid Build Coastguard Worker    row_major float4x4 _8_testMatrix4x4 : packoffset(c5);
7*c8dee2aaSAndroid Build Coastguard Worker};
8*c8dee2aaSAndroid Build Coastguard Worker
9*c8dee2aaSAndroid Build Coastguard Worker
10*c8dee2aaSAndroid Build Coastguard Workerstatic float4 sk_FragColor;
11*c8dee2aaSAndroid Build Coastguard Worker
12*c8dee2aaSAndroid Build Coastguard Workerstruct SPIRV_Cross_Output
13*c8dee2aaSAndroid Build Coastguard Worker{
14*c8dee2aaSAndroid Build Coastguard Worker    float4 sk_FragColor : SV_Target0;
15*c8dee2aaSAndroid Build Coastguard Worker};
16*c8dee2aaSAndroid Build Coastguard Worker
17*c8dee2aaSAndroid Build Coastguard Workerbool test4x4_b()
18*c8dee2aaSAndroid Build Coastguard Worker{
19*c8dee2aaSAndroid Build Coastguard Worker    float4 values = float4(4.0f, 3.0f, 2.0f, 1.0f);
20*c8dee2aaSAndroid Build Coastguard Worker    float4x4 _matrix = float4x4(0.0f.xxxx, 0.0f.xxxx, 0.0f.xxxx, 0.0f.xxxx);
21*c8dee2aaSAndroid Build Coastguard Worker    for (int index = 0; index < 4; index++)
22*c8dee2aaSAndroid Build Coastguard Worker    {
23*c8dee2aaSAndroid Build Coastguard Worker        _matrix[index] = float4(values.xw.y, _matrix[index].y, _matrix[index].z, values.xw.x);
24*c8dee2aaSAndroid Build Coastguard Worker        _matrix[index] = float4(_matrix[index].x, values.yz.y, values.yz.x, _matrix[index].w);
25*c8dee2aaSAndroid Build Coastguard Worker        values += 4.0f.xxxx;
26*c8dee2aaSAndroid Build Coastguard Worker    }
27*c8dee2aaSAndroid Build Coastguard Worker    return ((all(bool4(_matrix[0].x == _8_testMatrix4x4[0].x, _matrix[0].y == _8_testMatrix4x4[0].y, _matrix[0].z == _8_testMatrix4x4[0].z, _matrix[0].w == _8_testMatrix4x4[0].w)) && all(bool4(_matrix[1].x == _8_testMatrix4x4[1].x, _matrix[1].y == _8_testMatrix4x4[1].y, _matrix[1].z == _8_testMatrix4x4[1].z, _matrix[1].w == _8_testMatrix4x4[1].w))) && all(bool4(_matrix[2].x == _8_testMatrix4x4[2].x, _matrix[2].y == _8_testMatrix4x4[2].y, _matrix[2].z == _8_testMatrix4x4[2].z, _matrix[2].w == _8_testMatrix4x4[2].w))) && all(bool4(_matrix[3].x == _8_testMatrix4x4[3].x, _matrix[3].y == _8_testMatrix4x4[3].y, _matrix[3].z == _8_testMatrix4x4[3].z, _matrix[3].w == _8_testMatrix4x4[3].w));
28*c8dee2aaSAndroid Build Coastguard Worker}
29*c8dee2aaSAndroid Build Coastguard Worker
30*c8dee2aaSAndroid Build Coastguard Workerfloat4 main(float2 _92)
31*c8dee2aaSAndroid Build Coastguard Worker{
32*c8dee2aaSAndroid Build Coastguard Worker    float3 _RESERVED_IDENTIFIER_FIXUP_1_values = float3(3.0f, 2.0f, 1.0f);
33*c8dee2aaSAndroid Build Coastguard Worker    float3x3 _RESERVED_IDENTIFIER_FIXUP_0_matrix = float3x3(0.0f.xxx, 0.0f.xxx, 0.0f.xxx);
34*c8dee2aaSAndroid Build Coastguard Worker    for (int _RESERVED_IDENTIFIER_FIXUP_2_index = 0; _RESERVED_IDENTIFIER_FIXUP_2_index < 3; _RESERVED_IDENTIFIER_FIXUP_2_index++)
35*c8dee2aaSAndroid Build Coastguard Worker    {
36*c8dee2aaSAndroid Build Coastguard Worker        _RESERVED_IDENTIFIER_FIXUP_0_matrix[_RESERVED_IDENTIFIER_FIXUP_2_index] = float3(_RESERVED_IDENTIFIER_FIXUP_1_values.xz.y, _RESERVED_IDENTIFIER_FIXUP_0_matrix[_RESERVED_IDENTIFIER_FIXUP_2_index].y, _RESERVED_IDENTIFIER_FIXUP_1_values.xz.x);
37*c8dee2aaSAndroid Build Coastguard Worker        _RESERVED_IDENTIFIER_FIXUP_0_matrix[_RESERVED_IDENTIFIER_FIXUP_2_index].y = _RESERVED_IDENTIFIER_FIXUP_1_values.y;
38*c8dee2aaSAndroid Build Coastguard Worker        _RESERVED_IDENTIFIER_FIXUP_1_values += 3.0f.xxx;
39*c8dee2aaSAndroid Build Coastguard Worker    }
40*c8dee2aaSAndroid Build Coastguard Worker    bool _148 = false;
41*c8dee2aaSAndroid Build Coastguard Worker    if ((all(bool3(_RESERVED_IDENTIFIER_FIXUP_0_matrix[0].x == _8_testMatrix3x3[0].x, _RESERVED_IDENTIFIER_FIXUP_0_matrix[0].y == _8_testMatrix3x3[0].y, _RESERVED_IDENTIFIER_FIXUP_0_matrix[0].z == _8_testMatrix3x3[0].z)) && all(bool3(_RESERVED_IDENTIFIER_FIXUP_0_matrix[1].x == _8_testMatrix3x3[1].x, _RESERVED_IDENTIFIER_FIXUP_0_matrix[1].y == _8_testMatrix3x3[1].y, _RESERVED_IDENTIFIER_FIXUP_0_matrix[1].z == _8_testMatrix3x3[1].z))) && all(bool3(_RESERVED_IDENTIFIER_FIXUP_0_matrix[2].x == _8_testMatrix3x3[2].x, _RESERVED_IDENTIFIER_FIXUP_0_matrix[2].y == _8_testMatrix3x3[2].y, _RESERVED_IDENTIFIER_FIXUP_0_matrix[2].z == _8_testMatrix3x3[2].z)))
42*c8dee2aaSAndroid Build Coastguard Worker    {
43*c8dee2aaSAndroid Build Coastguard Worker        _148 = test4x4_b();
44*c8dee2aaSAndroid Build Coastguard Worker    }
45*c8dee2aaSAndroid Build Coastguard Worker    else
46*c8dee2aaSAndroid Build Coastguard Worker    {
47*c8dee2aaSAndroid Build Coastguard Worker        _148 = false;
48*c8dee2aaSAndroid Build Coastguard Worker    }
49*c8dee2aaSAndroid Build Coastguard Worker    float4 _149 = 0.0f.xxxx;
50*c8dee2aaSAndroid Build Coastguard Worker    if (_148)
51*c8dee2aaSAndroid Build Coastguard Worker    {
52*c8dee2aaSAndroid Build Coastguard Worker        _149 = _8_colorGreen;
53*c8dee2aaSAndroid Build Coastguard Worker    }
54*c8dee2aaSAndroid Build Coastguard Worker    else
55*c8dee2aaSAndroid Build Coastguard Worker    {
56*c8dee2aaSAndroid Build Coastguard Worker        _149 = _8_colorRed;
57*c8dee2aaSAndroid Build Coastguard Worker    }
58*c8dee2aaSAndroid Build Coastguard Worker    return _149;
59*c8dee2aaSAndroid Build Coastguard Worker}
60*c8dee2aaSAndroid Build Coastguard Worker
61*c8dee2aaSAndroid Build Coastguard Workervoid frag_main()
62*c8dee2aaSAndroid Build Coastguard Worker{
63*c8dee2aaSAndroid Build Coastguard Worker    float2 _21 = 0.0f.xx;
64*c8dee2aaSAndroid Build Coastguard Worker    sk_FragColor = main(_21);
65*c8dee2aaSAndroid Build Coastguard Worker}
66*c8dee2aaSAndroid Build Coastguard Worker
67*c8dee2aaSAndroid Build Coastguard WorkerSPIRV_Cross_Output main()
68*c8dee2aaSAndroid Build Coastguard Worker{
69*c8dee2aaSAndroid Build Coastguard Worker    frag_main();
70*c8dee2aaSAndroid Build Coastguard Worker    SPIRV_Cross_Output stage_output;
71*c8dee2aaSAndroid Build Coastguard Worker    stage_output.sk_FragColor = sk_FragColor;
72*c8dee2aaSAndroid Build Coastguard Worker    return stage_output;
73*c8dee2aaSAndroid Build Coastguard Worker}
74