Rename `bool highp` to a non-reserved keyword.
We can't name our variables after GLSL keywords. This worked in the past
because our optimizer was able to optimize away `highp`, as it is
always constant.
Change-Id: Idbd97cad4f10da72f610701c83b0736e96a06626
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/368419
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
diff --git a/src/gpu/effects/GrRectBlurEffect.fp b/src/gpu/effects/GrRectBlurEffect.fp
index bec574c..8111c77 100644
--- a/src/gpu/effects/GrRectBlurEffect.fp
+++ b/src/gpu/effects/GrRectBlurEffect.fp
@@ -24,11 +24,11 @@
in fragmentProcessor inputFP;
in float4 rect;
-layout(key) bool highp = abs(rect.x) > 16000 || abs(rect.y) > 16000 ||
- abs(rect.z) > 16000 || abs(rect.w) > 16000;
+layout(key) bool highPrecision = abs(rect.x) > 16000 || abs(rect.y) > 16000 ||
+ abs(rect.z) > 16000 || abs(rect.w) > 16000;
-layout(when= highp) uniform float4 rectF;
-layout(when=!highp) uniform half4 rectH;
+layout(when= highPrecision) uniform float4 rectF;
+layout(when=!highPrecision) uniform half4 rectH;
layout(key) in bool applyInvVM;
layout(when=applyInvVM) in uniform float3x3 invVM;
@@ -193,7 +193,7 @@
// computations align the left edge of the integral texture with the inset rect's edge
// extending outward 6 * sigma from the inset rect.
half2 xy;
- @if (highp) {
+ @if (highPrecision) {
xy = max(half2(rectF.LT - pos), half2(pos - rectF.RB));
} else {
xy = max(half2(rectH.LT - pos), half2(pos - rectH.RB));
@@ -217,7 +217,7 @@
// Also, our rect uniform was pre-inset by 3 sigma from the actual rect being blurred,
// also factored in.
half4 rect;
- @if (highp) {
+ @if (highPrecision) {
rect.LT = half2(rectF.LT - pos);
rect.RB = half2(pos - rectF.RB);
} else {
@@ -234,7 +234,7 @@
@setData(pdman) {
float r[] {rect.fLeft, rect.fTop, rect.fRight, rect.fBottom};
- pdman.set4fv(highp ? rectF : rectH, 1, r);
+ pdman.set4fv(highPrecision ? rectF : rectH, 1, r);
}
@test(data) {
diff --git a/src/gpu/effects/generated/GrRectBlurEffect.cpp b/src/gpu/effects/generated/GrRectBlurEffect.cpp
index 1d7d4ce..31bf19b 100644
--- a/src/gpu/effects/generated/GrRectBlurEffect.cpp
+++ b/src/gpu/effects/generated/GrRectBlurEffect.cpp
@@ -32,14 +32,14 @@
(void)invVM;
auto isFast = _outer.isFast;
(void)isFast;
- highp = ((abs(rect.left()) > 16000.0 || abs(rect.top()) > 16000.0) ||
- abs(rect.right()) > 16000.0) ||
- abs(rect.bottom()) > 16000.0;
- if (highp) {
+ highPrecision = ((abs(rect.left()) > 16000.0 || abs(rect.top()) > 16000.0) ||
+ abs(rect.right()) > 16000.0) ||
+ abs(rect.bottom()) > 16000.0;
+ if (highPrecision) {
rectFVar = args.fUniformHandler->addUniform(&_outer, kFragment_GrShaderFlag,
kFloat4_GrSLType, "rectF");
}
- if (!highp) {
+ if (!highPrecision) {
rectHVar = args.fUniformHandler->addUniform(&_outer, kFragment_GrShaderFlag,
kHalf4_GrSLType, "rectH");
}
@@ -48,7 +48,7 @@
kFloat3x3_GrSLType, "invVM");
}
fragBuilder->codeAppendf(
- R"SkSL(/* key */ bool highp = %s;
+ R"SkSL(/* key */ bool highPrecision = %s;
half xCoverage;
half yCoverage;
@@ -58,12 +58,12 @@
}
@if (%s) {
half2 xy;
- @if (highp) {
+ @if (highPrecision) {
xy = max(half2(%s.xy - pos), half2(pos - %s.zw));
} else {
xy = max(half2(float2(%s.xy) - pos), half2(pos - float2(%s.zw)));
})SkSL",
- (highp ? "true" : "false"), (_outer.applyInvVM ? "true" : "false"),
+ (highPrecision ? "true" : "false"), (_outer.applyInvVM ? "true" : "false"),
invVMVar.isValid() ? args.fUniformHandler->getUniformCStr(invVMVar) : "float3x3(1)",
(_outer.isFast ? "true" : "false"),
rectFVar.isValid() ? args.fUniformHandler->getUniformCStr(rectFVar) : "float4(0)",
@@ -83,7 +83,7 @@
yCoverage = %s.w;
} else {
half4 rect;
- @if (highp) {
+ @if (highPrecision) {
rect.xy = half2(%s.xy - pos);
rect.zw = half2(pos - %s.zw);
} else {
@@ -144,9 +144,9 @@
(void)isFast;
float r[]{rect.fLeft, rect.fTop, rect.fRight, rect.fBottom};
- pdman.set4fv(highp ? rectF : rectH, 1, r);
+ pdman.set4fv(highPrecision ? rectF : rectH, 1, r);
}
- bool highp = false;
+ bool highPrecision = false;
UniformHandle rectFVar;
UniformHandle rectHVar;
UniformHandle invVMVar;
@@ -156,10 +156,10 @@
}
void GrRectBlurEffect::onGetGLSLProcessorKey(const GrShaderCaps& caps,
GrProcessorKeyBuilder* b) const {
- bool highp = ((abs(rect.left()) > 16000.0 || abs(rect.top()) > 16000.0) ||
- abs(rect.right()) > 16000.0) ||
- abs(rect.bottom()) > 16000.0;
- b->add32((uint32_t)highp);
+ bool highPrecision = ((abs(rect.left()) > 16000.0 || abs(rect.top()) > 16000.0) ||
+ abs(rect.right()) > 16000.0) ||
+ abs(rect.bottom()) > 16000.0;
+ b->add32((uint32_t)highPrecision);
b->add32((uint32_t)applyInvVM);
b->add32((uint32_t)isFast);
}