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

Side by Side Diff: tests/GLProgramsTest.cpp

Issue 32403002: Fix GrProgramsTest to not generate tests with too many TexCoord references (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: adress 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.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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 GrPrintf("\nTest Program %d\n-------------\n", t); 151 GrPrintf("\nTest Program %d\n-------------\n", t);
152 static const int stop = -1; 152 static const int stop = -1;
153 if (t == stop) { 153 if (t == stop) {
154 int breakpointhere = 9; 154 int breakpointhere = 9;
155 } 155 }
156 #endif 156 #endif
157 157
158 GrGLProgramDesc pdesc; 158 GrGLProgramDesc pdesc;
159 159
160 int currAttribIndex = 1; // we need to always leave room for position 160 int currAttribIndex = 1; // we need to always leave room for position
161 int currTextureCoordSet = 0;
161 int attribIndices[2]; 162 int attribIndices[2];
162 GrTexture* dummyTextures[] = {dummyTexture1.get(), dummyTexture2.get()}; 163 GrTexture* dummyTextures[] = {dummyTexture1.get(), dummyTexture2.get()};
163 164
164 int numStages = random.nextULessThan(maxStages + 1); 165 int numStages = random.nextULessThan(maxStages + 1);
165 int numColorStages = random.nextULessThan(numStages + 1); 166 int numColorStages = random.nextULessThan(numStages + 1);
166 int numCoverageStages = numStages - numColorStages; 167 int numCoverageStages = numStages - numColorStages;
167 168
168 SkAutoSTMalloc<8, const GrEffectStage*> stages(numStages); 169 SkAutoSTMalloc<8, const GrEffectStage*> stages(numStages);
169 170
170 for (int s = 0; s < numStages; ++s) { 171 bool useFixedFunctionTexturing = this->shouldUseFixedFunctionTexturing() ;
172
173 for (int s = 0; s < numStages;) {
171 SkAutoTUnref<const GrEffectRef> effect(GrEffectTestFactory::CreateSt age( 174 SkAutoTUnref<const GrEffectRef> effect(GrEffectTestFactory::CreateSt age(
172 &ran dom, 175 &ran dom,
173 this ->getContext(), 176 this ->getContext(),
174 *thi s->caps(), 177 *thi s->caps(),
175 dumm yTextures)); 178 dumm yTextures));
176 int numAttribs = (*effect)->numVertexAttribs(); 179 int numAttribs = (*effect)->numVertexAttribs();
177 180
178 // If adding this effect would exceed the max attrib count then gene rate a 181 // If adding this effect would exceed the max attrib count then gene rate a
179 // new random effect. 182 // new random effect.
180 if (currAttribIndex + numAttribs > GrDrawState::kMaxVertexAttribCnt) { 183 if (currAttribIndex + numAttribs > GrDrawState::kMaxVertexAttribCnt) {
181 --s;
182 continue; 184 continue;
183 } 185 }
186
187
188 // If adding this effect would exceed the max texture coord set coun t then generate a
189 // new random effect.
190 if (useFixedFunctionTexturing && !(*effect)->hasVertexCode()) {
191 int numTransforms = (*effect)->numTransforms();
192 if (currTextureCoordSet + numTransforms > this->glCaps().maxFixe dFunctionTextureCoords()) {
193 continue;
194 }
195 currTextureCoordSet += numTransforms;
196 }
197
198 useFixedFunctionTexturing = useFixedFunctionTexturing && !(*effect)- >hasVertexCode();
199
184 for (int i = 0; i < numAttribs; ++i) { 200 for (int i = 0; i < numAttribs; ++i) {
185 attribIndices[i] = currAttribIndex++; 201 attribIndices[i] = currAttribIndex++;
186 } 202 }
187 GrEffectStage* stage = SkNEW_ARGS(GrEffectStage, 203 GrEffectStage* stage = SkNEW_ARGS(GrEffectStage,
188 (effect.get(), attribIndices[0], a ttribIndices[1])); 204 (effect.get(), attribIndices[0], a ttribIndices[1]));
189 stages[s] = stage; 205 stages[s] = stage;
206 ++s;
190 } 207 }
191 const GrTexture* dstTexture = random.nextBool() ? dummyTextures[0] : dum myTextures[1]; 208 const GrTexture* dstTexture = random.nextBool() ? dummyTextures[0] : dum myTextures[1];
192 pdesc.setRandom(&random, 209 pdesc.setRandom(&random,
193 this, 210 this,
194 dummyTextures[0]->asRenderTarget(), 211 dummyTextures[0]->asRenderTarget(),
195 dstTexture, 212 dstTexture,
196 stages.get(), 213 stages.get(),
197 numColorStages, 214 numColorStages,
198 numCoverageStages, 215 numCoverageStages,
199 currAttribIndex); 216 currAttribIndex);
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 GrConfigConversionEffect::Create(NULL, 267 GrConfigConversionEffect::Create(NULL,
251 false, 268 false,
252 GrConfigConversionEffect::kNone_PMConversio n, 269 GrConfigConversionEffect::kNone_PMConversio n,
253 SkMatrix::I()); 270 SkMatrix::I());
254 SkScalar matrix[20]; 271 SkScalar matrix[20];
255 SkColorMatrixFilter cmf(matrix); 272 SkColorMatrixFilter cmf(matrix);
256 SkBitmapAlphaThresholdShader::Create(SkBitmap(), SkRegion(), 0x80); 273 SkBitmapAlphaThresholdShader::Create(SkBitmap(), SkRegion(), 0x80);
257 } 274 }
258 275
259 #endif 276 #endif
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGpuGL.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698