skia2/resources/sksl/shared/ComplexDelete.sksl
Brian Osman 10c77dbce3 Reland "Restrict where 'binding' and 'set' can appear"
This is a reland of 9372ef0228

Original change's description:
> Restrict where 'binding' and 'set' can appear
>
> In SPIRV, these are an error when applied to struct members. Some of our
> tests were triggering that because we had free-floating uniforms
> decorated this way (and we coalesce those into members of an interface
> block).
>
> Now, we only allow those layout qualifiers on variable types that will
> remain top-level constructs in the back-end.
>
> Bug: skia:12670
> Change-Id: I73e69cecf6237a1c1180ad38d9b5d52ea80316fb
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/474218
> Commit-Queue: Brian Osman <brianosman@google.com>
> Reviewed-by: Ethan Nicholas <ethannicholas@google.com>

Bug: skia:12670
Change-Id: I01c0323bba7ce0bddea5f9fb907e2b60e6b812d2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/475156
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-11-23 18:03:24 +00:00

15 lines
490 B
Plaintext

uniform float4x4 colorXform;
layout(binding=0) uniform sampler2D s;
void main() {
float4 tmpColor;
sk_FragColor =
half4(1.0) *
(tmpColor = sample(s, float2(1)),
half4(colorXform != float4x4(1.0)
? float4(clamp((float4x4(colorXform) * float4(tmpColor.xyz, 1.0)).xyz,
0.0, tmpColor.w),
tmpColor.w)
: tmpColor));
}