Enable gl_FragCoord workaround on NexusPlayer, and re-enable analytic clipping
The analytic clip override was added to work around a fragCoord bug,
before we had the sk_FragCoord workaround. Now that we do, we can enable
that instead. This lets us remove the only use of fMaxClipAnalyticFPs.
Bug: skia:7286
Change-Id: If043bd939fd21088c145536b3133c7090e0984b9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/218538
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
diff --git a/src/gpu/GrCaps.cpp b/src/gpu/GrCaps.cpp
index 9a1222e..adcedb6 100644
--- a/src/gpu/GrCaps.cpp
+++ b/src/gpu/GrCaps.cpp
@@ -58,14 +58,6 @@
fMaxTextureSize = 1;
fMaxWindowRectangles = 0;
- // An default count of 4 was chosen because of the common pattern in Blink of:
- // isect RR
- // diff RR
- // isect convex_poly
- // isect convex_poly
- // when drawing rounded div borders.
- fMaxClipAnalyticFPs = 4;
-
fSuppressPrints = options.fSuppressPrints;
#if GR_TEST_UTILS
fWireframeMode = options.fWireframeMode;
@@ -241,7 +233,6 @@
writer->appendS32("Max Render Target Size", fMaxRenderTargetSize);
writer->appendS32("Max Preferred Render Target Size", fMaxPreferredRenderTargetSize);
writer->appendS32("Max Window Rectangles", fMaxWindowRectangles);
- writer->appendS32("Max Clip Analytic Fragment Processors", fMaxClipAnalyticFPs);
static const char* kBlendEquationSupportNames[] = {
"Basic",
diff --git a/src/gpu/GrCaps.h b/src/gpu/GrCaps.h
index 42d6e76..5d5d3cc 100644
--- a/src/gpu/GrCaps.h
+++ b/src/gpu/GrCaps.h
@@ -157,10 +157,6 @@
return this->maxWindowRectangles() > 0 && this->onIsWindowRectanglesSupportedForRT(rt);
}
- // A tuned, platform-specific value for the maximum number of analytic fragment processors we
- // should use to implement a clip, before falling back on a mask.
- int maxClipAnalyticFPs() const { return fMaxClipAnalyticFPs; }
-
virtual bool isConfigTexturable(GrPixelConfig) const = 0;
// Returns whether a texture of the given config can be copied to a texture of the same config.
@@ -429,7 +425,6 @@
int fMaxTextureSize;
int fMaxTileSize;
int fMaxWindowRectangles;
- int fMaxClipAnalyticFPs;
GrDriverBugWorkarounds fDriverBugWorkarounds;
diff --git a/src/gpu/GrClipStackClip.cpp b/src/gpu/GrClipStackClip.cpp
index 519704e..43342ed 100644
--- a/src/gpu/GrClipStackClip.cpp
+++ b/src/gpu/GrClipStackClip.cpp
@@ -205,8 +205,16 @@
return true;
}
+ // An default count of 4 was chosen because of the common pattern in Blink of:
+ // isect RR
+ // diff RR
+ // isect convex_poly
+ // isect convex_poly
+ // when drawing rounded div borders.
+ constexpr int kMaxAnalyticFPs = 4;
+
int maxWindowRectangles = renderTargetContext->priv().maxWindowRectangles();
- int maxAnalyticFPs = context->priv().caps()->maxClipAnalyticFPs();
+ int maxAnalyticFPs = kMaxAnalyticFPs;
if (GrFSAAType::kNone != renderTargetContext->fsaaType()) {
// With mixed samples (non-msaa color buffer), any coverage info is lost from color once it
// hits the color buffer anyway, so we may as well use coverage AA if nothing else in the
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp
index b24d96e..2adcf35 100644
--- a/src/gpu/gl/GrGLCaps.cpp
+++ b/src/gpu/gl/GrGLCaps.cpp
@@ -2675,13 +2675,6 @@
fMipMapSupport = false;
}
- if (isX86PowerVRRogue) {
- // Temporarily disabling clip analytic fragments processors on Nexus player while we work
- // around a driver bug related to gl_FragCoord.
- // https://bugs.chromium.org/p/skia/issues/detail?id=7286
- fMaxClipAnalyticFPs = 0;
- }
-
#ifndef SK_BUILD_FOR_IOS
if (kPowerVR54x_GrGLRenderer == ctxInfo.renderer() ||
kPowerVRRogue_GrGLRenderer == ctxInfo.renderer() ||
@@ -2892,6 +2885,12 @@
shaderCaps->fCanUseFragCoord = false;
}
+ if (isX86PowerVRRogue) {
+ // NexusPlayer seems to render garbage when accessing gl_FragCoord
+ // https://bugs.chromium.org/p/skia/issues/detail?id=7286
+ shaderCaps->fCanUseFragCoord = false;
+ }
+
// On Mali G71, mediump ints don't appear capable of representing every integer beyond +/-2048.
// (Are they implemented with fp16?)
if (kARM_GrGLVendor == ctxInfo.vendor()) {