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 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 SkDebugf("Could not allocate render target"); | 265 SkDebugf("Could not allocate render target"); |
266 return false; | 266 return false; |
267 } | 267 } |
268 | 268 |
269 GrDrawState ds; | 269 GrDrawState ds; |
270 ds.setRenderTarget(rt.get()); | 270 ds.setRenderTarget(rt.get()); |
271 | 271 |
272 // if path rendering we have to setup a couple of things like the draw t
ype | 272 // if path rendering we have to setup a couple of things like the draw t
ype |
273 bool usePathRendering = gpu->glCaps().pathRenderingSupport() && random.n
extBool(); | 273 bool usePathRendering = gpu->glCaps().pathRenderingSupport() && random.n
extBool(); |
274 | 274 |
275 GrGpu::DrawType drawType = usePathRendering ? GrGpu::kDrawPath_DrawType
: | |
276 GrGpu::kDrawPoints_DrawTyp
e; | |
277 | |
278 // twiddle drawstate knobs randomly | 275 // twiddle drawstate knobs randomly |
279 bool hasGeometryProcessor = !usePathRendering; | 276 bool hasGeometryProcessor = !usePathRendering; |
280 SkAutoTUnref<const GrGeometryProcessor> gp; | 277 SkAutoTUnref<const GrGeometryProcessor> gp; |
281 SkAutoTUnref<const GrPathProcessor> pathProc; | 278 SkAutoTUnref<const GrPathProcessor> pathProc; |
282 if (hasGeometryProcessor) { | 279 if (hasGeometryProcessor) { |
283 gp.reset(get_random_gp(fContext, gpu->glCaps(), &random, dummyTextur
es)); | 280 gp.reset(get_random_gp(fContext, gpu->glCaps(), &random, dummyTextur
es)); |
284 } else { | 281 } else { |
285 pathProc.reset(GrPathProcessor::Create(GrColor_WHITE)); | 282 pathProc.reset(GrPathProcessor::Create(GrColor_WHITE)); |
286 } | 283 } |
287 set_random_color_coverage_stages(gpu, | 284 set_random_color_coverage_stages(gpu, |
(...skipping 25 matching lines...) Expand all Loading... |
313 // create optimized draw state, setup readDst texture if required, and b
uild a descriptor | 310 // create optimized draw state, setup readDst texture if required, and b
uild a descriptor |
314 // and program. ODS creation can fail, so we have to check | 311 // and program. ODS creation can fail, so we have to check |
315 GrOptDrawState ods(ds, primProc, *gpu->caps(), scissor, &dstCopy); | 312 GrOptDrawState ods(ds, primProc, *gpu->caps(), scissor, &dstCopy); |
316 if (ods.mustSkip()) { | 313 if (ods.mustSkip()) { |
317 continue; | 314 continue; |
318 } | 315 } |
319 GrBatchTracker bt; | 316 GrBatchTracker bt; |
320 primProc->initBatchTracker(&bt, ods.getInitBatchTracker()); | 317 primProc->initBatchTracker(&bt, ods.getInitBatchTracker()); |
321 | 318 |
322 GrProgramDesc desc; | 319 GrProgramDesc desc; |
323 gpu->buildProgramDesc(&desc, *primProc, ods, ods.descInfo(), drawType, b
t); | 320 gpu->buildProgramDesc(&desc, *primProc, ods, ods.descInfo(), bt); |
324 | 321 |
325 GrGpu::DrawArgs args(primProc, &ods, &desc, &bt, drawType); | 322 GrGpu::DrawArgs args(primProc, &ods, &desc, &bt); |
326 SkAutoTUnref<GrGLProgram> program(GrGLProgramBuilder::CreateProgram(args
, gpu)); | 323 SkAutoTUnref<GrGLProgram> program(GrGLProgramBuilder::CreateProgram(args
, gpu)); |
327 | 324 |
328 if (NULL == program.get()) { | 325 if (NULL == program.get()) { |
329 SkDebugf("Failed to create program!"); | 326 SkDebugf("Failed to create program!"); |
330 return false; | 327 return false; |
331 } | 328 } |
332 | 329 |
333 // because occasionally optimized drawstate creation will fail for valid
reasons, we only | 330 // because occasionally optimized drawstate creation will fail for valid
reasons, we only |
334 // want to increment on success | 331 // want to increment on success |
335 ++t; | 332 ++t; |
(...skipping 29 matching lines...) Expand all Loading... |
365 } | 362 } |
366 #endif | 363 #endif |
367 GrTestTarget target; | 364 GrTestTarget target; |
368 context->getTestTarget(&target); | 365 context->getTestTarget(&target); |
369 REPORTER_ASSERT(reporter, target.target()->programUnitTest(maxStages
)); | 366 REPORTER_ASSERT(reporter, target.target()->programUnitTest(maxStages
)); |
370 } | 367 } |
371 } | 368 } |
372 } | 369 } |
373 | 370 |
374 #endif | 371 #endif |
OLD | NEW |