| OLD | NEW | 
|---|
| 1 /* | 1 /* | 
| 2  * Copyright 2011 Google Inc. | 2  * Copyright 2011 Google Inc. | 
| 3  * | 3  * | 
| 4  * Use of this source code is governed by a BSD-style license that can be | 4  * Use of this source code is governed by a BSD-style license that can be | 
| 5  * found in the LICENSE file. | 5  * found in the LICENSE file. | 
| 6  */ | 6  */ | 
| 7 | 7 | 
| 8 // This is a GPU-backend specific test. It relies on static intializers to work | 8 // This is a GPU-backend specific test. It relies on static intializers to work | 
| 9 | 9 | 
| 10 #include "SkTypes.h" | 10 #include "SkTypes.h" | 
| (...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 417         return 6; | 417         return 6; | 
| 418     } else if (kTegra3_GrGLRenderer == gpu->ctxInfo().renderer() || | 418     } else if (kTegra3_GrGLRenderer == gpu->ctxInfo().renderer() || | 
| 419                kOther_GrGLRenderer == gpu->ctxInfo().renderer()) { | 419                kOther_GrGLRenderer == gpu->ctxInfo().renderer()) { | 
| 420         return 1; | 420         return 1; | 
| 421     } | 421     } | 
| 422     return 0; | 422     return 0; | 
| 423 } | 423 } | 
| 424 | 424 | 
| 425 static void test_glprograms_native(skiatest::Reporter* reporter, | 425 static void test_glprograms_native(skiatest::Reporter* reporter, | 
| 426                                    const sk_gpu_test::ContextInfo& ctxInfo) { | 426                                    const sk_gpu_test::ContextInfo& ctxInfo) { | 
| 427     int maxStages = get_glprograms_max_stages(ctxInfo.fGrContext); | 427     int maxStages = get_glprograms_max_stages(ctxInfo.grContext()); | 
| 428     if (maxStages == 0) { | 428     if (maxStages == 0) { | 
| 429         return; | 429         return; | 
| 430     } | 430     } | 
| 431     REPORTER_ASSERT(reporter, GrDrawingManager::ProgramUnitTest(ctxInfo.fGrConte
     xt, maxStages)); | 431     REPORTER_ASSERT(reporter, GrDrawingManager::ProgramUnitTest(ctxInfo.grContex
     t(), maxStages)); | 
| 432 } | 432 } | 
| 433 | 433 | 
| 434 static void test_glprograms_other_contexts( | 434 static void test_glprograms_other_contexts( | 
| 435             skiatest::Reporter* reporter, | 435             skiatest::Reporter* reporter, | 
| 436             const sk_gpu_test::ContextInfo& ctxInfo) { | 436             const sk_gpu_test::ContextInfo& ctxInfo) { | 
| 437     int maxStages = get_glprograms_max_stages(ctxInfo.fGrContext); | 437     int maxStages = get_glprograms_max_stages(ctxInfo.grContext()); | 
| 438 #ifdef SK_BUILD_FOR_WIN | 438 #ifdef SK_BUILD_FOR_WIN | 
| 439     // Some long shaders run out of temporary registers in the D3D compiler on A
     NGLE and | 439     // Some long shaders run out of temporary registers in the D3D compiler on A
     NGLE and | 
| 440     // command buffer. | 440     // command buffer. | 
| 441     maxStages = SkTMin(maxStages, 2); | 441     maxStages = SkTMin(maxStages, 2); | 
| 442 #endif | 442 #endif | 
| 443     if (maxStages == 0) { | 443     if (maxStages == 0) { | 
| 444         return; | 444         return; | 
| 445     } | 445     } | 
| 446     REPORTER_ASSERT(reporter, GrDrawingManager::ProgramUnitTest(ctxInfo.fGrConte
     xt, maxStages)); | 446     REPORTER_ASSERT(reporter, GrDrawingManager::ProgramUnitTest(ctxInfo.grContex
     t(), maxStages)); | 
| 447 } | 447 } | 
| 448 | 448 | 
| 449 static bool is_native_gl_context_type(sk_gpu_test::GrContextFactory::ContextType
      type) { | 449 static bool is_native_gl_context_type(sk_gpu_test::GrContextFactory::ContextType
      type) { | 
| 450     return type == sk_gpu_test::GrContextFactory::kNativeGL_ContextType; | 450     return type == sk_gpu_test::GrContextFactory::kNativeGL_ContextType; | 
| 451 } | 451 } | 
| 452 | 452 | 
| 453 static bool is_other_rendering_gl_context_type(sk_gpu_test::GrContextFactory::Co
     ntextType type) { | 453 static bool is_other_rendering_gl_context_type(sk_gpu_test::GrContextFactory::Co
     ntextType type) { | 
| 454     return !is_native_gl_context_type(type) && | 454     return !is_native_gl_context_type(type) && | 
| 455            kOpenGL_GrBackend == sk_gpu_test::GrContextFactory::ContextTypeBacken
     d(type) && | 455            kOpenGL_GrBackend == sk_gpu_test::GrContextFactory::ContextTypeBacken
     d(type) && | 
| 456            sk_gpu_test::GrContextFactory::IsRenderingContext(type); | 456            sk_gpu_test::GrContextFactory::IsRenderingContext(type); | 
| (...skipping 12 matching lines...) Expand all  Loading... | 
| 469     GrContextOptions opts; | 469     GrContextOptions opts; | 
| 470     opts.fSuppressPrints = true; | 470     opts.fSuppressPrints = true; | 
| 471     sk_gpu_test::GrContextFactory debugFactory(opts); | 471     sk_gpu_test::GrContextFactory debugFactory(opts); | 
| 472     skiatest::RunWithGPUTestContexts(test_glprograms_native, &is_native_gl_conte
     xt_type, | 472     skiatest::RunWithGPUTestContexts(test_glprograms_native, &is_native_gl_conte
     xt_type, | 
| 473                                      reporter, &debugFactory); | 473                                      reporter, &debugFactory); | 
| 474     skiatest::RunWithGPUTestContexts(test_glprograms_other_contexts, | 474     skiatest::RunWithGPUTestContexts(test_glprograms_other_contexts, | 
| 475                                      &is_other_rendering_gl_context_type, report
     er, &debugFactory); | 475                                      &is_other_rendering_gl_context_type, report
     er, &debugFactory); | 
| 476 } | 476 } | 
| 477 | 477 | 
| 478 #endif | 478 #endif | 
| OLD | NEW | 
|---|