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

Unified Diff: tests/GLProgramsTest.cpp

Issue 791743003: Remove GP from drawstate, revision of invariant output for GP (Closed) Base URL: https://skia.googlesource.com/skia.git@color-to-gp
Patch Set: more windows fix 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 953b5e07cbcc45e05dd07a25871f4bf316a3fcdc..093c613b6f5852b7c094e65ee497b09981f9864c 100644
--- a/tests/GLProgramsTest.cpp
+++ b/tests/GLProgramsTest.cpp
@@ -129,19 +129,14 @@ static void set_random_xpf(GrContext* context, const GrDrawTargetCaps& caps, GrD
ds->setXPFactory(xpf.get());
}
-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 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_color_coverage_stages(GrGpuGL* gpu,
@@ -189,12 +184,6 @@ static void set_random_color_coverage_stages(GrGpuGL* gpu,
}
}
-static void set_random_hints(GrDrawState* ds, SkRandom* random) {
- for (int i = 1; i <= GrDrawState::kLast_Hint; i <<= 1) {
- ds->setHint(GrDrawState::Hints(i), random->nextBool());
- }
-}
-
static void set_random_state(GrDrawState* ds, SkRandom* random) {
int state = 0;
for (int i = 1; i <= GrDrawState::kLast_StateBit; i <<= 1) {
@@ -293,8 +282,12 @@ bool GrDrawTarget::programUnitTest(int maxStages) {
// twiddle drawstate knobs randomly
bool hasGeometryProcessor = !usePathRendering;
+ const GrGeometryProcessor* gp = NULL;
+ const GrPathProcessor* pathProc = NULL;
if (hasGeometryProcessor) {
- set_random_gp(fContext, gpu->glCaps(), &ds, &random, dummyTextures);
+ gp = get_random_gp(fContext, gpu->glCaps(), &random, dummyTextures);
+ } else {
+ pathProc = GrPathProcessor::Create(GrColor_WHITE);
}
set_random_color_coverage_stages(gpu,
&ds,
@@ -306,25 +299,25 @@ bool GrDrawTarget::programUnitTest(int maxStages) {
// 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_stencil(&ds, &random);
GrDeviceCoordTexture dstCopy;
- // 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)) {
+ const GrPrimitiveProcessor* primProc;
+ if (hasGeometryProcessor) {
+ primProc = gp;
+ } else {
+ primProc = pathProc;
+ }
+ if (!this->setupDstReadIfNecessary(&ds, primProc, &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, color, coverage, *gpu->caps(), scissor, &dstCopy, drawType);
+ GrOptDrawState ods(ds, gp, pathProc, *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