From 5c77975e4c00e18e644c72b56f369858acd11b15 Mon Sep 17 00:00:00 2001 From: Eric Karl Date: Mon, 8 May 2017 12:02:07 -0700 Subject: Add flag to avoid stencil buffers in Skia Certain systems experience a leak in the GL driver associated with stencil buffers. Attempts to avoid the leak (while still using stencil buffers) dind't succeed. This patch adds a GrContextOption fAvoidStencilBuffers. This disables certain path rendering modes, as well as stencil based masking/clipping. Bug: 713854 Change-Id: Ifa6c0f2bd5ee395547bda9165d6c79d197ae8b8b Reviewed-on: https://skia-review.googlesource.com/15253 Commit-Queue: Eric Karl Reviewed-by: Eric Karl Reviewed-by: Brian Salomon --- include/gpu/GrCaps.h | 3 +++ include/gpu/GrContextOptions.h | 6 ++++++ 2 files changed, 9 insertions(+) (limited to 'include') diff --git a/include/gpu/GrCaps.h b/include/gpu/GrCaps.h index 92171204b3..17b5a23e18 100644 --- a/include/gpu/GrCaps.h +++ b/include/gpu/GrCaps.h @@ -79,6 +79,8 @@ public: bool avoidInstancedDrawsToFPTargets() const { return fAvoidInstancedDrawsToFPTargets; } + bool avoidStencilBuffers() const { return fAvoidStencilBuffers; } + /** * Indicates the capabilities of the fixed function blend unit. */ @@ -225,6 +227,7 @@ protected: bool fUseDrawInsteadOfPartialRenderTargetWrite : 1; bool fUseDrawInsteadOfAllRenderTargetWrites : 1; bool fAvoidInstancedDrawsToFPTargets : 1; + bool fAvoidStencilBuffers : 1; // ANGLE workaround bool fPreferVRAMUseOverFlushes : 1; diff --git a/include/gpu/GrContextOptions.h b/include/gpu/GrContextOptions.h index 2e43e426af..d74f10ff63 100644 --- a/include/gpu/GrContextOptions.h +++ b/include/gpu/GrContextOptions.h @@ -110,6 +110,12 @@ struct GrContextOptions { * The maximum size of cache textures used for Skia's Glyph cache. */ float fGlyphCacheTextureMaximumBytes = 2048 * 1024 * 4; + + /** + * Bugs on certain drivers cause stencil buffers to leak. This flag causes Skia to avoid + * allocating stencil buffers and use alternate rasterization paths, avoiding the leak. + */ + bool fAvoidStencilBuffers = false; }; GR_MAKE_BITFIELD_CLASS_OPS(GrContextOptions::GpuPathRenderers) -- cgit v1.2.3