aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar Eric Karl <ericrk@chromium.org>2017-05-08 12:02:07 -0700
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-05-09 17:41:25 +0000
commit5c77975e4c00e18e644c72b56f369858acd11b15 (patch)
tree187dff83863784225a9f2aa4d8c5abacefc12ec0 /tests
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')
-rw-r--r--tests/GLProgramsTest.cpp8
-rw-r--r--tests/GpuSampleLocationsTest.cpp5
-rw-r--r--tests/ResourceCacheTest.cpp3
-rw-r--r--tests/SurfaceTest.cpp3
-rw-r--r--tests/TestConfigParsing.cpp2
5 files changed, 18 insertions, 3 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};
diff --git a/tests/GpuSampleLocationsTest.cpp b/tests/GpuSampleLocationsTest.cpp
index 6e685463b7..75d2846dd6 100644
--- a/tests/GpuSampleLocationsTest.cpp
+++ b/tests/GpuSampleLocationsTest.cpp
@@ -190,6 +190,11 @@ private:
DEF_GPUTEST(GLSampleLocations, reporter, /*factory*/) {
GLTestSampleLocationsInterface testInterface;
sk_sp<GrContext> ctx(GrContext::Create(kOpenGL_GrBackend, testInterface));
+
+ // This test relies on at least 2 samples.
+ if (ctx->caps()->maxSampleCount() < 2) {
+ return;
+ }
test_sampleLocations(reporter, &testInterface, ctx.get());
}
diff --git a/tests/ResourceCacheTest.cpp b/tests/ResourceCacheTest.cpp
index 5590c868bf..3a11bb9c2e 100644
--- a/tests/ResourceCacheTest.cpp
+++ b/tests/ResourceCacheTest.cpp
@@ -101,6 +101,9 @@ DEF_GPUTEST_FOR_CONTEXTS(ResourceCacheStencilBuffers, &is_rendering_and_not_angl
smallDesc.fHeight = 4;
smallDesc.fSampleCnt = 0;
+ if (context->caps()->avoidStencilBuffers()) {
+ return;
+ }
GrResourceProvider* resourceProvider = context->resourceProvider();
// Test that two budgeted RTs with the same desc share a stencil buffer.
sk_sp<GrTexture> smallRT0(resourceProvider->createTexture(smallDesc, SkBudgeted::kYes));
diff --git a/tests/SurfaceTest.cpp b/tests/SurfaceTest.cpp
index aa351edf56..1a03f15b0b 100644
--- a/tests/SurfaceTest.cpp
+++ b/tests/SurfaceTest.cpp
@@ -781,6 +781,9 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SurfaceAttachStencil_Gpu, reporter, ctxInf
if (!gpu) {
return;
}
+ if (gpu->caps()->avoidStencilBuffers()) {
+ return;
+ }
static const uint32_t kOrigColor = 0xFFAABBCC;
for (auto& surfaceFunc : {&create_gpu_surface_backend_texture,
diff --git a/tests/TestConfigParsing.cpp b/tests/TestConfigParsing.cpp
index f9ac9318f2..83051aa2cc 100644
--- a/tests/TestConfigParsing.cpp
+++ b/tests/TestConfigParsing.cpp
@@ -80,7 +80,7 @@ DEF_TEST(ParseConfigs_DefaultConfigs, reporter) {
"pdf", "skp", "svg", "xps", "angle_d3d11_es2", "angle_gl_es2", "commandbuffer", "mesa",
"hwui", "glf16", "glessrgb", "gl", "glnvpr4", "glnvprdit4", "glsrgb", "glmsaa4", "vk",
"glinst", "glinst4", "glinstdit4", "glinst8", "glinstdit8", "glesinst", "glesinst4",
- "glesinstdit4", "glwide", "glnarrow"
+ "glesinstdit4", "glwide", "glnarrow", "glnostencils"
});
SkCommandLineConfigArray configs;