Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(81)

Side by Side Diff: tests/GLProgramsTest.cpp

Issue 25846002: Use vertexless shaders when NVpr is available (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Fix mac build Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/gpu/gl/GrGpuGL_program.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 header->fDiscardIfZeroCoverage = random->nextBool(); 71 header->fDiscardIfZeroCoverage = random->nextBool();
72 72
73 bool useLocalCoords = random->nextBool() && currAttribIndex < GrDrawState::k MaxVertexAttribCnt; 73 bool useLocalCoords = random->nextBool() && currAttribIndex < GrDrawState::k MaxVertexAttribCnt;
74 header->fLocalCoordAttributeIndex = useLocalCoords ? currAttribIndex++ : -1; 74 header->fLocalCoordAttributeIndex = useLocalCoords ? currAttribIndex++ : -1;
75 75
76 header->fColorEffectCnt = numColorStages; 76 header->fColorEffectCnt = numColorStages;
77 header->fCoverageEffectCnt = numCoverageStages; 77 header->fCoverageEffectCnt = numCoverageStages;
78 78
79 bool dstRead = false; 79 bool dstRead = false;
80 bool fragPos = false; 80 bool fragPos = false;
81 bool vertexCode = false;
81 int numStages = numColorStages + numCoverageStages; 82 int numStages = numColorStages + numCoverageStages;
82 for (int s = 0; s < numStages; ++s) { 83 for (int s = 0; s < numStages; ++s) {
83 const GrBackendEffectFactory& factory = (*stages[s]->getEffect())->getFa ctory(); 84 const GrBackendEffectFactory& factory = (*stages[s]->getEffect())->getFa ctory();
84 GrDrawEffect drawEffect(*stages[s], useLocalCoords); 85 GrDrawEffect drawEffect(*stages[s], useLocalCoords);
85 this->effectKeys()[s] = factory.glEffectKey(drawEffect, gpu->glCaps()); 86 this->effectKeys()[s] = factory.glEffectKey(drawEffect, gpu->glCaps());
86 if ((*stages[s]->getEffect())->willReadDstColor()) { 87 if ((*stages[s]->getEffect())->willReadDstColor()) {
87 dstRead = true; 88 dstRead = true;
88 } 89 }
89 if ((*stages[s]->getEffect())->willReadFragmentPosition()) { 90 if ((*stages[s]->getEffect())->willReadFragmentPosition()) {
90 fragPos = true; 91 fragPos = true;
91 } 92 }
93 if ((*stages[s]->getEffect())->hasVertexCode()) {
94 vertexCode = true;
95 }
92 } 96 }
93 97
94 if (dstRead) { 98 if (dstRead) {
95 header->fDstReadKey = GrGLShaderBuilder::KeyForDstRead(dstCopyTexture, g pu->glCaps()); 99 header->fDstReadKey = GrGLShaderBuilder::KeyForDstRead(dstCopyTexture, g pu->glCaps());
96 } else { 100 } else {
97 header->fDstReadKey = 0; 101 header->fDstReadKey = 0;
98 } 102 }
99 if (fragPos) { 103 if (fragPos) {
100 header->fFragPosKey = GrGLShaderBuilder::KeyForFragmentPosition(dstRende rTarget, 104 header->fFragPosKey = GrGLShaderBuilder::KeyForFragmentPosition(dstRende rTarget,
101 gpu->gl Caps()); 105 gpu->gl Caps());
102 } else { 106 } else {
103 header->fFragPosKey = 0; 107 header->fFragPosKey = 0;
104 } 108 }
105 109
110 header->fHasVertexCode = vertexCode ||
111 useLocalCoords ||
112 kAttribute_ColorInput == header->fColorInput ||
113 kAttribute_ColorInput == header->fCoverageInput;
114
106 CoverageOutput coverageOutput; 115 CoverageOutput coverageOutput;
107 bool illegalCoverageOutput; 116 bool illegalCoverageOutput;
108 do { 117 do {
109 coverageOutput = static_cast<CoverageOutput>(random->nextULessThan(kCove rageOutputCnt)); 118 coverageOutput = static_cast<CoverageOutput>(random->nextULessThan(kCove rageOutputCnt));
110 illegalCoverageOutput = (!gpu->caps()->dualSourceBlendingSupport() && 119 illegalCoverageOutput = (!gpu->caps()->dualSourceBlendingSupport() &&
111 CoverageOutputUsesSecondaryOutput(coverageOutpu t)) || 120 CoverageOutputUsesSecondaryOutput(coverageOutpu t)) ||
112 (!dstRead && kCombineWithDst_CoverageOutput == c overageOutput); 121 (!dstRead && kCombineWithDst_CoverageOutput == c overageOutput);
113 } while (illegalCoverageOutput); 122 } while (illegalCoverageOutput);
114 123
115 header->fCoverageOutput = coverageOutput; 124 header->fCoverageOutput = coverageOutput;
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 GrConfigConversionEffect::Create(NULL, 250 GrConfigConversionEffect::Create(NULL,
242 false, 251 false,
243 GrConfigConversionEffect::kNone_PMConversio n, 252 GrConfigConversionEffect::kNone_PMConversio n,
244 SkMatrix::I()); 253 SkMatrix::I());
245 SkScalar matrix[20]; 254 SkScalar matrix[20];
246 SkColorMatrixFilter cmf(matrix); 255 SkColorMatrixFilter cmf(matrix);
247 SkBitmapAlphaThresholdShader::Create(SkBitmap(), SkRegion(), 0x80); 256 SkBitmapAlphaThresholdShader::Create(SkBitmap(), SkRegion(), 0x80);
248 } 257 }
249 258
250 #endif 259 #endif
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGpuGL_program.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698