aboutsummaryrefslogtreecommitdiff
path: root/tests/GLProgramsTest.cpp
diff options
context:
space:
mode:
authorBrian Salomon <bsalomon@google.com>2017-05-15 11:00:58 -0400
committerSkia Commit-Bot <skia-commit-bot@chromium.org>2017-05-15 15:41:01 +0000
commite334c596546c7ec79f2b0e55b3a1c2839a94f352 (patch)
treee84c3c7209693de32ec8722d09d6e1bafbee74ad /tests/GLProgramsTest.cpp
parent63cef6b8c11b8f5d5584a13929e218f520a49669 (diff)
Attempt to work around iOS varying limit in GLPrograms test
Dump shaders when linking fails. Bug: skia:6627 Change-Id: I7f1df4be039eb56d990aa64c58c8dd2a22d97dbe Reviewed-on: https://skia-review.googlesource.com/16867 Reviewed-by: Robert Phillips <robertphillips@google.com> Commit-Queue: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'tests/GLProgramsTest.cpp')
-rw-r--r--tests/GLProgramsTest.cpp62
1 files changed, 18 insertions, 44 deletions
diff --git a/tests/GLProgramsTest.cpp b/tests/GLProgramsTest.cpp
index 86b7469179..db65c9bfac 100644
--- a/tests/GLProgramsTest.cpp
+++ b/tests/GLProgramsTest.cpp
@@ -341,56 +341,32 @@ bool GrDrawingManager::ProgramUnitTest(GrContext* context, int maxStages) {
static int get_glprograms_max_stages(GrContext* context) {
GrGLGpu* gpu = static_cast<GrGLGpu*>(context->getGpu());
- /*
- * For the time being, we only support the test with desktop GL or for android on
- * ARM platforms
- * TODO When we run ES 3.00 GLSL in more places, test again
- */
- if (kGL_GrGLStandard == gpu->glStandard() ||
- kARM_GrGLVendor == gpu->ctxInfo().vendor()) {
- return 6;
- } else if (kTegra3_GrGLRenderer == gpu->ctxInfo().renderer() ||
- kOther_GrGLRenderer == gpu->ctxInfo().renderer()) {
- return 1;
- }
- return 0;
-}
-
-static void test_glprograms_native(skiatest::Reporter* reporter,
- const sk_gpu_test::ContextInfo& ctxInfo) {
- int maxStages = get_glprograms_max_stages(ctxInfo.grContext());
- if (maxStages == 0) {
- return;
+ int maxStages = 6;
+ if (kGLES_GrGLStandard == gpu->glStandard()) {
+ // We've had issues with driver crashes and HW limits being exceeded with many effects on
+ // Android devices. We have passes on ARM devices with the default number of stages.
+ // TODO When we run ES 3.00 GLSL in more places, test again
+#ifdef SK_BUILD_FOR_ANDROID
+ if (kARM_GrGLVendor != gpu->ctxInfo().vendor()) {
+ maxStages = 1;
+ }
+#endif
+ // On iOS we can exceed the maximum number of varyings. http://skbug.com/6627.
+#ifdef SK_BUILDF_FOR_IOS
+ maxStages = 3;
+#endif
}
- REPORTER_ASSERT(reporter, GrDrawingManager::ProgramUnitTest(ctxInfo.grContext(), maxStages));
+ return maxStages;
}
-static void test_glprograms_other_contexts(
- skiatest::Reporter* reporter,
- const sk_gpu_test::ContextInfo& ctxInfo) {
+static void test_glprograms(skiatest::Reporter* reporter, const sk_gpu_test::ContextInfo& ctxInfo) {
int maxStages = get_glprograms_max_stages(ctxInfo.grContext());
-#ifdef SK_BUILD_FOR_WIN
- // Some long shaders run out of temporary registers in the D3D compiler on ANGLE and
- // command buffer.
- maxStages = SkTMin(maxStages, 2);
-#endif
if (maxStages == 0) {
return;
}
REPORTER_ASSERT(reporter, GrDrawingManager::ProgramUnitTest(ctxInfo.grContext(), maxStages));
}
-static bool is_native_gl_context_type(sk_gpu_test::GrContextFactory::ContextType type) {
- return type == sk_gpu_test::GrContextFactory::kGL_ContextType ||
- type == sk_gpu_test::GrContextFactory::kGLES_ContextType;
-}
-
-static bool is_other_rendering_gl_context_type(sk_gpu_test::GrContextFactory::ContextType type) {
- return !is_native_gl_context_type(type) &&
- kOpenGL_GrBackend == sk_gpu_test::GrContextFactory::ContextTypeBackend(type) &&
- sk_gpu_test::GrContextFactory::IsRenderingContext(type);
-}
-
DEF_GPUTEST(GLPrograms, reporter, /*factory*/) {
// Set a locale that would cause shader compilation to fail because of , as decimal separator.
// skbug 3330
@@ -404,10 +380,8 @@ DEF_GPUTEST(GLPrograms, reporter, /*factory*/) {
GrContextOptions opts;
opts.fSuppressPrints = true;
sk_gpu_test::GrContextFactory debugFactory(opts);
- skiatest::RunWithGPUTestContexts(test_glprograms_native, &is_native_gl_context_type,
- reporter, &debugFactory);
- skiatest::RunWithGPUTestContexts(test_glprograms_other_contexts,
- &is_other_rendering_gl_context_type, reporter, &debugFactory);
+ skiatest::RunWithGPUTestContexts(test_glprograms, &skiatest::IsRenderingGLContextType, reporter,
+ &debugFactory);
}
#endif