xref: /aosp_15_r20/external/skia/resources/sksl/spirv/SpecializedSamplerFunctions.sksl (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1layout(set = 0, binding = 0) sampler2D aSampler;
2layout(set = 0, binding = 1) sampler2D aSecondSampler;
3layout(set = 0, binding = 2) sampler2D aThirdSampler;
4
5noinline half4 baz(sampler2D s) {
6    return sample(s, float2(0));
7}
8
9noinline half4 bar(sampler2D s) {
10    return baz(s);
11}
12
13noinline half4 foo(sampler2D samplerA, sampler2D samplerB) {
14    half4 a = bar(samplerA);
15    half4 b = baz(samplerB);
16    return a + b;
17}
18
19void main() {
20    // foo_aSampler_aSecondSampler
21    //   | -> bar_aSampler -> baz_aSampler
22    //   | -> baz_aSecondSampler
23    sk_FragColor = foo(aSampler, aSecondSampler);
24
25    // bar_aThirdSampler -> baz_aThirdSampler
26    sk_FragColor = bar(aThirdSampler);
27
28    // foo_aSecondSampler_aThirdSampler
29    //   | -> bar_aSecondSampler -> baz_aSecondSampler
30    //   | -> baz_aThirdSampler
31    sk_FragColor = foo(aSecondSampler, aThirdSampler);
32}
33
34