diff options
author | 2017-05-15 11:00:58 -0400 | |
---|---|---|
committer | 2017-05-15 15:41:01 +0000 | |
commit | e334c596546c7ec79f2b0e55b3a1c2839a94f352 (patch) | |
tree | e84c3c7209693de32ec8722d09d6e1bafbee74ad /tests | |
parent | 63cef6b8c11b8f5d5584a13929e218f520a49669 (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')
-rw-r--r-- | tests/GLProgramsTest.cpp | 62 | ||||
-rw-r--r-- | tests/GrSKSLPrettyPrintTest.cpp (renamed from tests/GrGLSLPrettyPrintTest.cpp) | 15 |
2 files changed, 25 insertions, 52 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 diff --git a/tests/GrGLSLPrettyPrintTest.cpp b/tests/GrSKSLPrettyPrintTest.cpp index 1a5152fa75..ec5dddb023 100644 --- a/tests/GrGLSLPrettyPrintTest.cpp +++ b/tests/GrSKSLPrettyPrintTest.cpp @@ -5,11 +5,10 @@ * found in the LICENSE file. */ -#include "SkTypes.h" +#include "Test.h" #if SK_SUPPORT_GPU -#include "Test.h" -#include "gl/GrGLSLPrettyPrint.h" +#include "GrSKSLPrettyPrint.h" #define ASSERT(x) REPORTER_ASSERT(r, x) @@ -88,7 +87,7 @@ const SkString neg2("###\n##\n#####(((((((((((((unbalanced verything;;;"); const SkString neg3("}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}" ";;;;;;/////"); -DEF_TEST(GrGLSLPrettyPrint, r) { +DEF_TEST(GrSKSLPrettyPrint, r) { SkTArray<const char*> testStr; SkTArray<int> lengths; testStr.push_back(input1.c_str()); @@ -104,8 +103,8 @@ DEF_TEST(GrGLSLPrettyPrint, r) { testStr.push_back(input6.c_str()); lengths.push_back((int)input6.size()); - SkString test = GrGLSLPrettyPrint::PrettyPrintGLSL(testStr.begin(), lengths.begin(), - testStr.count(), true); + SkString test = GrSKSLPrettyPrint::PrettyPrint(testStr.begin(), lengths.begin(), + testStr.count(), true); ASSERT(output1 == test); testStr.reset(); @@ -118,8 +117,8 @@ DEF_TEST(GrGLSLPrettyPrint, r) { lengths.push_back((int)neg3.size()); // Just test we don't crash with garbage input - ASSERT(GrGLSLPrettyPrint::PrettyPrintGLSL(testStr.begin(), lengths.begin(), 1, - true).c_str() != nullptr); + ASSERT(GrSKSLPrettyPrint::PrettyPrint(testStr.begin(), lengths.begin(), 1, + true).c_str() != nullptr); } #endif |