From 9e87fa7c0e52a79ad85bf32eeb71570938e357bd Mon Sep 17 00:00:00 2001 From: joshualitt Date: Thu, 9 Oct 2014 13:12:35 -0700 Subject: Force linking of static member variables for GLPrograms BUG=skia: Review URL: https://codereview.chromium.org/614163002 --- tests/GLProgramsTest.cpp | 42 ++++++++++++++++-------------------------- 1 file changed, 16 insertions(+), 26 deletions(-) (limited to 'tests') diff --git a/tests/GLProgramsTest.cpp b/tests/GLProgramsTest.cpp index 4d1c59734b..331ea78f8a 100644 --- a/tests/GLProgramsTest.cpp +++ b/tests/GLProgramsTest.cpp @@ -506,7 +506,22 @@ DEF_GPUTEST(GLPrograms, reporter, factory) { GrContext* context = factory->get(static_cast(type)); if (context) { GrGpuGL* gpu = static_cast(context->getGpu()); - int maxStages = 6; + + /* + * 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 + */ + int maxStages; + if (kGL_GrGLStandard == gpu->glStandard() || + kARM_GrGLVendor == gpu->ctxInfo().vendor()) { + maxStages = 6; + } else if (kTegra3_GrGLRenderer == gpu->ctxInfo().renderer() || + kOther_GrGLRenderer == gpu->ctxInfo().renderer()) { + maxStages = 1; + } else { + return; + } #if SK_ANGLE // Some long shaders run out of temporary registers in the D3D compiler on ANGLE. if (type == GrContextFactory::kANGLE_GLContextType) { @@ -518,29 +533,4 @@ DEF_GPUTEST(GLPrograms, reporter, factory) { } } -// This is evil evil evil. The linker may throw away whole translation units as dead code if it -// thinks none of the functions are called. It will do this even if there are static initializers -// in the unit that could pass pointers to functions from the unit out to other translation units! -// We force some of the effects that would otherwise be discarded to link here. - -#include "SkAlphaThresholdFilter.h" -#include "SkColorMatrixFilter.h" -#include "SkLightingImageFilter.h" -#include "SkMagnifierImageFilter.h" - -void forceLinking(); - -void forceLinking() { - SkLightingImageFilter::CreateDistantLitDiffuse(SkPoint3(0,0,0), 0, 0, 0); - SkAlphaThresholdFilter::Create(SkRegion(), .5f, .5f); - SkAutoTUnref mag(SkMagnifierImageFilter::Create( - SkRect::MakeWH(SK_Scalar1, SK_Scalar1), SK_Scalar1)); - GrConfigConversionEffect::Create(NULL, - false, - GrConfigConversionEffect::kNone_PMConversion, - SkMatrix::I()); - SkScalar matrix[20]; - SkAutoTUnref cmf(SkColorMatrixFilter::Create(matrix)); -} - #endif -- cgit v1.2.3