xref: /aosp_15_r20/external/skia/resources/sksl/compute/ModuleStructInExpression.compute (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1*c8dee2aaSAndroid Build Coastguard Workerlayout(local_size_x = 16, local_size_y = 16) in;
2*c8dee2aaSAndroid Build Coastguard Worker
3*c8dee2aaSAndroid Build Coastguard Workerworkgroup int outX, outY, outZ;
4*c8dee2aaSAndroid Build Coastguard Worker
5*c8dee2aaSAndroid Build Coastguard Workerint one()   { return 1; }
6*c8dee2aaSAndroid Build Coastguard Workerint two()   { return 2; }
7*c8dee2aaSAndroid Build Coastguard Workerint three() { return 3; }
8*c8dee2aaSAndroid Build Coastguard Worker
9*c8dee2aaSAndroid Build Coastguard Workervoid main() {
10*c8dee2aaSAndroid Build Coastguard Worker    // This test is somewhat contrived, but it is possible to use a struct from the modules as part
11*c8dee2aaSAndroid Build Coastguard Worker    // of an expression, without ever declaring a variable of that type. We need to detect this
12*c8dee2aaSAndroid Build Coastguard Worker    // usage, and emit the struct type into the finished program.
13*c8dee2aaSAndroid Build Coastguard Worker    outX = IndirectDispatchArgs(one(), two(), three()).x;
14*c8dee2aaSAndroid Build Coastguard Worker    outY = IndirectDispatchArgs(one(), two(), three()).y;
15*c8dee2aaSAndroid Build Coastguard Worker    outZ = IndirectDispatchArgs(one(), two(), three()).z;
16*c8dee2aaSAndroid Build Coastguard Worker}
17