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 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 if (kGL_GrGLStandard == gpu->glStandard() || | 415 if (kGL_GrGLStandard == gpu->glStandard() || |
416 kARM_GrGLVendor == gpu->ctxInfo().vendor()) { | 416 kARM_GrGLVendor == gpu->ctxInfo().vendor()) { |
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, GrContext* cont
ext) { | 425 static void test_glprograms_native(skiatest::Reporter* reporter, |
426 int maxStages = get_glprograms_max_stages(context); | 426 const sk_gpu_test::ContextInfo& ctxInfo) { |
| 427 int maxStages = get_glprograms_max_stages(ctxInfo.fGrContext); |
427 if (maxStages == 0) { | 428 if (maxStages == 0) { |
428 return; | 429 return; |
429 } | 430 } |
430 REPORTER_ASSERT(reporter, GrDrawingManager::ProgramUnitTest(context, maxStag
es)); | 431 REPORTER_ASSERT(reporter, GrDrawingManager::ProgramUnitTest(ctxInfo.fGrConte
xt, maxStages)); |
431 } | 432 } |
432 | 433 |
433 static void test_glprograms_other_contexts(skiatest::Reporter* reporter, GrConte
xt* context) { | 434 static void test_glprograms_other_contexts( |
434 int maxStages = get_glprograms_max_stages(context); | 435 skiatest::Reporter* reporter, |
| 436 const sk_gpu_test::ContextInfo& ctxInfo) { |
| 437 int maxStages = get_glprograms_max_stages(ctxInfo.fGrContext); |
435 #ifdef SK_BUILD_FOR_WIN | 438 #ifdef SK_BUILD_FOR_WIN |
436 // 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 |
437 // command buffer. | 440 // command buffer. |
438 maxStages = SkTMin(maxStages, 2); | 441 maxStages = SkTMin(maxStages, 2); |
439 #endif | 442 #endif |
440 if (maxStages == 0) { | 443 if (maxStages == 0) { |
441 return; | 444 return; |
442 } | 445 } |
443 REPORTER_ASSERT(reporter, GrDrawingManager::ProgramUnitTest(context, maxStag
es)); | 446 REPORTER_ASSERT(reporter, GrDrawingManager::ProgramUnitTest(ctxInfo.fGrConte
xt, maxStages)); |
444 } | 447 } |
445 | 448 |
446 DEF_GPUTEST(GLPrograms, reporter, /*factory*/) { | 449 DEF_GPUTEST(GLPrograms, reporter, /*factory*/) { |
447 // Set a locale that would cause shader compilation to fail because of , as
decimal separator. | 450 // Set a locale that would cause shader compilation to fail because of , as
decimal separator. |
448 // skbug 3330 | 451 // skbug 3330 |
449 #ifdef SK_BUILD_FOR_WIN | 452 #ifdef SK_BUILD_FOR_WIN |
450 GrAutoLocaleSetter als("sv-SE"); | 453 GrAutoLocaleSetter als("sv-SE"); |
451 #else | 454 #else |
452 GrAutoLocaleSetter als("sv_SE.UTF-8"); | 455 GrAutoLocaleSetter als("sv_SE.UTF-8"); |
453 #endif | 456 #endif |
454 | 457 |
455 // We suppress prints to avoid spew | 458 // We suppress prints to avoid spew |
456 GrContextOptions opts; | 459 GrContextOptions opts; |
457 opts.fSuppressPrints = true; | 460 opts.fSuppressPrints = true; |
458 sk_gpu_test::GrContextFactory debugFactory(opts); | 461 sk_gpu_test::GrContextFactory debugFactory(opts); |
459 skiatest::RunWithGPUTestContexts(test_glprograms_native, skiatest::kNative_G
PUTestContexts, | 462 skiatest::RunWithGPUTestContexts(test_glprograms_native, skiatest::kNative_G
PUTestContexts, |
460 reporter, &debugFactory); | 463 reporter, &debugFactory); |
461 skiatest::RunWithGPUTestContexts(test_glprograms_other_contexts, | 464 skiatest::RunWithGPUTestContexts(test_glprograms_other_contexts, |
462 skiatest::kOther_GPUTestContexts, reporter,
&debugFactory); | 465 skiatest::kOther_GPUTestContexts, reporter,
&debugFactory); |
463 } | 466 } |
464 | 467 |
465 #endif | 468 #endif |
OLD | NEW |