| Index: tests/GLProgramsTest.cpp
|
| diff --git a/tests/GLProgramsTest.cpp b/tests/GLProgramsTest.cpp
|
| index 431fc29a05f2f9bbe4ebd04a772c306a71b0a406..97f36873f3d7e3ecd70ee951f2060468a52ab081 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,12 @@ bool GrDrawTarget::programUnitTest(int maxStages) {
|
|
|
| // twiddle drawstate knobs randomly
|
| bool hasGeometryProcessor = !usePathRendering;
|
| + const GrGeometryProcessor* gp = NULL;
|
| + const GrPathProcessor* pp = NULL;
|
| if (hasGeometryProcessor) {
|
| - set_random_gp(fContext, gpu->glCaps(), &ds, &random, dummyTextures);
|
| + gp = get_random_gp(fContext, gpu->glCaps(), &random, dummyTextures);
|
| + } else {
|
| + pp = GrPathProcessor::Create(GrColor_WHITE);
|
| }
|
| set_random_color_coverage_stages(gpu,
|
| &ds,
|
| @@ -317,19 +316,20 @@ 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)) {
|
| + const GrPrimitiveProcessor* primP;
|
| + if (hasGeometryProcessor) {
|
| + primP = gp;
|
| + } else {
|
| + primP = pp;
|
| + }
|
| + if (!this->setupDstReadIfNecessary(&ds, primP, &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, pp, *gpu->caps(), scissor, &dstCopy, drawType);
|
| if (ods.mustSkip()) {
|
| continue;
|
| }
|
|
|