xref: /aosp_15_r20/external/skia/tests/sksl/shared/TemporaryIndexLookup.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};
7*c8dee2aaSAndroid Build Coastguard Worker
8*c8dee2aaSAndroid Build Coastguard Worker
9*c8dee2aaSAndroid Build Coastguard Workerstatic float4 sk_FragColor;
10*c8dee2aaSAndroid Build Coastguard Worker
11*c8dee2aaSAndroid Build Coastguard Workerstruct SPIRV_Cross_Output
12*c8dee2aaSAndroid Build Coastguard Worker{
13*c8dee2aaSAndroid Build Coastguard Worker    float4 sk_FragColor : SV_Target0;
14*c8dee2aaSAndroid Build Coastguard Worker};
15*c8dee2aaSAndroid Build Coastguard Worker
16*c8dee2aaSAndroid Build Coastguard Workerfloat3x3 GetTestMatrix_f33()
17*c8dee2aaSAndroid Build Coastguard Worker{
18*c8dee2aaSAndroid Build Coastguard Worker    return _8_testMatrix3x3;
19*c8dee2aaSAndroid Build Coastguard Worker}
20*c8dee2aaSAndroid Build Coastguard Worker
21*c8dee2aaSAndroid Build Coastguard Workerfloat4 main(float2 _31)
22*c8dee2aaSAndroid Build Coastguard Worker{
23*c8dee2aaSAndroid Build Coastguard Worker    float expected = 0.0f;
24*c8dee2aaSAndroid Build Coastguard Worker    for (int i = 0; i < 3; i++)
25*c8dee2aaSAndroid Build Coastguard Worker    {
26*c8dee2aaSAndroid Build Coastguard Worker        for (int j = 0; j < 3; j++)
27*c8dee2aaSAndroid Build Coastguard Worker        {
28*c8dee2aaSAndroid Build Coastguard Worker            float _55 = expected;
29*c8dee2aaSAndroid Build Coastguard Worker            float _57 = _55 + 1.0f;
30*c8dee2aaSAndroid Build Coastguard Worker            expected = _57;
31*c8dee2aaSAndroid Build Coastguard Worker            float3x3 _58 = GetTestMatrix_f33();
32*c8dee2aaSAndroid Build Coastguard Worker            if (_58[i][j] != _57)
33*c8dee2aaSAndroid Build Coastguard Worker            {
34*c8dee2aaSAndroid Build Coastguard Worker                return _8_colorRed;
35*c8dee2aaSAndroid Build Coastguard Worker            }
36*c8dee2aaSAndroid Build Coastguard Worker        }
37*c8dee2aaSAndroid Build Coastguard Worker    }
38*c8dee2aaSAndroid Build Coastguard Worker    return _8_colorGreen;
39*c8dee2aaSAndroid Build Coastguard Worker}
40*c8dee2aaSAndroid Build Coastguard Worker
41*c8dee2aaSAndroid Build Coastguard Workervoid frag_main()
42*c8dee2aaSAndroid Build Coastguard Worker{
43*c8dee2aaSAndroid Build Coastguard Worker    float2 _20 = 0.0f.xx;
44*c8dee2aaSAndroid Build Coastguard Worker    sk_FragColor = main(_20);
45*c8dee2aaSAndroid Build Coastguard Worker}
46*c8dee2aaSAndroid Build Coastguard Worker
47*c8dee2aaSAndroid Build Coastguard WorkerSPIRV_Cross_Output main()
48*c8dee2aaSAndroid Build Coastguard Worker{
49*c8dee2aaSAndroid Build Coastguard Worker    frag_main();
50*c8dee2aaSAndroid Build Coastguard Worker    SPIRV_Cross_Output stage_output;
51*c8dee2aaSAndroid Build Coastguard Worker    stage_output.sk_FragColor = sk_FragColor;
52*c8dee2aaSAndroid Build Coastguard Worker    return stage_output;
53*c8dee2aaSAndroid Build Coastguard Worker}
54