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

Unified Diff: tests/GLProgramsTest.cpp

Issue 794843002: Revert of Remove GP from drawstate, revision of invariant output for GP (Closed) Base URL: https://skia.googlesource.com/skia.git@color-to-gp
Patch Set: Created 6 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/effects/GrTextureDomain.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/GLProgramsTest.cpp
diff --git a/tests/GLProgramsTest.cpp b/tests/GLProgramsTest.cpp
index c0de2a594d4fc557a3a81c9b7f6419197c135b86..953b5e07cbcc45e05dd07a25871f4bf316a3fcdc 100644
--- a/tests/GLProgramsTest.cpp
+++ b/tests/GLProgramsTest.cpp
@@ -129,14 +129,19 @@
ds->setXPFactory(xpf.get());
}
-static const GrGeometryProcessor* get_random_gp(GrContext* context,
- const GrDrawTargetCaps& caps,
- SkRandom* random,
- GrTexture* dummyTextures[]) {
- return GrProcessorTestFactory<GrGeometryProcessor>::CreateStage(random,
- context,
- caps,
- dummyTextures);
+static void set_random_gp(GrContext* context,
+ const GrDrawTargetCaps& caps,
+ GrDrawState* ds,
+ SkRandom* random,
+ GrTexture* dummyTextures[]) {
+ SkAutoTUnref<const GrGeometryProcessor> gp(
+ GrProcessorTestFactory<GrGeometryProcessor>::CreateStage(random,
+ context,
+ caps,
+ dummyTextures));
+ SkASSERT(gp);
+
+ ds->setGeometryProcessor(gp);
}
static void set_random_color_coverage_stages(GrGpuGL* gpu,
@@ -288,12 +293,8 @@
// twiddle drawstate knobs randomly
bool hasGeometryProcessor = !usePathRendering;
- const GrGeometryProcessor* gp = NULL;
- const GrPathProcessor* pathProc = NULL;
if (hasGeometryProcessor) {
- gp = get_random_gp(fContext, gpu->glCaps(), &random, dummyTextures);
- } else {
- pathProc = GrPathProcessor::Create(GrColor_WHITE);
+ set_random_gp(fContext, gpu->glCaps(), &ds, &random, dummyTextures);
}
set_random_color_coverage_stages(gpu,
&ds,
@@ -311,20 +312,19 @@
GrDeviceCoordTexture dstCopy;
- const GrPrimitiveProcessor* primProc;
- if (hasGeometryProcessor) {
- primProc = gp;
- } else {
- primProc = pathProc;
- }
- if (!this->setupDstReadIfNecessary(&ds, primProc, &dstCopy, NULL)) {
+ // TODO take color off the PP when its installed
+ GrColor color = ds.hasGeometryProcessor() ? ds.getGeometryProcessor()->getColor() :
+ GrColor_WHITE;
+ uint8_t coverage = ds.hasGeometryProcessor() ? ds.getGeometryProcessor()->getCoverage() :
+ 0xff;
+ if (!this->setupDstReadIfNecessary(&ds, color, coverage, &dstCopy, NULL)) {
SkDebugf("Couldn't setup dst read texture");
return false;
}
// create optimized draw state, setup readDst texture if required, and build a descriptor
// and program. ODS creation can fail, so we have to check
- GrOptDrawState ods(ds, gp, pathProc, *gpu->caps(), scissor, &dstCopy, drawType);
+ GrOptDrawState ods(ds, color, coverage, *gpu->caps(), scissor, &dstCopy, drawType);
if (ods.mustSkip()) {
continue;
}
« no previous file with comments | « src/gpu/effects/GrTextureDomain.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698