xref: /aosp_15_r20/external/skia/resources/sksl/shared/ConstantCompositeAccessViaDynamicIndex.sksl (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1int zero = 0;
2
3// Although all of these variables have compile-time constant values, we expect them to be NOT
4// constant-folded as they are accessed by an index with a value determine at runtime.
5const half[2] globalArray = half[2](1, 1);
6const half2 globalVector = half2(1, 1);
7const half2x2 globalMatrix = half2x2(1, 1, 1, 1);
8
9half4 main(float2) {
10    const half[2] localArray = half[2](0, 1);
11    const half2 localVector = half2(1, 1);
12    const half2x2 localMatrix = half2x2(0, 1, 2, 3);
13
14    return half4(globalArray[zero] * localArray[zero],
15                 globalVector[zero] * localVector[zero],
16                 globalMatrix[zero] * localMatrix[zero]);
17}
18