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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 static const int stop = -1; | 190 static const int stop = -1; |
191 if (t == stop) { | 191 if (t == stop) { |
192 int breakpointhere = 9; | 192 int breakpointhere = 9; |
193 } | 193 } |
194 #endif | 194 #endif |
195 | 195 |
196 GrGLProgramDesc pdesc; | 196 GrGLProgramDesc pdesc; |
197 | 197 |
198 int currAttribIndex = 1; // we need to always leave room for position | 198 int currAttribIndex = 1; // we need to always leave room for position |
199 int currTextureCoordSet = 0; | 199 int currTextureCoordSet = 0; |
200 int attribIndices[2] = { 0, 0 }; | |
201 GrTexture* dummyTextures[] = {dummyTexture1.get(), dummyTexture2.get()}; | 200 GrTexture* dummyTextures[] = {dummyTexture1.get(), dummyTexture2.get()}; |
202 | 201 |
203 int numStages = random.nextULessThan(maxStages + 1); | 202 int numStages = random.nextULessThan(maxStages + 1); |
204 int numColorStages = random.nextULessThan(numStages + 1); | 203 int numColorStages = random.nextULessThan(numStages + 1); |
205 int numCoverageStages = numStages - numColorStages; | 204 int numCoverageStages = numStages - numColorStages; |
206 | 205 |
207 SkAutoSTMalloc<8, const GrEffectStage*> stages(numStages); | 206 SkAutoSTMalloc<8, const GrEffectStage*> stages(numStages); |
208 | 207 |
209 bool useFixedFunctionPathRendering = this->glCaps().pathRenderingSupport
() && | 208 bool useFixedFunctionPathRendering = this->glCaps().pathRenderingSupport
() && |
210 this->glPathRendering()->texturingMode() == GrGLPathRendering::Fixed
Function_TexturingMode && | 209 this->glPathRendering()->texturingMode() == GrGLPathRendering::Fixed
Function_TexturingMode && |
211 random.nextBool(); | 210 random.nextBool(); |
212 | 211 |
213 SkAutoTDelete<GrEffectStage> geometryProcessor; | 212 SkAutoTDelete<GrEffectStage> geometryProcessor; |
214 bool hasGeometryProcessor = useFixedFunctionPathRendering ? false : rand
om.nextBool(); | 213 /*bool hasGeometryProcessor = useFixedFunctionPathRendering ? false : ra
ndom.nextBool(); |
215 if (hasGeometryProcessor) { | 214 if (hasGeometryProcessor) { |
216 while (true) { | 215 while (true) { |
217 SkAutoTUnref<const GrEffect> effect(GrEffectTestFactory::CreateS
tage( | 216 SkAutoTUnref<const GrEffect> effect(GrEffectTestFactory::CreateS
tage( |
218
&random, | 217
&random, |
219
this->getContext(), | 218
this->getContext(), |
220
*this->caps(), | 219
*this->caps(), |
221
dummyTextures)); | 220
dummyTextures)); |
222 SkASSERT(effect); | 221 SkASSERT(effect); |
223 | 222 |
224 // Only geometryProcessor can use vertex shader | 223 // Only geometryProcessor can use vertex shader |
225 if (!effect->requiresVertexShader()) { | 224 if (!effect->requiresVertexShader()) { |
226 continue; | 225 continue; |
227 } | 226 } |
228 | 227 |
229 int numAttribs = effect->numVertexAttribs(); | |
230 for (int i = 0; i < numAttribs; ++i) { | |
231 attribIndices[i] = currAttribIndex++; | |
232 } | |
233 GrEffectStage* stage = SkNEW_ARGS(GrEffectStage, | 228 GrEffectStage* stage = SkNEW_ARGS(GrEffectStage, |
234 (effect.get(), attribIndices[0
], attribIndices[1])); | 229 (effect.get())); |
235 geometryProcessor.reset(stage); | 230 geometryProcessor.reset(stage); |
236 break; | 231 break; |
237 } | 232 } |
238 } | 233 }*/ |
239 for (int s = 0; s < numStages;) { | 234 for (int s = 0; s < numStages;) { |
240 SkAutoTUnref<const GrEffect> effect(GrEffectTestFactory::CreateStage
( | 235 SkAutoTUnref<const GrEffect> effect(GrEffectTestFactory::CreateStage
( |
241 &ran
dom, | 236 &ran
dom, |
242 this
->getContext(), | 237 this
->getContext(), |
243 *thi
s->caps(), | 238 *thi
s->caps(), |
244 dumm
yTextures)); | 239 dumm
yTextures)); |
245 SkASSERT(effect); | 240 SkASSERT(effect); |
246 | 241 |
247 // Only geometryProcessor can use vertex shader | 242 // Only geometryProcessor can use vertex shader |
248 if (effect->requiresVertexShader()) { | 243 if (effect->requiresVertexShader()) { |
249 continue; | 244 continue; |
250 } | 245 } |
251 | 246 |
252 // If adding this effect would exceed the max texture coord set coun
t then generate a | 247 // If adding this effect would exceed the max texture coord set coun
t then generate a |
253 // new random effect. | 248 // new random effect. |
254 if (useFixedFunctionPathRendering) { | 249 if (useFixedFunctionPathRendering) { |
255 int numTransforms = effect->numTransforms(); | 250 int numTransforms = effect->numTransforms(); |
256 if (currTextureCoordSet + numTransforms > this->glCaps().maxFixe
dFunctionTextureCoords()) { | 251 if (currTextureCoordSet + numTransforms > this->glCaps().maxFixe
dFunctionTextureCoords()) { |
257 continue; | 252 continue; |
258 } | 253 } |
259 currTextureCoordSet += numTransforms; | 254 currTextureCoordSet += numTransforms; |
260 } | 255 } |
261 GrEffectStage* stage = SkNEW_ARGS(GrEffectStage, | 256 GrEffectStage* stage = SkNEW_ARGS(GrEffectStage, |
262 (effect.get(), attribIndices[0], a
ttribIndices[1])); | 257 (effect.get())); |
263 | 258 |
264 stages[s] = stage; | 259 stages[s] = stage; |
265 ++s; | 260 ++s; |
266 } | 261 } |
267 const GrTexture* dstTexture = random.nextBool() ? dummyTextures[0] : dum
myTextures[1]; | 262 const GrTexture* dstTexture = random.nextBool() ? dummyTextures[0] : dum
myTextures[1]; |
268 if (!pdesc.setRandom(&random, | 263 if (!pdesc.setRandom(&random, |
269 this, | 264 this, |
270 dummyTextures[0]->asRenderTarget(), | 265 dummyTextures[0]->asRenderTarget(), |
271 dstTexture, | 266 dstTexture, |
272 geometryProcessor.get(), | 267 geometryProcessor.get(), |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 SkRect::MakeWH(SK_Scalar1, SK_Scalar1), SK_Scalar1)); | 323 SkRect::MakeWH(SK_Scalar1, SK_Scalar1), SK_Scalar1)); |
329 GrConfigConversionEffect::Create(NULL, | 324 GrConfigConversionEffect::Create(NULL, |
330 false, | 325 false, |
331 GrConfigConversionEffect::kNone_PMConversio
n, | 326 GrConfigConversionEffect::kNone_PMConversio
n, |
332 SkMatrix::I()); | 327 SkMatrix::I()); |
333 SkScalar matrix[20]; | 328 SkScalar matrix[20]; |
334 SkAutoTUnref<SkColorMatrixFilter> cmf(SkColorMatrixFilter::Create(matrix)); | 329 SkAutoTUnref<SkColorMatrixFilter> cmf(SkColorMatrixFilter::Create(matrix)); |
335 } | 330 } |
336 | 331 |
337 #endif | 332 #endif |
OLD | NEW |