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

Side by Side Diff: tests/GLProgramsTest.cpp

Issue 1442763002: Fix GrCoverageSetOpXP unit test on mixed samples (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 1 month 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
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 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 return false; 345 return false;
346 } 346 }
347 347
348 GrPipelineBuilder pipelineBuilder; 348 GrPipelineBuilder pipelineBuilder;
349 pipelineBuilder.setRenderTarget(rt.get()); 349 pipelineBuilder.setRenderTarget(rt.get());
350 pipelineBuilder.setClip(clip); 350 pipelineBuilder.setClip(clip);
351 351
352 SkAutoTUnref<GrDrawBatch> batch(GrRandomDrawBatch(&random, context)); 352 SkAutoTUnref<GrDrawBatch> batch(GrRandomDrawBatch(&random, context));
353 SkASSERT(batch); 353 SkASSERT(batch);
354 354
355 GrProcessorTestData ptd(&random, context, context->caps(), dummyTextures ); 355 GrProcessorTestData ptd(&random, context, context->caps(), rt, dummyText ures);
356 set_random_color_coverage_stages(&pipelineBuilder, &ptd, maxStages); 356 set_random_color_coverage_stages(&pipelineBuilder, &ptd, maxStages);
357 set_random_xpf(&pipelineBuilder, &ptd); 357 set_random_xpf(&pipelineBuilder, &ptd);
358 set_random_state(&pipelineBuilder, &random); 358 set_random_state(&pipelineBuilder, &random);
359 set_random_stencil(&pipelineBuilder, &random); 359 set_random_stencil(&pipelineBuilder, &random);
360 360
361 drawTarget->drawBatch(pipelineBuilder, batch); 361 drawTarget->drawBatch(pipelineBuilder, batch);
362 } 362 }
363 // Flush everything, test passes if flush is successful(ie, no asserts are h it, no crashes) 363 // Flush everything, test passes if flush is successful(ie, no asserts are h it, no crashes)
364 drawingManager->flush(); 364 drawingManager->flush();
365 365
366 // Validate that GrFPs work correctly without an input. 366 // Validate that GrFPs work correctly without an input.
367 GrSurfaceDesc rtDesc; 367 GrSurfaceDesc rtDesc;
368 rtDesc.fWidth = kRenderTargetWidth; 368 rtDesc.fWidth = kRenderTargetWidth;
369 rtDesc.fHeight = kRenderTargetHeight; 369 rtDesc.fHeight = kRenderTargetHeight;
370 rtDesc.fFlags = kRenderTarget_GrSurfaceFlag; 370 rtDesc.fFlags = kRenderTarget_GrSurfaceFlag;
371 rtDesc.fConfig = kRGBA_8888_GrPixelConfig; 371 rtDesc.fConfig = kRGBA_8888_GrPixelConfig;
372 SkAutoTUnref<GrRenderTarget> rt( 372 SkAutoTUnref<GrRenderTarget> rt(
373 context->textureProvider()->createTexture(rtDesc, false)->asRenderTarget ()); 373 context->textureProvider()->createTexture(rtDesc, false)->asRenderTarget ());
374 int fpFactoryCnt = GrProcessorTestFactory<GrFragmentProcessor>::Count(); 374 int fpFactoryCnt = GrProcessorTestFactory<GrFragmentProcessor>::Count();
375 for (int i = 0; i < fpFactoryCnt; ++i) { 375 for (int i = 0; i < fpFactoryCnt; ++i) {
376 // Since FP factories internally randomize, call each 10 times. 376 // Since FP factories internally randomize, call each 10 times.
377 for (int j = 0; j < 10; ++j) { 377 for (int j = 0; j < 10; ++j) {
378 SkAutoTUnref<GrDrawBatch> batch(GrRandomDrawBatch(&random, context)) ; 378 SkAutoTUnref<GrDrawBatch> batch(GrRandomDrawBatch(&random, context)) ;
379 SkASSERT(batch); 379 SkASSERT(batch);
380 GrProcessorTestData ptd(&random, context, context->caps(), dummyText ures); 380 GrProcessorTestData ptd(&random, context, context->caps(), rt, dummy Textures);
381 GrPipelineBuilder builder; 381 GrPipelineBuilder builder;
382 builder.setXPFactory(GrPorterDuffXPFactory::Create(SkXfermode::kSrc_ Mode))->unref(); 382 builder.setXPFactory(GrPorterDuffXPFactory::Create(SkXfermode::kSrc_ Mode))->unref();
383 builder.setRenderTarget(rt); 383 builder.setRenderTarget(rt);
384 builder.setClip(clip); 384 builder.setClip(clip);
385 385
386 SkAutoTUnref<const GrFragmentProcessor> fp( 386 SkAutoTUnref<const GrFragmentProcessor> fp(
387 GrProcessorTestFactory<GrFragmentProcessor>::CreateIdx(i, &ptd)) ; 387 GrProcessorTestFactory<GrFragmentProcessor>::CreateIdx(i, &ptd)) ;
388 SkAutoTUnref<const GrFragmentProcessor> blockFP( 388 SkAutoTUnref<const GrFragmentProcessor> blockFP(
389 BlockInputFragmentProcessor::Create(fp)); 389 BlockInputFragmentProcessor::Create(fp));
390 builder.addColorFragmentProcessor(blockFP); 390 builder.addColorFragmentProcessor(blockFP);
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 #endif 445 #endif
446 GrTestTarget testTarget; 446 GrTestTarget testTarget;
447 context->getTestTarget(&testTarget); 447 context->getTestTarget(&testTarget);
448 REPORTER_ASSERT(reporter, GrDrawingManager::ProgramUnitTest( 448 REPORTER_ASSERT(reporter, GrDrawingManager::ProgramUnitTest(
449 context, testTarget.target(), maxSta ges)); 449 context, testTarget.target(), maxSta ges));
450 } 450 }
451 } 451 }
452 } 452 }
453 453
454 #endif 454 #endif
OLDNEW
« src/gpu/effects/GrCoverageSetOpXP.cpp ('K') | « src/gpu/effects/GrCoverageSetOpXP.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698