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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 fColorFilterXfermode = random->nextULessThan(SkXfermode::kCoeffModesCnt); | 47 fColorFilterXfermode = random->nextULessThan(SkXfermode::kCoeffModesCnt); |
48 | 48 |
49 fFirstCoverageStage = random->nextULessThan(GrDrawState::kNumStages); | 49 fFirstCoverageStage = random->nextULessThan(GrDrawState::kNumStages); |
50 | 50 |
51 #if GR_GL_EXPERIMENTAL_GS | 51 #if GR_GL_EXPERIMENTAL_GS |
52 fExperimentalGS = gpu->caps()->geometryShaderSupport() && random->nextBool()
; | 52 fExperimentalGS = gpu->caps()->geometryShaderSupport() && random->nextBool()
; |
53 #endif | 53 #endif |
54 | 54 |
55 fDiscardIfZeroCoverage = random->nextBool(); | 55 fDiscardIfZeroCoverage = random->nextBool(); |
56 | 56 |
57 if (gpu->caps()->dualSourceBlendingSupport()) { | |
58 fDualSrcOutput = random->nextULessThan(kDualSrcOutputCnt); | |
59 } else { | |
60 fDualSrcOutput = kNone_DualSrcOutput; | |
61 } | |
62 | |
63 bool useLocalCoords = random->nextBool() && currAttribIndex < GrDrawState::k
MaxVertexAttribCnt; | 57 bool useLocalCoords = random->nextBool() && currAttribIndex < GrDrawState::k
MaxVertexAttribCnt; |
64 fLocalCoordAttributeIndex = useLocalCoords ? currAttribIndex++ : -1; | 58 fLocalCoordAttributeIndex = useLocalCoords ? currAttribIndex++ : -1; |
65 | 59 |
66 bool dstRead = false; | 60 bool dstRead = false; |
67 for (int s = 0; s < GrDrawState::kNumStages; ++s) { | 61 for (int s = 0; s < GrDrawState::kNumStages; ++s) { |
68 if (NULL != stages[s].getEffect()) { | 62 if (NULL != stages[s].getEffect()) { |
69 const GrBackendEffectFactory& factory = (*stages[s].getEffect())->ge
tFactory(); | 63 const GrBackendEffectFactory& factory = (*stages[s].getEffect())->ge
tFactory(); |
70 GrDrawEffect drawEffect(stages[s], useLocalCoords); | 64 GrDrawEffect drawEffect(stages[s], useLocalCoords); |
71 fEffectKeys[s] = factory.glEffectKey(drawEffect, gpu->glCaps()); | 65 fEffectKeys[s] = factory.glEffectKey(drawEffect, gpu->glCaps()); |
72 if ((*stages[s].getEffect())->willReadDst()) { | 66 if ((*stages[s].getEffect())->willReadDst()) { |
73 dstRead = true; | 67 dstRead = true; |
74 } | 68 } |
75 } | 69 } |
76 } | 70 } |
77 | 71 |
78 if (dstRead) { | 72 if (dstRead) { |
79 this->fDstRead = GrGLShaderBuilder::KeyForDstRead(dstTexture, gpu->glCap
s()); | 73 this->fDstRead = GrGLShaderBuilder::KeyForDstRead(dstTexture, gpu->glCap
s()); |
80 } | 74 } |
| 75 |
| 76 CoverageOutput coverageOutput; |
| 77 bool illegalCoverageOutput; |
| 78 do { |
| 79 coverageOutput = static_cast<CoverageOutput>(random->nextULessThan(kCove
rageOutputCnt)); |
| 80 illegalCoverageOutput = (!gpu->caps()->dualSourceBlendingSupport() && |
| 81 CoverageOutputUsesSecondaryOutput(coverageOutpu
t)) || |
| 82 !dstRead && kCombineWithDst_CoverageOutput == co
verageOutput; |
| 83 } while (illegalCoverageOutput); |
| 84 |
| 85 fCoverageOutput = coverageOutput; |
81 } | 86 } |
82 | 87 |
83 bool GrGpuGL::programUnitTest(int maxStages) { | 88 bool GrGpuGL::programUnitTest(int maxStages) { |
84 | 89 |
85 maxStages = GrMin(maxStages, (int)GrDrawState::kNumStages); | 90 maxStages = GrMin(maxStages, (int)GrDrawState::kNumStages); |
86 | 91 |
87 GrTextureDesc dummyDesc; | 92 GrTextureDesc dummyDesc; |
88 dummyDesc.fConfig = kSkia8888_GrPixelConfig; | 93 dummyDesc.fConfig = kSkia8888_GrPixelConfig; |
89 dummyDesc.fWidth = 34; | 94 dummyDesc.fWidth = 34; |
90 dummyDesc.fHeight = 18; | 95 dummyDesc.fHeight = 18; |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 SkMagnifierImageFilter mag(SkRect::MakeWH(SK_Scalar1, SK_Scalar1), SK_Scalar
1); | 193 SkMagnifierImageFilter mag(SkRect::MakeWH(SK_Scalar1, SK_Scalar1), SK_Scalar
1); |
189 GrConfigConversionEffect::Create(NULL, | 194 GrConfigConversionEffect::Create(NULL, |
190 false, | 195 false, |
191 GrConfigConversionEffect::kNone_PMConversio
n, | 196 GrConfigConversionEffect::kNone_PMConversio
n, |
192 SkMatrix::I()); | 197 SkMatrix::I()); |
193 SkScalar matrix[20]; | 198 SkScalar matrix[20]; |
194 SkColorMatrixFilter cmf(matrix); | 199 SkColorMatrixFilter cmf(matrix); |
195 } | 200 } |
196 | 201 |
197 #endif | 202 #endif |
OLD | NEW |