aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/GLProgramsTest.cpp
diff options
context:
space:
mode:
authorGravatar Brian Salomon <bsalomon@google.com>2017-05-12 14:09:46 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-05-12 19:08:32 +0000
commit177266339c3aa6dda4fa2912af9eaa8e8206f78f (patch)
treec3ab29e45da7b6d58a747d17b5872d3b811cb400 /tests/GLProgramsTest.cpp
parentc27321bbb5aa019ed17e56683829b9f2ac93880d (diff)
Include non-legacy GrMeshDrawOps in GLPrograms test.
Bug: skia: Change-Id: Ifa0c3ffb5643c84ccdcb339fae75ea5d03a8451c Reviewed-on: https://skia-review.googlesource.com/16580 Reviewed-by: Robert Phillips <robertphillips@google.com> Commit-Queue: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'tests/GLProgramsTest.cpp')
-rw-r--r--tests/GLProgramsTest.cpp67
1 files changed, 10 insertions, 57 deletions
diff --git a/tests/GLProgramsTest.cpp b/tests/GLProgramsTest.cpp
index 3cf28daad2..86b7469179 100644
--- a/tests/GLProgramsTest.cpp
+++ b/tests/GLProgramsTest.cpp
@@ -240,47 +240,15 @@ static void set_random_color_coverage_stages(GrPaint* paint,
}
}
-static bool set_random_state(GrPaint* paint, SkRandom* random) {
+static void set_random_state(GrPaint* paint, SkRandom* random) {
if (random->nextBool()) {
paint->setDisableOutputConversionToSRGB(true);
}
if (random->nextBool()) {
paint->setAllowSRGBInputs(true);
}
- return random->nextBool();
}
-// right now, the only thing we seem to care about in drawState's stencil is 'doesWrite()'
-static const GrUserStencilSettings* get_random_stencil(SkRandom* random, GrContext* context) {
- if (context->caps()->avoidStencilBuffers()) {
- return &GrUserStencilSettings::kUnused;
- }
-
- static constexpr GrUserStencilSettings kDoesWriteStencil(
- GrUserStencilSettings::StaticInit<
- 0xffff,
- GrUserStencilTest::kAlways,
- 0xffff,
- GrUserStencilOp::kReplace,
- GrUserStencilOp::kReplace,
- 0xffff>()
- );
- static constexpr GrUserStencilSettings kDoesNotWriteStencil(
- GrUserStencilSettings::StaticInit<
- 0xffff,
- GrUserStencilTest::kNever,
- 0xffff,
- GrUserStencilOp::kKeep,
- GrUserStencilOp::kKeep,
- 0xffff>()
- );
-
- if (random->nextBool()) {
- return &kDoesWriteStencil;
- } else {
- return &kDoesNotWriteStencil;
- }
-}
#endif
#if !GR_TEST_UTILS
@@ -327,23 +295,12 @@ bool GrDrawingManager::ProgramUnitTest(GrContext* context, int maxStages) {
return false;
}
- GrPaint grPaint;
-
- std::unique_ptr<GrLegacyMeshDrawOp> op(GrRandomDrawOp(&random, context));
- SkASSERT(op);
-
+ GrPaint paint;
GrProcessorTestData ptd(&random, context, renderTargetContext.get(), proxies);
- set_random_color_coverage_stages(&grPaint, &ptd, maxStages);
- set_random_xpf(&grPaint, &ptd);
- bool snapToCenters = set_random_state(&grPaint, &random);
- const GrUserStencilSettings* uss = get_random_stencil(&random, context);
- // We don't use kHW because we will hit an assertion if the render target is not
- // multisampled
- static constexpr GrAAType kAATypes[] = {GrAAType::kNone, GrAAType::kCoverage};
- GrAAType aaType = kAATypes[random.nextULessThan(SK_ARRAY_COUNT(kAATypes))];
-
- renderTargetContext->priv().testingOnly_addLegacyMeshDrawOp(
- std::move(grPaint), aaType, std::move(op), uss, snapToCenters);
+ set_random_color_coverage_stages(&paint, &ptd, maxStages);
+ set_random_xpf(&paint, &ptd);
+ set_random_state(&paint, &random);
+ GrDrawRandomOp(&random, renderTargetContext.get(), std::move(paint));
}
// Flush everything, test passes if flush is successful(ie, no asserts are hit, no crashes)
drawingManager->flush(nullptr);
@@ -364,20 +321,16 @@ bool GrDrawingManager::ProgramUnitTest(GrContext* context, int maxStages) {
for (int i = 0; i < fpFactoryCnt; ++i) {
// Since FP factories internally randomize, call each 10 times.
for (int j = 0; j < 10; ++j) {
- std::unique_ptr<GrLegacyMeshDrawOp> op(GrRandomDrawOp(&random, context));
- SkASSERT(op);
GrProcessorTestData ptd(&random, context, renderTargetContext.get(), proxies);
- GrPaint grPaint;
- grPaint.setXPFactory(GrPorterDuffXPFactory::Get(SkBlendMode::kSrc));
+ GrPaint paint;
+ paint.setXPFactory(GrPorterDuffXPFactory::Get(SkBlendMode::kSrc));
sk_sp<GrFragmentProcessor> fp(
GrProcessorTestFactory<GrFragmentProcessor>::MakeIdx(i, &ptd));
sk_sp<GrFragmentProcessor> blockFP(
BlockInputFragmentProcessor::Make(std::move(fp)));
- grPaint.addColorFragmentProcessor(std::move(blockFP));
-
- renderTargetContext->priv().testingOnly_addLegacyMeshDrawOp(
- std::move(grPaint), GrAAType::kNone, std::move(op));
+ paint.addColorFragmentProcessor(std::move(blockFP));
+ GrDrawRandomOp(&random, renderTargetContext.get(), std::move(paint));
drawingManager->flush(nullptr);
}
}