Enable novel GrClipStack on bots, disable elsewhere
As a result of this change, the new GrClipStack will run on all of our
default bots. However, the SK_DISABLE_NEW_GR_CLICK_STACK define is used
to explicitly disable the clip stack when we build for the Android
Framework, Google3, Flutter, and Fuchsia. These projects can have staging
controlled from within the skia repo. This CL in chromium also disables
the new clip stack: https://chromium-review.googlesource.com/c/chromium/src/+/2412768
and must land before this CL does in Skia.
When GrClipStack originally landed, I had it disabled by checking the
value of the define SK_USE_NEW_GR_CLICK_STACK for 0 or 1. To be a little
simpler, and work with the flutter and fuchsia gn defines, this CL
switches GrClipStack control over to SK_DISABLE_NEW_GR_CLICK_STACK and
it just checks for whether or not it's defined.
Bug: skia:10205
Change-Id: I6b8bd18290844c02839fe99fdf629b48ffd86f27
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317209
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt
index c4c59e6..293647c 100644
--- a/RELEASE_NOTES.txt
+++ b/RELEASE_NOTES.txt
@@ -9,6 +9,12 @@
* <insert new release notes here>
+ * New optimized clip stack for GPU backends. Enabled by default but old behavior based on
+ SkClipStack can be restored by defining SK_DISABLE_NEW_GR_CLIP_STACK when building. It is not
+ compatible with SK_SUPPORT_DEPRECATED_CLIPOPS and we are targeting the removal of support for
+ the deprecated, expanding clip ops.
+ https://review.skia.org/317209
+
* Alternate SkImage::MakeFromYUVAPixmaps signature. Takes SkYUVAPixmaps, which specifies
planar configuration in a more structured manner. Currently limited to tri-planar
configurations without alpha but will be expanded. Older signature will become
diff --git a/gn/flutter_defines.gni b/gn/flutter_defines.gni
index 90d6933..8c0bba0 100644
--- a/gn/flutter_defines.gni
+++ b/gn/flutter_defines.gni
@@ -16,6 +16,7 @@
# Staging
"SK_SUPPORT_LEGACY_MATRIX_FACTORIES",
+ "SK_DISABLE_NEW_GR_CLIP_STACK",
# Fast low-precision software rendering isn't a priority for Flutter.
"SK_DISABLE_LEGACY_SHADERCONTEXT",
diff --git a/gn/fuchsia_defines.gni b/gn/fuchsia_defines.gni
index d8d748b..162ed1f 100644
--- a/gn/fuchsia_defines.gni
+++ b/gn/fuchsia_defines.gni
@@ -3,4 +3,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-fuchsia_defines = []
+fuchsia_defines = [
+ # Staging
+ "SK_DISABLE_NEW_GR_CLIP_STACK",
+]
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index ceb57c3..d0309fa 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -130,7 +130,7 @@
renderTargetContext->surfaceProps())
, fContext(SkRef(context))
, fRenderTargetContext(std::move(renderTargetContext))
-#if SK_USE_NEW_GR_CLIP_STACK
+#if !defined(SK_DISABLE_NEW_GR_CLIP_STACK)
, fClip(SkIRect::MakeWH(fRenderTargetContext->width(),
fRenderTargetContext->height()),
&this->asMatrixProvider(),
@@ -251,7 +251,7 @@
///////////////////////////////////////////////////////////////////////////////
-#if SK_USE_NEW_GR_CLIP_STACK
+#if !defined(SK_DISABLE_NEW_GR_CLIP_STACK)
void SkGpuDevice::onClipRegion(const SkRegion& globalRgn, SkClipOp op) {
SkASSERT(op == SkClipOp::kIntersect || op == SkClipOp::kDifference);
diff --git a/src/gpu/SkGpuDevice.h b/src/gpu/SkGpuDevice.h
index b5fb274..c8c9143 100644
--- a/src/gpu/SkGpuDevice.h
+++ b/src/gpu/SkGpuDevice.h
@@ -25,14 +25,17 @@
class SkSurface;
class SkVertices;
-#ifndef SK_USE_NEW_GR_CLIP_STACK
-// NOTE: If this is non-zero, SkGpuDevice extends SkBaseDevice directly and manages its clip stack
+// NOTE: when not defined, SkGpuDevice extends SkBaseDevice directly and manages its clip stack
// using GrClipStack. When false, SkGpuDevice continues to extend SkClipStackDevice and uses
// SkClipStack and GrClipStackClip to manage the clip stack.
-#define SK_USE_NEW_GR_CLIP_STACK 0
+#if !defined(SK_DISABLE_NEW_GR_CLIP_STACK)
+ // For staging purposes, disable this for Android Framework and Google3
+ #if defined(SK_BUILD_FOR_ANDROID_FRAMEWORK) || defined(SK_BUILD_FOR_GOOGLE3)
+ #define SK_DISABLE_NEW_GR_CLIP_STACK
+ #endif
#endif
-#if SK_USE_NEW_GR_CLIP_STACK
+#if !defined(SK_DISABLE_NEW_GR_CLIP_STACK)
#include "src/core/SkDevice.h"
#include "src/gpu/GrClipStack.h"
#define BASE_DEVICE SkBaseDevice
@@ -143,7 +146,7 @@
bool onReadPixels(const SkPixmap&, int, int) override;
bool onWritePixels(const SkPixmap&, int, int) override;
-#if SK_USE_NEW_GR_CLIP_STACK
+#if !defined(SK_DISABLE_NEW_GR_CLIP_STACK)
void onSave() override { fClip.save(); }
void onRestore() override { fClip.restore(); }