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 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 ds.setRenderTarget(rt.get()); | 275 ds.setRenderTarget(rt.get()); |
276 | 276 |
277 // if path rendering we have to setup a couple of things like the draw t
ype | 277 // if path rendering we have to setup a couple of things like the draw t
ype |
278 bool usePathRendering = gpu->glCaps().pathRenderingSupport() && random.n
extBool(); | 278 bool usePathRendering = gpu->glCaps().pathRenderingSupport() && random.n
extBool(); |
279 | 279 |
280 GrGpu::DrawType drawType = usePathRendering ? GrGpu::kDrawPath_DrawType
: | 280 GrGpu::DrawType drawType = usePathRendering ? GrGpu::kDrawPath_DrawType
: |
281 GrGpu::kDrawPoints_DrawTyp
e; | 281 GrGpu::kDrawPoints_DrawTyp
e; |
282 | 282 |
283 // twiddle drawstate knobs randomly | 283 // twiddle drawstate knobs randomly |
284 bool hasGeometryProcessor = !usePathRendering; | 284 bool hasGeometryProcessor = !usePathRendering; |
285 const GrGeometryProcessor* gp = NULL; | 285 SkAutoTUnref<const GrGeometryProcessor> gp; |
286 const GrPathProcessor* pathProc = NULL; | 286 SkAutoTUnref<const GrPathProcessor> pathProc; |
287 if (hasGeometryProcessor) { | 287 if (hasGeometryProcessor) { |
288 gp = get_random_gp(fContext, gpu->glCaps(), &random, dummyTextures); | 288 gp.reset(get_random_gp(fContext, gpu->glCaps(), &random, dummyTextur
es)); |
289 } else { | 289 } else { |
290 pathProc = GrPathProcessor::Create(GrColor_WHITE); | 290 pathProc.reset(GrPathProcessor::Create(GrColor_WHITE)); |
291 } | 291 } |
292 set_random_color_coverage_stages(gpu, | 292 set_random_color_coverage_stages(gpu, |
293 &ds, | 293 &ds, |
294 maxStages - hasGeometryProcessor, | 294 maxStages - hasGeometryProcessor, |
295 usePathRendering, | 295 usePathRendering, |
296 &random, | 296 &random, |
297 dummyTextures); | 297 dummyTextures); |
298 | 298 |
299 // creates a random xfer processor factory on the draw state | 299 // creates a random xfer processor factory on the draw state |
300 set_random_xpf(fContext, gpu->glCaps(), &ds, &random, dummyTextures); | 300 set_random_xpf(fContext, gpu->glCaps(), &ds, &random, dummyTextures); |
301 | 301 |
302 set_random_state(&ds, &random); | 302 set_random_state(&ds, &random); |
303 set_random_stencil(&ds, &random); | 303 set_random_stencil(&ds, &random); |
304 | 304 |
305 GrDeviceCoordTexture dstCopy; | 305 GrDeviceCoordTexture dstCopy; |
306 | 306 |
307 const GrPrimitiveProcessor* primProc; | 307 const GrPrimitiveProcessor* primProc; |
308 if (hasGeometryProcessor) { | 308 if (hasGeometryProcessor) { |
309 primProc = gp; | 309 primProc = gp.get(); |
310 } else { | 310 } else { |
311 primProc = pathProc; | 311 primProc = pathProc.get(); |
312 } | 312 } |
313 if (!this->setupDstReadIfNecessary(&ds, primProc, &dstCopy, NULL)) { | 313 if (!this->setupDstReadIfNecessary(&ds, primProc, &dstCopy, NULL)) { |
314 SkDebugf("Couldn't setup dst read texture"); | 314 SkDebugf("Couldn't setup dst read texture"); |
315 return false; | 315 return false; |
316 } | 316 } |
317 | 317 |
318 // create optimized draw state, setup readDst texture if required, and b
uild a descriptor | 318 // create optimized draw state, setup readDst texture if required, and b
uild a descriptor |
319 // and program. ODS creation can fail, so we have to check | 319 // and program. ODS creation can fail, so we have to check |
320 GrOptDrawState ods(ds, gp, pathProc, *gpu->caps(), scissor, &dstCopy, dr
awType); | 320 GrOptDrawState ods(ds, gp, pathProc, *gpu->caps(), scissor, &dstCopy, dr
awType); |
321 if (ods.mustSkip()) { | 321 if (ods.mustSkip()) { |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 } | 363 } |
364 #endif | 364 #endif |
365 GrTestTarget target; | 365 GrTestTarget target; |
366 context->getTestTarget(&target); | 366 context->getTestTarget(&target); |
367 REPORTER_ASSERT(reporter, target.target()->programUnitTest(maxStages
)); | 367 REPORTER_ASSERT(reporter, target.target()->programUnitTest(maxStages
)); |
368 } | 368 } |
369 } | 369 } |
370 } | 370 } |
371 | 371 |
372 #endif | 372 #endif |
OLD | NEW |