| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 // This is a GPU-backend specific test. It relies on static intializers to work | 9 // This is a GPU-backend specific test. It relies on static intializers to work |
| 10 | 10 |
| (...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 499 ++t; | 499 ++t; |
| 500 } | 500 } |
| 501 return true; | 501 return true; |
| 502 } | 502 } |
| 503 | 503 |
| 504 DEF_GPUTEST(GLPrograms, reporter, factory) { | 504 DEF_GPUTEST(GLPrograms, reporter, factory) { |
| 505 for (int type = 0; type < GrContextFactory::kLastGLContextType; ++type) { | 505 for (int type = 0; type < GrContextFactory::kLastGLContextType; ++type) { |
| 506 GrContext* context = factory->get(static_cast<GrContextFactory::GLContex
tType>(type)); | 506 GrContext* context = factory->get(static_cast<GrContextFactory::GLContex
tType>(type)); |
| 507 if (context) { | 507 if (context) { |
| 508 GrGpuGL* gpu = static_cast<GrGpuGL*>(context->getGpu()); | 508 GrGpuGL* gpu = static_cast<GrGpuGL*>(context->getGpu()); |
| 509 int maxStages = 6; | 509 |
| 510 /* |
| 511 * For the time being, we only support the test with desktop GL or f
or android on |
| 512 * ARM platforms |
| 513 * TODO When we run ES 3.00 GLSL in more places, test again |
| 514 */ |
| 515 int maxStages; |
| 516 if (kGL_GrGLStandard == gpu->glStandard() || |
| 517 kARM_GrGLVendor == gpu->ctxInfo().vendor()) { |
| 518 maxStages = 6; |
| 519 } else if (kTegra3_GrGLRenderer == gpu->ctxInfo().renderer() || |
| 520 kOther_GrGLRenderer == gpu->ctxInfo().renderer()) { |
| 521 maxStages = 1; |
| 522 } else { |
| 523 return; |
| 524 } |
| 510 #if SK_ANGLE | 525 #if SK_ANGLE |
| 511 // Some long shaders run out of temporary registers in the D3D compi
ler on ANGLE. | 526 // Some long shaders run out of temporary registers in the D3D compi
ler on ANGLE. |
| 512 if (type == GrContextFactory::kANGLE_GLContextType) { | 527 if (type == GrContextFactory::kANGLE_GLContextType) { |
| 513 maxStages = 3; | 528 maxStages = 3; |
| 514 } | 529 } |
| 515 #endif | 530 #endif |
| 516 REPORTER_ASSERT(reporter, gpu->programUnitTest(maxStages)); | 531 REPORTER_ASSERT(reporter, gpu->programUnitTest(maxStages)); |
| 517 } | 532 } |
| 518 } | 533 } |
| 519 } | 534 } |
| 520 | 535 |
| 521 // This is evil evil evil. The linker may throw away whole translation units as
dead code if it | |
| 522 // thinks none of the functions are called. It will do this even if there are st
atic initializers | |
| 523 // in the unit that could pass pointers to functions from the unit out to other
translation units! | |
| 524 // We force some of the effects that would otherwise be discarded to link here. | |
| 525 | |
| 526 #include "SkAlphaThresholdFilter.h" | |
| 527 #include "SkColorMatrixFilter.h" | |
| 528 #include "SkLightingImageFilter.h" | |
| 529 #include "SkMagnifierImageFilter.h" | |
| 530 | |
| 531 void forceLinking(); | |
| 532 | |
| 533 void forceLinking() { | |
| 534 SkLightingImageFilter::CreateDistantLitDiffuse(SkPoint3(0,0,0), 0, 0, 0); | |
| 535 SkAlphaThresholdFilter::Create(SkRegion(), .5f, .5f); | |
| 536 SkAutoTUnref<SkImageFilter> mag(SkMagnifierImageFilter::Create( | |
| 537 SkRect::MakeWH(SK_Scalar1, SK_Scalar1), SK_Scalar1)); | |
| 538 GrConfigConversionEffect::Create(NULL, | |
| 539 false, | |
| 540 GrConfigConversionEffect::kNone_PMConversio
n, | |
| 541 SkMatrix::I()); | |
| 542 SkScalar matrix[20]; | |
| 543 SkAutoTUnref<SkColorMatrixFilter> cmf(SkColorMatrixFilter::Create(matrix)); | |
| 544 } | |
| 545 | |
| 546 #endif | 536 #endif |
| OLD | NEW |