| 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 |
| 11 #include "SkTypes.h" | 11 #include "SkTypes.h" |
| 12 | 12 |
| 13 #if SK_SUPPORT_GPU && SK_ALLOW_STATIC_GLOBAL_INITIALIZERS | 13 #if SK_SUPPORT_GPU && SK_ALLOW_STATIC_GLOBAL_INITIALIZERS |
| 14 | 14 |
| 15 #include "gl/GrGpuGL.h" | 15 #include "gl/GrGpuGL.h" |
| 16 #include "GrBackendEffectFactory.h" | 16 #include "GrBackendEffectFactory.h" |
| 17 #include "GrContextFactory.h" | 17 #include "GrContextFactory.h" |
| 18 #include "GrDrawEffect.h" | 18 #include "GrDrawEffect.h" |
| 19 #include "effects/GrConfigConversionEffect.h" | 19 #include "effects/GrConfigConversionEffect.h" |
| 20 | 20 |
| 21 #include "SkRandom.h" | 21 #include "SkRandom.h" |
| 22 #include "Test.h" | 22 #include "Test.h" |
| 23 | 23 |
| 24 void GrGLProgram::Desc::setRandom(SkMWCRandom* random, | 24 void GrGLProgramDesc::setRandom(SkMWCRandom* random, |
| 25 const GrGpuGL* gpu, | 25 const GrGpuGL* gpu, |
| 26 const GrEffectStage stages[GrDrawState::kNumSt
ages]) { | 26 const GrEffectStage stages[GrDrawState::kNumStag
es]) { |
| 27 fAttribBindings = 0; | 27 fAttribBindings = 0; |
| 28 fEmitsPointSize = random->nextBool(); | 28 fEmitsPointSize = random->nextBool(); |
| 29 fColorInput = random->nextULessThan(kColorInputCnt); | 29 fColorInput = random->nextULessThan(kColorInputCnt); |
| 30 fCoverageInput = random->nextULessThan(kColorInputCnt); | 30 fCoverageInput = random->nextULessThan(kColorInputCnt); |
| 31 | 31 |
| 32 fColorFilterXfermode = random->nextULessThan(SkXfermode::kCoeffModesCnt); | 32 fColorFilterXfermode = random->nextULessThan(SkXfermode::kCoeffModesCnt); |
| 33 | 33 |
| 34 fFirstCoverageStage = random->nextULessThan(GrDrawState::kNumStages); | 34 fFirstCoverageStage = random->nextULessThan(GrDrawState::kNumStages); |
| 35 | 35 |
| 36 fAttribBindings |= random->nextBool() ? GrDrawState::kCoverage_AttribBinding
sBit : 0; | 36 fAttribBindings |= random->nextBool() ? GrDrawState::kCoverage_AttribBinding
sBit : 0; |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 for (int t = 0; t < NUM_TESTS; ++t) { | 99 for (int t = 0; t < NUM_TESTS; ++t) { |
| 100 | 100 |
| 101 #if 0 | 101 #if 0 |
| 102 GrPrintf("\nTest Program %d\n-------------\n", t); | 102 GrPrintf("\nTest Program %d\n-------------\n", t); |
| 103 static const int stop = -1; | 103 static const int stop = -1; |
| 104 if (t == stop) { | 104 if (t == stop) { |
| 105 int breakpointhere = 9; | 105 int breakpointhere = 9; |
| 106 } | 106 } |
| 107 #endif | 107 #endif |
| 108 | 108 |
| 109 GrGLProgram::Desc pdesc; | 109 GrGLProgramDesc pdesc; |
| 110 GrEffectStage stages[GrDrawState::kNumStages]; | 110 GrEffectStage stages[GrDrawState::kNumStages]; |
| 111 | 111 |
| 112 int currAttribIndex = GrDrawState::kAttribIndexCount; | 112 int currAttribIndex = GrDrawState::kAttribIndexCount; |
| 113 int attribIndices[2]; | 113 int attribIndices[2]; |
| 114 for (int s = 0; s < maxStages; ++s) { | 114 for (int s = 0; s < maxStages; ++s) { |
| 115 // enable the stage? | 115 // enable the stage? |
| 116 if (random.nextBool()) { | 116 if (random.nextBool()) { |
| 117 GrTexture* dummyTextures[] = {dummyTexture1.get(), dummyTexture2
.get()}; | 117 GrTexture* dummyTextures[] = {dummyTexture1.get(), dummyTexture2
.get()}; |
| 118 SkAutoTUnref<const GrEffectRef> effect(GrEffectTestFactory::Crea
teStage( | 118 SkAutoTUnref<const GrEffectRef> effect(GrEffectTestFactory::Crea
teStage( |
| 119
&random, | 119
&random, |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 SkMagnifierImageFilter mag(SkRect::MakeWH(SK_Scalar1, SK_Scalar1), SK_Scalar
1); | 187 SkMagnifierImageFilter mag(SkRect::MakeWH(SK_Scalar1, SK_Scalar1), SK_Scalar
1); |
| 188 GrConfigConversionEffect::Create(NULL, | 188 GrConfigConversionEffect::Create(NULL, |
| 189 false, | 189 false, |
| 190 GrConfigConversionEffect::kNone_PMConversio
n, | 190 GrConfigConversionEffect::kNone_PMConversio
n, |
| 191 SkMatrix::I()); | 191 SkMatrix::I()); |
| 192 SkScalar matrix[20]; | 192 SkScalar matrix[20]; |
| 193 SkColorMatrixFilter cmf(matrix); | 193 SkColorMatrixFilter cmf(matrix); |
| 194 } | 194 } |
| 195 | 195 |
| 196 #endif | 196 #endif |
| OLD | NEW |