dc75a97b80
Previously, GLSL and Metal code generators would emit a struct wherever the type was first used in the code, regardless of where it was originally defined or what scope the type needs to live in. This CL adds a ProgramElement for struct definitions, so that structs will now appear at the top-level as they were originally defined. In the case of Metal, some special handling is also needed to handle the Globals struct properly. Not yet fully supported: - No special handling for structs declared inside functions yet - No support for structs in separate scopes with overlapping names The severity of the remaining issues depends mostly on whether we want to support structs inside functions in Runtime Effects. Change-Id: Ia95d4529506cb3fa6da63f5cb548199a93e1c0c5 Bug: skia:10922, skia:10923, skia:10925, skia:10926 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/338600 Commit-Queue: Brian Osman <brianosman@google.com> Reviewed-by: Brian Osman <brianosman@google.com> Auto-Submit: John Stiles <johnstiles@google.com>
18 lines
229 B
GLSL
18 lines
229 B
GLSL
|
|
out vec4 sk_FragColor;
|
|
struct A {
|
|
int x;
|
|
int y;
|
|
} a1;
|
|
struct B {
|
|
float x;
|
|
float[2] y;
|
|
layout (binding = 1) A z;
|
|
};
|
|
B b1;
|
|
void main() {
|
|
a1.x = 0;
|
|
b1.x = 0.0;
|
|
sk_FragColor.x = float(a1.x) + b1.x;
|
|
}
|