aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar egdaniel <egdaniel@google.com>2014-12-11 13:15:13 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2014-12-11 13:15:14 -0800
commitc230414861558ce20b74281b1ca363e56c441832 (patch)
tree8d89c3037e753a70b0979bae47d43c0804733365 /tests
parent8c508b441331d75fd84d84092a3e725d15972828 (diff)
Create xfer processor backend.
This includes: -Having an actual XP stage at the end of the gl pipeline. -All Blending work is handled by XP until actually setting GL blend states -GLPrograms test to test XP BUG=skia: Committed: https://skia.googlesource.com/skia/+/4dffc940c430eec66d4707490eace19c9b3f7904 Review URL: https://codereview.chromium.org/764643004
Diffstat (limited to 'tests')
-rw-r--r--tests/GLProgramsTest.cpp29
1 files changed, 12 insertions, 17 deletions
diff --git a/tests/GLProgramsTest.cpp b/tests/GLProgramsTest.cpp
index 253e4aeccc..953b5e07cb 100644
--- a/tests/GLProgramsTest.cpp
+++ b/tests/GLProgramsTest.cpp
@@ -121,6 +121,14 @@ static GrRenderTarget* random_render_target(GrContext* context,
return SkRef(texture->asRenderTarget());
}
+static void set_random_xpf(GrContext* context, const GrDrawTargetCaps& caps, GrDrawState* ds,
+ SkRandom* random, GrTexture* dummyTextures[]) {
+ SkAutoTUnref<const GrXPFactory> xpf(
+ GrProcessorTestFactory<GrXPFactory>::CreateStage(random, context, caps, dummyTextures));
+ SkASSERT(xpf);
+ ds->setXPFactory(xpf.get());
+}
+
static void set_random_gp(GrContext* context,
const GrDrawTargetCaps& caps,
GrDrawState* ds,
@@ -195,22 +203,6 @@ static void set_random_state(GrDrawState* ds, SkRandom* random) {
ds->enableState(state);
}
-// this function will randomly pick non-self referencing blend modes
-static void set_random_blend_func(GrDrawState* ds, SkRandom* random) {
- GrBlendCoeff src;
- do {
- src = GrBlendCoeff(random->nextRangeU(kFirstPublicGrBlendCoeff, kLastPublicGrBlendCoeff));
- } while (GrBlendCoeffRefsSrc(src));
-
- GrBlendCoeff dst;
- do {
- dst = GrBlendCoeff(random->nextRangeU(kFirstPublicGrBlendCoeff, kLastPublicGrBlendCoeff));
- } while (GrBlendCoeffRefsDst(dst));
-
- GrXPFactory* xpFactory = GrPorterDuffXPFactory::Create(src, dst);
- ds->setXPFactory(xpFactory)->unref();
-}
-
// right now, the only thing we seem to care about in drawState's stencil is 'doesWrite()'
static void set_random_stencil(GrDrawState* ds, SkRandom* random) {
GR_STATIC_CONST_SAME_STENCIL(kDoesWriteStencil,
@@ -310,9 +302,12 @@ bool GrDrawTarget::programUnitTest(int maxStages) {
usePathRendering,
&random,
dummyTextures);
+
+ // creates a random xfer processor factory on the draw state
+ set_random_xpf(fContext, gpu->glCaps(), &ds, &random, dummyTextures);
+
set_random_hints(&ds, &random);
set_random_state(&ds, &random);
- set_random_blend_func(&ds, &random);
set_random_stencil(&ds, &random);
GrDeviceCoordTexture dstCopy;