skia2/resources/sksl/spirv/InterfaceBlockPushConstant.sksl
Brian Osman 2a4c0fbdca Improve memory layout handling in SPIRV generator
Added asserts that verify we don't try to emit the same struct or array
with two different memory layout rules. Some code paths were failing to
inspect the associated variable, leading to incorrect errors about the
attached offsets of members.

Added a test case that triggered that error, and also triggers the new
asserts.

Then, fixed the underlying cause: writing out the struct definition as a
side effect of accessing a member in getLValue().

Bug: skia:11205
Change-Id: I6e5fb76ea918ec9ff10425f2d519ddbc54404b27
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/357436
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2021-01-22 22:16:48 +00:00

9 lines
209 B
Plaintext

layout(push_constant, binding=456) uniform testBlock {
layout(offset=16) half2x2 m1;
layout(offset=32) half2x2 m2;
};
void main() {
sk_FragColor = half4(m1[0][0], m1[1][1], m2[0][0], m2[1][1]);
}