Fix GrCoverageSetOpXP unit test on mixed samples

Updates GrCoverageSetOpXPFactory::TestCreate to not invert coverage
with mixed samples, which is an unsupported configuration.

TBR=bsalomon@google.com

BUG=skia:4556

Review URL: https://codereview.chromium.org/1442763002
This commit is contained in:
cdalton 2015-11-12 12:11:04 -08:00 committed by Commit bot
parent 23267db678
commit c94cd7cc01
3 changed files with 8 additions and 4 deletions

View File

@ -15,6 +15,7 @@
class SkMatrix;
class GrCaps;
class GrContext;
class GrRenderTarget;
struct GrProcessorTestData;
namespace GrProcessorUnitTest {
@ -42,16 +43,19 @@ struct GrProcessorTestData {
GrProcessorTestData(SkRandom* random,
GrContext* context,
const GrCaps* caps,
const GrRenderTarget* rt,
GrTexture* textures[2])
: fRandom(random)
, fContext(context)
, fCaps(caps) {
, fCaps(caps)
, fRenderTarget(rt) {
fTextures[0] = textures[0];
fTextures[1] = textures[1];
}
SkRandom* fRandom;
GrContext* fContext;
const GrCaps* fCaps;
const GrRenderTarget* fRenderTarget;
GrTexture* fTextures[2];
};

View File

@ -247,7 +247,7 @@ GR_DEFINE_XP_FACTORY_TEST(GrCoverageSetOpXPFactory);
const GrXPFactory* GrCoverageSetOpXPFactory::TestCreate(GrProcessorTestData* d) {
SkRegion::Op regionOp = SkRegion::Op(d->fRandom->nextULessThan(SkRegion::kLastOp + 1));
bool invertCoverage = d->fRandom->nextBool();
bool invertCoverage = !d->fRenderTarget->hasMixedSamples() && d->fRandom->nextBool();
return GrCoverageSetOpXPFactory::Create(regionOp, invertCoverage);
}

View File

@ -352,7 +352,7 @@ bool GrDrawingManager::ProgramUnitTest(GrContext* context,
SkAutoTUnref<GrDrawBatch> batch(GrRandomDrawBatch(&random, context));
SkASSERT(batch);
GrProcessorTestData ptd(&random, context, context->caps(), dummyTextures);
GrProcessorTestData ptd(&random, context, context->caps(), rt, dummyTextures);
set_random_color_coverage_stages(&pipelineBuilder, &ptd, maxStages);
set_random_xpf(&pipelineBuilder, &ptd);
set_random_state(&pipelineBuilder, &random);
@ -377,7 +377,7 @@ bool GrDrawingManager::ProgramUnitTest(GrContext* context,
for (int j = 0; j < 10; ++j) {
SkAutoTUnref<GrDrawBatch> batch(GrRandomDrawBatch(&random, context));
SkASSERT(batch);
GrProcessorTestData ptd(&random, context, context->caps(), dummyTextures);
GrProcessorTestData ptd(&random, context, context->caps(), rt, dummyTextures);
GrPipelineBuilder builder;
builder.setXPFactory(GrPorterDuffXPFactory::Create(SkXfermode::kSrc_Mode))->unref();
builder.setRenderTarget(rt);