Index: tests/GLProgramsTest.cpp |
diff --git a/tests/GLProgramsTest.cpp b/tests/GLProgramsTest.cpp |
index 431fc29a05f2f9bbe4ebd04a772c306a71b0a406..2bb2fc4101ed781d0e452cb26ac7f857ed937b85 100644 |
--- a/tests/GLProgramsTest.cpp |
+++ b/tests/GLProgramsTest.cpp |
@@ -121,19 +121,14 @@ static GrRenderTarget* random_render_target(GrContext* context, |
return SkRef(texture->asRenderTarget()); |
} |
-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, |
@@ -301,8 +296,9 @@ bool GrDrawTarget::programUnitTest(int maxStages) { |
// twiddle drawstate knobs randomly |
bool hasGeometryProcessor = !usePathRendering; |
+ const GrGeometryProcessor* gp; |
if (hasGeometryProcessor) { |
- set_random_gp(fContext, gpu->glCaps(), &ds, &random, dummyTextures); |
+ gp = get_random_gp(fContext, gpu->glCaps(), &ds, &random, dummyTextures); |
} |
set_random_color_coverage_stages(gpu, |
&ds, |
@@ -318,18 +314,16 @@ bool GrDrawTarget::programUnitTest(int maxStages) { |
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() : |
- GrColor_WHITE; |
- if (!this->setupDstReadIfNecessary(&ds, color, coverage, &dstCopy, NULL)) { |
+ GrColor color = hasGeometryProcessor ? gp->getColor() : GrColor_WHITE; |
+ uint8_t coverage = hasGeometryProcessor ? gp->getCoverage() : GrColor_WHITE; |
+ if (!this->setupDstReadIfNecessary(&ds, gp, 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, color, coverage, *gpu->caps(), scissor, &dstCopy, drawType); |
+ GrOptDrawState ods(ds, gp, color, coverage, *gpu->caps(), scissor, &dstCopy, drawType); |
if (ods.mustSkip()) { |
continue; |
} |