skia2/tests/sksl/shared/Structs.glsl
Brian Osman 8e756f379c Support structs in runtime effects
Uses the pipeline-stage callback mechanism. It mangles the type name
(with a test to verify that this works), and then calls defineStruct
with the entire SkSL struct definition string.

Bug: skia:10939
Change-Id: If14cf1b11faaa80ad8d4086cdacf68532bac43fc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/368809
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2021-02-11 21:09:15 +00:00

19 lines
232 B
GLSL

out vec4 sk_FragColor;
struct A {
int x;
int y;
};
A a1;
struct B {
float x;
float y[2];
layout (binding = 1) A z;
};
B b1;
void main() {
a1.x = 0;
b1.x = 0.0;
sk_FragColor.x = float(a1.x) + b1.x;
}