aboutsummaryrefslogtreecommitdiff
path: root/tests/GLProgramsTest.cpp
diff options
context:
space:
mode:
authorEric Karl <ericrk@chromium.org>2017-05-08 12:02:07 -0700
committerSkia Commit-Bot <skia-commit-bot@chromium.org>2017-05-09 17:41:25 +0000
commit5c77975e4c00e18e644c72b56f369858acd11b15 (patch)
tree187dff83863784225a9f2aa4d8c5abacefc12ec0 /tests/GLProgramsTest.cpp
parentfda4600e41ded0b8f0a54222e2dc8a85d53b4121 (diff)
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 <ericrk@chromium.org> Reviewed-by: Eric Karl <ericrk@chromium.org> Reviewed-by: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'tests/GLProgramsTest.cpp')
-rw-r--r--tests/GLProgramsTest.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/tests/GLProgramsTest.cpp b/tests/GLProgramsTest.cpp
index 6e9bef9fc8..3cf28daad2 100644
--- a/tests/GLProgramsTest.cpp
+++ b/tests/GLProgramsTest.cpp
@@ -251,7 +251,11 @@ static bool set_random_state(GrPaint* paint, SkRandom* random) {
}
// right now, the only thing we seem to care about in drawState's stencil is 'doesWrite()'
-static const GrUserStencilSettings* get_random_stencil(SkRandom* random) {
+static const GrUserStencilSettings* get_random_stencil(SkRandom* random, GrContext* context) {
+ if (context->caps()->avoidStencilBuffers()) {
+ return &GrUserStencilSettings::kUnused;
+ }
+
static constexpr GrUserStencilSettings kDoesWriteStencil(
GrUserStencilSettings::StaticInit<
0xffff,
@@ -332,7 +336,7 @@ bool GrDrawingManager::ProgramUnitTest(GrContext* context, int maxStages) {
set_random_color_coverage_stages(&grPaint, &ptd, maxStages);
set_random_xpf(&grPaint, &ptd);
bool snapToCenters = set_random_state(&grPaint, &random);
- const GrUserStencilSettings* uss = get_random_stencil(&random);
+ const GrUserStencilSettings* uss = get_random_stencil(&random, context);
// We don't use kHW because we will hit an assertion if the render target is not
// multisampled
static constexpr GrAAType kAATypes[] = {GrAAType::kNone, GrAAType::kCoverage};