diff options
34 files changed, 61 insertions, 149 deletions
diff --git a/gm/beziereffects.cpp b/gm/beziereffects.cpp index cfb84a5bcc..1224c1a8bb 100644 --- a/gm/beziereffects.cpp +++ b/gm/beziereffects.cpp @@ -192,7 +192,6 @@ protected: GrPipelineBuilder pipelineBuilder; pipelineBuilder.setXPFactory( GrPorterDuffXPFactory::Create(SkXfermode::kSrc_Mode))->unref(); - pipelineBuilder.setRenderTarget(drawContext->accessRenderTarget()); SkAutoTUnref<GrDrawBatch> batch( new BezierCubicOrConicTestBatch(gp, bounds, color, klmEqs, klmSigns[c])); @@ -325,7 +324,6 @@ protected: GrPipelineBuilder pipelineBuilder; pipelineBuilder.setXPFactory( GrPorterDuffXPFactory::Create(SkXfermode::kSrc_Mode))->unref(); - pipelineBuilder.setRenderTarget(drawContext->accessRenderTarget()); SkAutoTUnref<GrDrawBatch> batch( new BezierCubicOrConicTestBatch(gp, bounds, color, klmEqs, 1.f)); @@ -533,7 +531,6 @@ protected: GrPipelineBuilder pipelineBuilder; pipelineBuilder.setXPFactory( GrPorterDuffXPFactory::Create(SkXfermode::kSrc_Mode))->unref(); - pipelineBuilder.setRenderTarget(drawContext->accessRenderTarget()); GrPathUtils::QuadUVMatrix DevToUV(pts); diff --git a/gm/bigrrectaaeffect.cpp b/gm/bigrrectaaeffect.cpp index b3f39a0f2d..1036ed0dab 100644 --- a/gm/bigrrectaaeffect.cpp +++ b/gm/bigrrectaaeffect.cpp @@ -84,7 +84,6 @@ protected: SkASSERT(fp); if (fp) { pipelineBuilder.addCoverageFragmentProcessor(fp); - pipelineBuilder.setRenderTarget(drawContext->accessRenderTarget()); SkRect bounds = testBounds; bounds.offset(SkIntToScalar(x), SkIntToScalar(y)); diff --git a/gm/constcolorprocessor.cpp b/gm/constcolorprocessor.cpp index da7aa38838..57f17b2975 100644 --- a/gm/constcolorprocessor.cpp +++ b/gm/constcolorprocessor.cpp @@ -109,7 +109,6 @@ protected: GrPipelineBuilder pipelineBuilder(grPaint, drawContext->isUnifiedMultisampled()); - pipelineBuilder.setRenderTarget(drawContext->accessRenderTarget()); pipelineBuilder.addColorFragmentProcessor(fp); SkAutoTUnref<GrDrawBatch> batch( diff --git a/gm/convexpolyeffect.cpp b/gm/convexpolyeffect.cpp index 5b278020f6..13659476ba 100644 --- a/gm/convexpolyeffect.cpp +++ b/gm/convexpolyeffect.cpp @@ -182,7 +182,6 @@ protected: pipelineBuilder.setXPFactory( GrPorterDuffXPFactory::Create(SkXfermode::kSrc_Mode))->unref(); pipelineBuilder.addCoverageFragmentProcessor(fp); - pipelineBuilder.setRenderTarget(drawContext->accessRenderTarget()); SkAutoTUnref<GrDrawBatch> batch(new PolyBoundsBatch(p.getBounds(), 0xff000000)); @@ -223,7 +222,6 @@ protected: pipelineBuilder.setXPFactory( GrPorterDuffXPFactory::Create(SkXfermode::kSrc_Mode))->unref(); pipelineBuilder.addCoverageFragmentProcessor(fp); - pipelineBuilder.setRenderTarget(drawContext->accessRenderTarget()); SkAutoTUnref<GrDrawBatch> batch(new PolyBoundsBatch(rect, 0xff000000)); diff --git a/gm/rrects.cpp b/gm/rrects.cpp index 9f1c65d7e7..5f28c9e4a2 100644 --- a/gm/rrects.cpp +++ b/gm/rrects.cpp @@ -112,7 +112,6 @@ protected: rrect)); if (fp) { pipelineBuilder.addCoverageFragmentProcessor(fp); - pipelineBuilder.setRenderTarget(drawContext->accessRenderTarget()); SkRect bounds = rrect.getBounds(); bounds.outset(2.f, 2.f); diff --git a/gm/texturedomaineffect.cpp b/gm/texturedomaineffect.cpp index 6607488731..588ce97437 100644 --- a/gm/texturedomaineffect.cpp +++ b/gm/texturedomaineffect.cpp @@ -124,7 +124,6 @@ protected: continue; } const SkMatrix viewMatrix = SkMatrix::MakeTrans(x, y); - pipelineBuilder.setRenderTarget(drawContext->accessRenderTarget()); pipelineBuilder.addColorFragmentProcessor(fp); SkAutoTUnref<GrDrawBatch> batch( diff --git a/gm/yuvtorgbeffect.cpp b/gm/yuvtorgbeffect.cpp index 40a2f03f27..57e4f46bbc 100644 --- a/gm/yuvtorgbeffect.cpp +++ b/gm/yuvtorgbeffect.cpp @@ -122,7 +122,6 @@ protected: if (fp) { SkMatrix viewMatrix; viewMatrix.setTranslate(x, y); - pipelineBuilder.setRenderTarget(drawContext->accessRenderTarget()); pipelineBuilder.addColorFragmentProcessor(fp); SkAutoTUnref<GrDrawBatch> batch( GrRectBatchFactory::CreateNonAAFill(GrColor_WHITE, viewMatrix, diff --git a/include/gpu/GrDrawContext.h b/include/gpu/GrDrawContext.h index 4dd331e150..c4818e5d71 100644 --- a/include/gpu/GrDrawContext.h +++ b/include/gpu/GrDrawContext.h @@ -261,13 +261,13 @@ public: bool isStencilBufferMultisampled() const { return fRenderTarget->isStencilBufferMultisampled(); } + bool isUnifiedMultisampled() const { return fRenderTarget->isUnifiedMultisampled(); } bool hasMixedSamples() const { return fRenderTarget->hasMixedSamples(); } const GrSurfaceDesc& desc() const { return fRenderTarget->desc(); } int width() const { return fRenderTarget->width(); } int height() const { return fRenderTarget->height(); } GrPixelConfig config() const { return fRenderTarget->config(); } - bool isUnifiedMultisampled() const { return fRenderTarget->isUnifiedMultisampled(); } int numColorSamples() const { return fRenderTarget->numColorSamples(); } bool isGammaCorrect() const { return fSurfaceProps.isGammaCorrect(); } const SkSurfaceProps& surfaceProps() const { return fSurfaceProps; } @@ -298,6 +298,7 @@ protected: private: friend class GrAtlasTextBlob; // for access to drawBatch friend class GrStencilAndCoverTextContext; // for access to drawBatch + friend class GrDrawingManager; // for ctor friend class GrDrawContextPriv; friend class GrTestTarget; // for access to getDrawTarget diff --git a/src/gpu/GrDrawContext.cpp b/src/gpu/GrDrawContext.cpp index 280e6326c9..263f0c8ddd 100644 --- a/src/gpu/GrDrawContext.cpp +++ b/src/gpu/GrDrawContext.cpp @@ -241,7 +241,6 @@ void GrDrawContext::drawPaint(const GrClip& clip, GrRectBatchFactory::CreateNonAAFill(paint->getColor(), SkMatrix::I(), r, nullptr, &localMatrix)); GrPipelineBuilder pipelineBuilder(*paint, this->isUnifiedMultisampled()); - pipelineBuilder.setRenderTarget(fRenderTarget.get()); this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch); } } @@ -357,8 +356,7 @@ void GrDrawContext::drawRect(const GrClip& clip, } if (batch) { - GrPipelineBuilder pipelineBuilder(paint, this->isUnifiedMultisampled()); - pipelineBuilder.setRenderTarget(fRenderTarget.get()); + GrPipelineBuilder pipelineBuilder(paint, this->isUnifiedMultisampled()); if (snapToPixelCenters) { pipelineBuilder.setState(GrPipelineBuilder::kSnapVerticesToPixelCenters_Flag, @@ -415,7 +413,6 @@ void GrDrawContextPriv::stencilRect(const GrFixedClip& clip, SkASSERT(batch); GrPipelineBuilder pipelineBuilder(paint, fDrawContext->isUnifiedMultisampled()); - pipelineBuilder.setRenderTarget(fDrawContext->accessRenderTarget()); pipelineBuilder.setUserStencil(ss); fDrawContext->getDrawTarget()->drawBatch(pipelineBuilder, fDrawContext, clip, batch); @@ -431,7 +428,7 @@ bool GrDrawContextPriv::drawAndStencilRect(const GrFixedClip& clip, ASSERT_SINGLE_OWNER_PRIV RETURN_FALSE_IF_ABANDONED_PRIV SkDEBUGCODE(fDrawContext->validate();) - GR_AUDIT_TRAIL_AUTO_FRAME(fDrawContext->fAuditTrail, "GrDrawContext::stencilRect"); + GR_AUDIT_TRAIL_AUTO_FRAME(fDrawContext->fAuditTrail, "GrDrawContext::drawAndStencilRect"); AutoCheckFlush acf(fDrawContext->fDrawingManager); @@ -442,7 +439,6 @@ bool GrDrawContextPriv::drawAndStencilRect(const GrFixedClip& clip, SkAutoTUnref<GrDrawBatch> batch(fDrawContext->getFillRectBatch(paint, viewMatrix, rect)); if (batch) { GrPipelineBuilder pipelineBuilder(paint, fDrawContext->isUnifiedMultisampled()); - pipelineBuilder.setRenderTarget(fDrawContext->accessRenderTarget()); pipelineBuilder.setUserStencil(ss); fDrawContext->getDrawTarget()->drawBatch(pipelineBuilder, fDrawContext, clip, batch); @@ -479,7 +475,6 @@ void GrDrawContext::fillRectToRect(const GrClip& clip, if (batch) { GrPipelineBuilder pipelineBuilder(paint, this->isUnifiedMultisampled()); - pipelineBuilder.setRenderTarget(fRenderTarget.get()); this->drawBatch(pipelineBuilder, clip, batch); } } @@ -506,8 +501,7 @@ void GrDrawContext::fillRectWithLocalMatrix(const GrClip& clip, nullptr, &localMatrix)); } - GrPipelineBuilder pipelineBuilder(paint, this->isUnifiedMultisampled()); - pipelineBuilder.setRenderTarget(fRenderTarget.get()); + GrPipelineBuilder pipelineBuilder(paint, this->isUnifiedMultisampled()); this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch); } @@ -552,8 +546,7 @@ void GrDrawContext::drawVertices(const GrClip& clip, indexCount, colors, texCoords, bounds)); - GrPipelineBuilder pipelineBuilder(paint, this->isUnifiedMultisampled()); - pipelineBuilder.setRenderTarget(fRenderTarget.get()); + GrPipelineBuilder pipelineBuilder(paint, this->isUnifiedMultisampled()); this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch); } @@ -578,8 +571,7 @@ void GrDrawContext::drawAtlas(const GrClip& clip, SkAutoTUnref<GrDrawBatch> batch(GrDrawAtlasBatch::Create(geometry, viewMatrix, spriteCount, xform, texRect, colors)); - GrPipelineBuilder pipelineBuilder(paint, this->isUnifiedMultisampled()); - pipelineBuilder.setRenderTarget(fRenderTarget.get()); + GrPipelineBuilder pipelineBuilder(paint, this->isUnifiedMultisampled()); this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch); } @@ -612,8 +604,7 @@ void GrDrawContext::drawRRect(const GrClip& clip, stroke, shaderCaps)); if (batch) { - GrPipelineBuilder pipelineBuilder(paint, this->isUnifiedMultisampled()); - pipelineBuilder.setRenderTarget(fRenderTarget.get()); + GrPipelineBuilder pipelineBuilder(paint, this->isUnifiedMultisampled()); this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch); return; } @@ -738,8 +729,7 @@ void GrDrawContext::drawOval(const GrClip& clip, stroke, shaderCaps)); if (batch) { - GrPipelineBuilder pipelineBuilder(paint, this->isUnifiedMultisampled()); - pipelineBuilder.setRenderTarget(fRenderTarget.get()); + GrPipelineBuilder pipelineBuilder(paint, this->isUnifiedMultisampled()); this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch); return; } @@ -769,8 +759,7 @@ void GrDrawContext::drawImageNine(const GrClip& clip, imageWidth, imageHeight, center, dst)); - GrPipelineBuilder pipelineBuilder(paint, this->isUnifiedMultisampled()); - pipelineBuilder.setRenderTarget(fRenderTarget.get()); + GrPipelineBuilder pipelineBuilder(paint, this->isUnifiedMultisampled()); this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch); } @@ -830,8 +819,7 @@ void GrDrawContext::drawBatch(const GrClip& clip, AutoCheckFlush acf(fDrawingManager); - GrPipelineBuilder pipelineBuilder(paint, this->isUnifiedMultisampled()); - pipelineBuilder.setRenderTarget(fRenderTarget.get()); + GrPipelineBuilder pipelineBuilder(paint, this->isUnifiedMultisampled()); this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch); } @@ -863,8 +851,7 @@ void GrDrawContext::drawPath(const GrClip& clip, SkAutoTUnref<GrDrawBatch> batch(GrRectBatchFactory::CreateAAFillNestedRects( paint.getColor(), viewMatrix, rects)); if (batch) { - GrPipelineBuilder pipelineBuilder(paint, this->isUnifiedMultisampled()); - pipelineBuilder.setRenderTarget(fRenderTarget.get()); + GrPipelineBuilder pipelineBuilder(paint, this->isUnifiedMultisampled()); this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch); } return; @@ -881,8 +868,7 @@ void GrDrawContext::drawPath(const GrClip& clip, style.strokeRec(), shaderCaps)); if (batch) { - GrPipelineBuilder pipelineBuilder(paint, this->isUnifiedMultisampled()); - pipelineBuilder.setRenderTarget(fRenderTarget.get()); + GrPipelineBuilder pipelineBuilder(paint, this->isUnifiedMultisampled()); this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch); return; } diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp index 6bbcc74b3d..ac0c766704 100644 --- a/src/gpu/GrDrawTarget.cpp +++ b/src/gpu/GrDrawTarget.cpp @@ -130,6 +130,7 @@ void GrDrawTarget::dump() const { #endif bool GrDrawTarget::setupDstReadIfNecessary(const GrPipelineBuilder& pipelineBuilder, + GrRenderTarget* rt, const GrClip& clip, const GrPipelineOptimizations& optimizations, GrXferProcessor::DstTexture* dstTexture, @@ -141,8 +142,6 @@ bool GrDrawTarget::setupDstReadIfNecessary(const GrPipelineBuilder& pipelineBuil return true; } - GrRenderTarget* rt = pipelineBuilder.getRenderTarget(); - if (this->caps()->textureBarrierSupport()) { if (GrTexture* rtTex = rt->asTexture()) { // The render target is a texture, so we can read from it directly in the shader. The XP @@ -244,6 +243,7 @@ void GrDrawTarget::drawBatch(const GrPipelineBuilder& pipelineBuilder, return; } + // TODO: this is the only remaining usage of the AutoRestoreFragmentProcessorState - remove it GrPipelineBuilder::AutoRestoreFragmentProcessorState arfps; if (appliedClip.clipCoverageFragmentProcessor()) { arfps.set(&pipelineBuilder); @@ -252,11 +252,12 @@ void GrDrawTarget::drawBatch(const GrPipelineBuilder& pipelineBuilder, GrPipeline::CreateArgs args; args.fPipelineBuilder = &pipelineBuilder; + args.fDrawContext = drawContext; args.fCaps = this->caps(); args.fScissor = &appliedClip.scissorState(); args.fHasStencilClip = appliedClip.hasStencilClip(); if (pipelineBuilder.hasUserStencilSettings() || appliedClip.hasStencilClip()) { - if (!fResourceProvider->attachStencilAttachment(pipelineBuilder.getRenderTarget())) { + if (!fResourceProvider->attachStencilAttachment(drawContext->accessRenderTarget())) { SkDebugf("ERROR creating stencil attachment. Draw skipped.\n"); return; } @@ -264,12 +265,11 @@ void GrDrawTarget::drawBatch(const GrPipelineBuilder& pipelineBuilder, batch->getPipelineOptimizations(&args.fOpts); GrScissorState finalScissor; if (args.fOpts.fOverrides.fUsePLSDstRead || fClipBatchToBounds) { - GrRenderTarget* rt = pipelineBuilder.getRenderTarget(); GrGLIRect viewport; viewport.fLeft = 0; viewport.fBottom = 0; - viewport.fWidth = rt->width(); - viewport.fHeight = rt->height(); + viewport.fWidth = drawContext->width(); + viewport.fHeight = drawContext->height(); SkIRect ibounds; ibounds.fLeft = SkTPin(SkScalarFloorToInt(batch->bounds().fLeft), viewport.fLeft, viewport.fWidth); @@ -293,8 +293,9 @@ void GrDrawTarget::drawBatch(const GrPipelineBuilder& pipelineBuilder, args.fOpts.fCoveragePOI.completeCalculations( pipelineBuilder.fCoverageFragmentProcessors.begin(), pipelineBuilder.numCoverageFragmentProcessors()); - if (!this->setupDstReadIfNecessary(pipelineBuilder, clip, args.fOpts, &args.fDstTexture, - batch->bounds())) { + if (!this->setupDstReadIfNecessary(pipelineBuilder, drawContext->accessRenderTarget(), + clip, args.fOpts, + &args.fDstTexture, batch->bounds())) { return; } @@ -331,8 +332,8 @@ void GrDrawTarget::stencilPath(const GrPipelineBuilder& pipelineBuilder, // attempt this in a situation that would require coverage AA. SkASSERT(!appliedClip.clipCoverageFragmentProcessor()); - GrRenderTarget* rt = pipelineBuilder.getRenderTarget(); - GrStencilAttachment* stencilAttachment = fResourceProvider->attachStencilAttachment(rt); + GrStencilAttachment* stencilAttachment = fResourceProvider->attachStencilAttachment( + drawContext->accessRenderTarget()); if (!stencilAttachment) { SkDebugf("ERROR creating stencil attachment. Draw skipped.\n"); return; @@ -344,7 +345,7 @@ void GrDrawTarget::stencilPath(const GrPipelineBuilder& pipelineBuilder, appliedClip.hasStencilClip(), stencilAttachment->bits(), appliedClip.scissorState(), - pipelineBuilder.getRenderTarget(), + drawContext->accessRenderTarget(), path); this->recordBatch(batch); batch->unref(); @@ -376,10 +377,10 @@ void GrDrawTarget::clear(const SkIRect* rect, drawContext->discard(); } + // TODO: flip this into real draw! GrPipelineBuilder pipelineBuilder; pipelineBuilder.setXPFactory( GrPorterDuffXPFactory::Create(SkXfermode::kSrc_Mode))->unref(); - pipelineBuilder.setRenderTarget(drawContext->accessRenderTarget()); SkRect scalarRect = SkRect::Make(*rect); SkAutoTUnref<GrDrawBatch> batch( diff --git a/src/gpu/GrDrawTarget.h b/src/gpu/GrDrawTarget.h index 627472f896..d43a930d1b 100644 --- a/src/gpu/GrDrawTarget.h +++ b/src/gpu/GrDrawTarget.h @@ -117,9 +117,9 @@ public: const GrPath*, GrPathRendering::FillType); /** - * Clear the passed in render target. Ignores the GrPipelineBuilder and clip. Clears the whole + * Clear the passed in drawContext. Ignores the GrPipelineBuilder and clip. Clears the whole * thing if rect is nullptr, otherwise just the rect. If canIgnoreRect is set then the entire - * render target can be optionally cleared. + * drawContext can be optionally cleared. */ void clear(const SkIRect* rect, GrColor color, @@ -144,26 +144,6 @@ public: const SkIRect& srcRect, const SkIPoint& dstPoint); - /** Provides access to internal functions to GrClipMaskManager without friending all of - GrDrawTarget to CMM. */ - class CMMAccess { - public: - CMMAccess(GrDrawTarget* drawTarget) : fDrawTarget(drawTarget) {} - private: - void clearStencilClip(const SkIRect& rect, bool insideClip, GrRenderTarget* rt) const { - fDrawTarget->clearStencilClip(rect, insideClip, rt); - } - - GrContext* context() const { return fDrawTarget->fContext; } - GrResourceProvider* resourceProvider() const { return fDrawTarget->fResourceProvider; } - GrDrawTarget* fDrawTarget; - friend class GrClipMaskManager; - }; - - const CMMAccess cmmAccess() { return CMMAccess(this); } - - GrAuditTrail* getAuditTrail() const { return fAuditTrail; } - private: friend class GrDrawingManager; // for resetFlag & TopoSortTraits friend class GrDrawContextPriv; // for clearStencilClip @@ -218,14 +198,15 @@ private: // but couldn't be made. Otherwise, returns true. This method needs to be protected because it // needs to be accessed by GLPrograms to setup a correct drawstate bool setupDstReadIfNecessary(const GrPipelineBuilder&, - const GrClip&, - const GrPipelineOptimizations& optimizations, - GrXferProcessor::DstTexture*, - const SkRect& batchBounds); + GrRenderTarget*, + const GrClip&, + const GrPipelineOptimizations& optimizations, + GrXferProcessor::DstTexture*, + const SkRect& batchBounds); void addDependency(GrDrawTarget* dependedOn); - // Used only by CMM. + // Used only by drawContextPriv. void clearStencilClip(const SkIRect&, bool insideClip, GrRenderTarget*); SkSTArray<256, SkAutoTUnref<GrBatch>, true> fBatches; diff --git a/src/gpu/GrPipeline.cpp b/src/gpu/GrPipeline.cpp index d52e811df0..20089a6a4c 100644 --- a/src/gpu/GrPipeline.cpp +++ b/src/gpu/GrPipeline.cpp @@ -8,6 +8,7 @@ #include "GrPipeline.h" #include "GrCaps.h" +#include "GrDrawContext.h" #include "GrDrawTarget.h" #include "GrGpu.h" #include "GrPipelineBuilder.h" @@ -22,11 +23,12 @@ GrPipeline* GrPipeline::CreateAt(void* memory, const CreateArgs& args, const GrPipelineBuilder& builder = *args.fPipelineBuilder; GrPipeline* pipeline = new (memory) GrPipeline; - pipeline->fRenderTarget.reset(builder.fRenderTarget.get()); + GrRenderTarget* rt = args.fDrawContext->accessRenderTarget(); + pipeline->fRenderTarget.reset(rt); SkASSERT(pipeline->fRenderTarget); pipeline->fScissorState = *args.fScissor; if (builder.hasUserStencilSettings() || args.fHasStencilClip) { - const GrRenderTargetPriv& rtPriv = builder.getRenderTarget()->renderTargetPriv(); + const GrRenderTargetPriv& rtPriv = rt->renderTargetPriv(); pipeline->fStencilSettings.reset(*builder.getUserStencil(), args.fHasStencilClip, rtPriv.numStencilBits()); SkASSERT(!pipeline->fStencilSettings.usesWrapOp() || args.fCaps->stencilWrapOpsSupport()); @@ -51,7 +53,7 @@ GrPipeline* GrPipeline::CreateAt(void* memory, const CreateArgs& args, } // Create XferProcessor from DS's XPFactory - bool hasMixedSamples = builder.getRenderTarget()->hasMixedSamples() && + bool hasMixedSamples = args.fDrawContext->hasMixedSamples() && (builder.isHWAntialias() || !pipeline->fStencilSettings.isDisabled()); const GrXPFactory* xpFactory = builder.getXPFactory(); SkAutoTUnref<GrXferProcessor> xferProcessor; diff --git a/src/gpu/GrPipeline.h b/src/gpu/GrPipeline.h index 60e163101a..3fd70a3830 100644 --- a/src/gpu/GrPipeline.h +++ b/src/gpu/GrPipeline.h @@ -21,6 +21,7 @@ #include "SkRefCnt.h" class GrBatch; +class GrDrawContext; class GrDeviceCoordTexture; class GrPipelineBuilder; @@ -48,6 +49,7 @@ public: struct CreateArgs { const GrPipelineBuilder* fPipelineBuilder; + GrDrawContext* fDrawContext; const GrCaps* fCaps; GrPipelineOptimizations fOpts; const GrScissorState* fScissor; diff --git a/src/gpu/GrPipelineBuilder.h b/src/gpu/GrPipelineBuilder.h index 11b427b71b..68e70ac6b9 100644 --- a/src/gpu/GrPipelineBuilder.h +++ b/src/gpu/GrPipelineBuilder.h @@ -31,7 +31,7 @@ public: GrPipelineBuilder(); /** - * Initializes the GrPipelineBuilder based on a GrPaint, MSAA availability. Note + * Initializes the GrPipelineBuilder based on a GrPaint and MSAA availability. Note * that GrPipelineBuilder encompasses more than GrPaint. Aspects of GrPipelineBuilder that have * no GrPaint equivalents are set to default values with the exception of vertex attribute state * which is unmodified by this function and clipping which will be enabled. @@ -175,26 +175,6 @@ public: /////////////////////////////////////////////////////////////////////////// - /// @name Render Target - //// - - /** - * Retrieves the currently set render-target. - * - * @return The currently set render target. - */ - GrRenderTarget* getRenderTarget() const { return fRenderTarget.get(); } - - /** - * Sets the render-target used at the next drawing call - * - * @param target The render target to set. - */ - void setRenderTarget(GrRenderTarget* target) { fRenderTarget.reset(SkSafeRef(target)); } - - /// @} - - /////////////////////////////////////////////////////////////////////////// /// @name Stencil //// @@ -326,7 +306,6 @@ private: typedef SkSTArray<4, const GrFragmentProcessor*, true> FragmentProcessorArray; - SkAutoTUnref<GrRenderTarget> fRenderTarget; uint32_t fFlags; const GrUserStencilSettings* fUserStencilSettings; DrawFace fDrawFace; diff --git a/src/gpu/GrSWMaskHelper.cpp b/src/gpu/GrSWMaskHelper.cpp index 6e99f07bc8..a0ab7add3e 100644 --- a/src/gpu/GrSWMaskHelper.cpp +++ b/src/gpu/GrSWMaskHelper.cpp @@ -186,7 +186,6 @@ void GrSWMaskHelper::DrawToTargetWithPathMask(GrTexture* texture, maskMatrix.preTranslate(SkIntToScalar(-rect.fLeft), SkIntToScalar(-rect.fTop)); GrPipelineBuilder pipelineBuilder(*paint, drawContext->isUnifiedMultisampled()); - pipelineBuilder.setRenderTarget(drawContext->accessRenderTarget()); pipelineBuilder.setUserStencil(userStencilSettings); pipelineBuilder.addCoverageFragmentProcessor( diff --git a/src/gpu/GrSoftwarePathRenderer.cpp b/src/gpu/GrSoftwarePathRenderer.cpp index dc0c6c07af..4bc592d3a6 100644 --- a/src/gpu/GrSoftwarePathRenderer.cpp +++ b/src/gpu/GrSoftwarePathRenderer.cpp @@ -71,7 +71,6 @@ void GrSoftwarePathRenderer::DrawNonAARect(GrDrawContext* drawContext, nullptr, &localMatrix)); GrPipelineBuilder pipelineBuilder(*paint, drawContext->isUnifiedMultisampled()); - pipelineBuilder.setRenderTarget(drawContext->accessRenderTarget()); pipelineBuilder.setUserStencil(userStencilSettings); drawContext->drawBatch(pipelineBuilder, clip, batch); diff --git a/src/gpu/GrStencilAttachment.h b/src/gpu/GrStencilAttachment.h index 5b7ae63750..7573d23d1d 100644 --- a/src/gpu/GrStencilAttachment.h +++ b/src/gpu/GrStencilAttachment.h @@ -52,8 +52,7 @@ public: GrUniqueKey* key); protected: - GrStencilAttachment(GrGpu* gpu, int width, int height, int bits, - int sampleCnt) + GrStencilAttachment(GrGpu* gpu, int width, int height, int bits, int sampleCnt) : GrGpuResource(gpu) , fWidth(width) , fHeight(height) diff --git a/src/gpu/batches/GrAAConvexPathRenderer.cpp b/src/gpu/batches/GrAAConvexPathRenderer.cpp index 191c0810d0..ef6c0ae659 100644 --- a/src/gpu/batches/GrAAConvexPathRenderer.cpp +++ b/src/gpu/batches/GrAAConvexPathRenderer.cpp @@ -1009,7 +1009,6 @@ bool GrAAConvexPathRenderer::onDrawPath(const DrawPathArgs& args) { SkAutoTUnref<GrDrawBatch> batch(AAConvexPathBatch::Create(geometry)); GrPipelineBuilder pipelineBuilder(*args.fPaint, args.fDrawContext->isUnifiedMultisampled()); - pipelineBuilder.setRenderTarget(args.fDrawContext->accessRenderTarget()); pipelineBuilder.setUserStencil(args.fUserStencilSettings); args.fDrawContext->drawBatch(pipelineBuilder, *args.fClip, batch); diff --git a/src/gpu/batches/GrAADistanceFieldPathRenderer.cpp b/src/gpu/batches/GrAADistanceFieldPathRenderer.cpp index e506e53072..9a5eada4b4 100644 --- a/src/gpu/batches/GrAADistanceFieldPathRenderer.cpp +++ b/src/gpu/batches/GrAADistanceFieldPathRenderer.cpp @@ -566,7 +566,6 @@ bool GrAADistanceFieldPathRenderer::onDrawPath(const DrawPathArgs& args) { args.fGammaCorrect)); GrPipelineBuilder pipelineBuilder(*args.fPaint, args.fDrawContext->isUnifiedMultisampled()); - pipelineBuilder.setRenderTarget(args.fDrawContext->accessRenderTarget()); pipelineBuilder.setUserStencil(args.fUserStencilSettings); args.fDrawContext->drawBatch(pipelineBuilder, *args.fClip, batch); diff --git a/src/gpu/batches/GrAAHairLinePathRenderer.cpp b/src/gpu/batches/GrAAHairLinePathRenderer.cpp index a163138235..750c1f1304 100644 --- a/src/gpu/batches/GrAAHairLinePathRenderer.cpp +++ b/src/gpu/batches/GrAAHairLinePathRenderer.cpp @@ -974,7 +974,6 @@ bool GrAAHairLinePathRenderer::onDrawPath(const DrawPathArgs& args) { GrPipelineBuilder pipelineBuilder(*args.fPaint, args.fDrawContext->isStencilBufferMultisampled()); - pipelineBuilder.setRenderTarget(args.fDrawContext->accessRenderTarget()); pipelineBuilder.setUserStencil(args.fUserStencilSettings); args.fDrawContext->drawBatch(pipelineBuilder, *args.fClip, batch); diff --git a/src/gpu/batches/GrAALinearizingConvexPathRenderer.cpp b/src/gpu/batches/GrAALinearizingConvexPathRenderer.cpp index ee5a7af4fa..a3e00d1b7a 100644 --- a/src/gpu/batches/GrAALinearizingConvexPathRenderer.cpp +++ b/src/gpu/batches/GrAALinearizingConvexPathRenderer.cpp @@ -337,7 +337,6 @@ bool GrAALinearizingConvexPathRenderer::onDrawPath(const DrawPathArgs& args) { SkAutoTUnref<GrDrawBatch> batch(AAFlatteningConvexPathBatch::Create(geometry)); GrPipelineBuilder pipelineBuilder(*args.fPaint, args.fDrawContext->isUnifiedMultisampled()); - pipelineBuilder.setRenderTarget(args.fDrawContext->accessRenderTarget()); pipelineBuilder.setUserStencil(args.fUserStencilSettings); args.fDrawContext->drawBatch(pipelineBuilder, *args.fClip, batch); diff --git a/src/gpu/batches/GrDashLinePathRenderer.cpp b/src/gpu/batches/GrDashLinePathRenderer.cpp index 1763f95116..6a054589be 100644 --- a/src/gpu/batches/GrDashLinePathRenderer.cpp +++ b/src/gpu/batches/GrDashLinePathRenderer.cpp @@ -36,7 +36,6 @@ bool GrDashLinePathRenderer::onDrawPath(const DrawPathArgs& args) { } GrPipelineBuilder pipelineBuilder(*args.fPaint, msaaIsEnabled); - pipelineBuilder.setRenderTarget(args.fDrawContext->accessRenderTarget()); pipelineBuilder.setUserStencil(args.fUserStencilSettings); args.fDrawContext->drawBatch(pipelineBuilder, *args.fClip, batch); diff --git a/src/gpu/batches/GrDefaultPathRenderer.cpp b/src/gpu/batches/GrDefaultPathRenderer.cpp index 1bcfc2d8b6..bab39ee7e8 100644 --- a/src/gpu/batches/GrDefaultPathRenderer.cpp +++ b/src/gpu/batches/GrDefaultPathRenderer.cpp @@ -563,7 +563,6 @@ bool GrDefaultPathRenderer::internalDrawPath(GrDrawContext* drawContext, &localMatrix)); GrPipelineBuilder pipelineBuilder(paint, drawContext->isUnifiedMultisampled()); - pipelineBuilder.setRenderTarget(drawContext->accessRenderTarget()); pipelineBuilder.setDrawFace(drawFace[p]); if (passes[p]) { pipelineBuilder.setUserStencil(passes[p]); @@ -583,7 +582,6 @@ bool GrDefaultPathRenderer::internalDrawPath(GrDrawContext* drawContext, devBounds)); GrPipelineBuilder pipelineBuilder(paint, drawContext->isUnifiedMultisampled()); - pipelineBuilder.setRenderTarget(drawContext->accessRenderTarget()); pipelineBuilder.setDrawFace(drawFace[p]); if (passes[p]) { pipelineBuilder.setUserStencil(passes[p]); diff --git a/src/gpu/batches/GrMSAAPathRenderer.cpp b/src/gpu/batches/GrMSAAPathRenderer.cpp index 2983f58055..45971f568d 100644 --- a/src/gpu/batches/GrMSAAPathRenderer.cpp +++ b/src/gpu/batches/GrMSAAPathRenderer.cpp @@ -668,7 +668,6 @@ bool GrMSAAPathRenderer::internalDrawPath(GrDrawContext* drawContext, &localMatrix)); GrPipelineBuilder pipelineBuilder(paint, drawContext->isUnifiedMultisampled()); - pipelineBuilder.setRenderTarget(drawContext->accessRenderTarget()); pipelineBuilder.setDrawFace(drawFace[p]); if (passes[p]) { pipelineBuilder.setUserStencil(passes[p]); @@ -690,7 +689,6 @@ bool GrMSAAPathRenderer::internalDrawPath(GrDrawContext* drawContext, } GrPipelineBuilder pipelineBuilder(paint, drawContext->isUnifiedMultisampled()); - pipelineBuilder.setRenderTarget(drawContext->accessRenderTarget()); pipelineBuilder.setDrawFace(drawFace[p]); if (passes[p]) { pipelineBuilder.setUserStencil(passes[p]); diff --git a/src/gpu/batches/GrPLSPathRenderer.cpp b/src/gpu/batches/GrPLSPathRenderer.cpp index e84bd4d901..79da83c652 100644 --- a/src/gpu/batches/GrPLSPathRenderer.cpp +++ b/src/gpu/batches/GrPLSPathRenderer.cpp @@ -987,7 +987,6 @@ bool GrPLSPathRenderer::onDrawPath(const DrawPathArgs& args) { SkAutoTUnref<GrDrawBatch> batch(PLSPathBatch::Create(geometry)); GrPipelineBuilder pipelineBuilder(*args.fPaint, args.fDrawContext->isUnifiedMultisampled()); - pipelineBuilder.setRenderTarget(args.fDrawContext->accessRenderTarget()); pipelineBuilder.setUserStencil(args.fUserStencilSettings); args.fDrawContext->drawBatch(pipelineBuilder, *args.fClip, batch); diff --git a/src/gpu/batches/GrStencilAndCoverPathRenderer.cpp b/src/gpu/batches/GrStencilAndCoverPathRenderer.cpp index 314e6c2649..296343da7a 100644 --- a/src/gpu/batches/GrStencilAndCoverPathRenderer.cpp +++ b/src/gpu/batches/GrStencilAndCoverPathRenderer.cpp @@ -74,8 +74,7 @@ void GrStencilAndCoverPathRenderer::onStencilPath(const StencilPathArgs& args) { SkSafeUnref(paint.setXPFactory(GrDisableColorXPFactory::Create())); paint.setAntiAlias(args.fIsAA); - GrPipelineBuilder pipelineBuilder(paint, args.fDrawContext->isUnifiedMultisampled()); - pipelineBuilder.setRenderTarget(args.fDrawContext->accessRenderTarget()); + const GrPipelineBuilder pipelineBuilder(paint, args.fDrawContext->isUnifiedMultisampled()); SkASSERT(!args.fPath->isInverseFillType()); SkAutoTUnref<GrPath> path(get_gr_path(fResourceProvider, *args.fPath, GrStyle::SimpleFill())); @@ -113,7 +112,6 @@ bool GrStencilAndCoverPathRenderer::onDrawPath(const DrawPathArgs& args) { { GrPipelineBuilder pipelineBuilder(*args.fPaint, args.fDrawContext->isUnifiedMultisampled()); - pipelineBuilder.setRenderTarget(args.fDrawContext->accessRenderTarget()); pipelineBuilder.setUserStencil(&kInvertedCoverPass); if (args.fAntiAlias) { SkASSERT(args.fDrawContext->isStencilBufferMultisampled()); @@ -151,7 +149,6 @@ bool GrStencilAndCoverPathRenderer::onDrawPath(const DrawPathArgs& args) { { GrPipelineBuilder pipelineBuilder(*args.fPaint, args.fDrawContext->isUnifiedMultisampled()); - pipelineBuilder.setRenderTarget(args.fDrawContext->accessRenderTarget()); pipelineBuilder.setUserStencil(&kInvertedCoverPass); if (args.fAntiAlias) { SkASSERT(args.fDrawContext->isStencilBufferMultisampled()); @@ -179,7 +176,6 @@ bool GrStencilAndCoverPathRenderer::onDrawPath(const DrawPathArgs& args) { GrPipelineBuilder pipelineBuilder(*args.fPaint, args.fDrawContext->isUnifiedMultisampled()); - pipelineBuilder.setRenderTarget(args.fDrawContext->accessRenderTarget()); pipelineBuilder.setUserStencil(&kCoverPass); if (args.fAntiAlias) { SkASSERT(args.fDrawContext->isStencilBufferMultisampled()); diff --git a/src/gpu/batches/GrTessellatingPathRenderer.cpp b/src/gpu/batches/GrTessellatingPathRenderer.cpp index e02543505c..6d0525075c 100644 --- a/src/gpu/batches/GrTessellatingPathRenderer.cpp +++ b/src/gpu/batches/GrTessellatingPathRenderer.cpp @@ -298,7 +298,6 @@ bool GrTessellatingPathRenderer::onDrawPath(const DrawPathArgs& args) { clipBounds)); GrPipelineBuilder pipelineBuilder(*args.fPaint, args.fDrawContext->isUnifiedMultisampled()); - pipelineBuilder.setRenderTarget(args.fDrawContext->accessRenderTarget()); pipelineBuilder.setUserStencil(args.fUserStencilSettings); args.fDrawContext->drawBatch(pipelineBuilder, *args.fClip, batch); diff --git a/src/gpu/text/GrAtlasTextBlob.cpp b/src/gpu/text/GrAtlasTextBlob.cpp index 72193dc9f3..e4fa34973c 100644 --- a/src/gpu/text/GrAtlasTextBlob.cpp +++ b/src/gpu/text/GrAtlasTextBlob.cpp @@ -419,8 +419,7 @@ void GrAtlasTextBlob::flushCached(GrContext* context, SkScalar x, SkScalar y) { // We loop through the runs of the blob, flushing each. If any run is too large, then we flush // it as paths - GrPipelineBuilder pipelineBuilder(grPaint, dc->isUnifiedMultisampled()); - pipelineBuilder.setRenderTarget(dc->accessRenderTarget()); + GrPipelineBuilder pipelineBuilder(grPaint, dc->isUnifiedMultisampled()); GrColor color = grPaint.getColor(); @@ -449,8 +448,7 @@ void GrAtlasTextBlob::flushThrowaway(GrContext* context, const SkMatrix& viewMatrix, const SkIRect& clipBounds, SkScalar x, SkScalar y) { - GrPipelineBuilder pipelineBuilder(grPaint, dc->isUnifiedMultisampled()); - pipelineBuilder.setRenderTarget(dc->accessRenderTarget()); + GrPipelineBuilder pipelineBuilder(grPaint, dc->isUnifiedMultisampled()); GrColor color = grPaint.getColor(); for (int run = 0; run < fRunCount; run++) { diff --git a/src/gpu/text/GrAtlasTextContext.h b/src/gpu/text/GrAtlasTextContext.h index 928ce0abed..5bf7662c48 100644 --- a/src/gpu/text/GrAtlasTextContext.h +++ b/src/gpu/text/GrAtlasTextContext.h @@ -19,7 +19,6 @@ class GrDrawBatch; class GrDrawContext; -class GrDrawTarget; class GrPipelineBuilder; class GrTextBlobCache; class SkGlyph; diff --git a/src/gpu/text/GrStencilAndCoverTextContext.cpp b/src/gpu/text/GrStencilAndCoverTextContext.cpp index 00ec451bb1..5673c39346 100644 --- a/src/gpu/text/GrStencilAndCoverTextContext.cpp +++ b/src/gpu/text/GrStencilAndCoverTextContext.cpp @@ -82,8 +82,7 @@ void GrStencilAndCoverTextContext::drawText(GrContext* context, GrDrawContext* d } else if (this->canDraw(skPaint, viewMatrix)) { if (skPaint.getTextSize() > 0) { TextRun run(skPaint); - GrPipelineBuilder pipelineBuilder(paint, dc->isUnifiedMultisampled()); - pipelineBuilder.setRenderTarget(dc->accessRenderTarget()); + GrPipelineBuilder pipelineBuilder(paint, dc->isUnifiedMultisampled()); run.setText(text, byteLength, x, y); run.draw(context, dc, &pipelineBuilder, clip, paint.getColor(), viewMatrix, props, 0, 0, clipBounds, fFallbackTextContext, skPaint); @@ -118,8 +117,7 @@ void GrStencilAndCoverTextContext::drawPosText(GrContext* context, GrDrawContext } else if (this->canDraw(skPaint, viewMatrix)) { if (skPaint.getTextSize() > 0) { TextRun run(skPaint); - GrPipelineBuilder pipelineBuilder(paint, dc->isUnifiedMultisampled()); - pipelineBuilder.setRenderTarget(dc->accessRenderTarget()); + GrPipelineBuilder pipelineBuilder(paint, dc->isUnifiedMultisampled()); run.setPosText(text, byteLength, pos, scalarsPerPosition, offset); run.draw(context, dc, &pipelineBuilder, clip, paint.getColor(), viewMatrix, props, 0, 0, clipBounds, fFallbackTextContext, skPaint); @@ -227,8 +225,7 @@ void GrStencilAndCoverTextContext::drawTextBlob(GrContext* context, GrDrawContex } const TextBlob& blob = this->findOrCreateTextBlob(skBlob, skPaint); - GrPipelineBuilder pipelineBuilder(paint, dc->isUnifiedMultisampled()); - pipelineBuilder.setRenderTarget(dc->accessRenderTarget()); + GrPipelineBuilder pipelineBuilder(paint, dc->isUnifiedMultisampled()); TextBlob::Iter iter(blob); for (TextRun* run = iter.get(); run; run = iter.next()) { @@ -598,7 +595,7 @@ inline void GrStencilAndCoverTextContext::TextRun::appendGlyph(const SkGlyph& gl } void GrStencilAndCoverTextContext::TextRun::draw(GrContext* ctx, - GrDrawContext* dc, + GrDrawContext* drawContext, GrPipelineBuilder* pipelineBuilder, const GrClip& clip, GrColor color, @@ -609,7 +606,7 @@ void GrStencilAndCoverTextContext::TextRun::draw(GrContext* ctx, GrAtlasTextContext* fallbackTextContext, const SkPaint& originalSkPaint) const { SkASSERT(fInstanceData); - SkASSERT(dc->accessRenderTarget()->isStencilBufferMultisampled() || !fFont.isAntiAlias()); + SkASSERT(drawContext->isStencilBufferMultisampled() || !fFont.isAntiAlias()); if (fInstanceData->count()) { pipelineBuilder->setState(GrPipelineBuilder::kHWAntialias_Flag, fFont.isAntiAlias()); @@ -638,8 +635,7 @@ void GrStencilAndCoverTextContext::TextRun::draw(GrContext* ctx, // NV_path_rendering will also support NV_blend_equation_advanced. // For clipping we'll just skip any optimizations based on the bounds. This does, however, // hurt batching. - SkRect bounds = SkRect::MakeIWH(pipelineBuilder->getRenderTarget()->width(), - pipelineBuilder->getRenderTarget()->height()); + const SkRect bounds = SkRect::MakeIWH(drawContext->width(), drawContext->height()); SkAutoTUnref<GrDrawBatch> batch( GrDrawPathRangeBatch::Create(viewMatrix, fTextRatio, fTextInverseRatio * x, @@ -647,7 +643,7 @@ void GrStencilAndCoverTextContext::TextRun::draw(GrContext* ctx, GrPathRendering::kWinding_FillType, glyphs, fInstanceData, bounds)); - dc->drawBatch(*pipelineBuilder, clip, batch); + drawContext->drawBatch(*pipelineBuilder, clip, batch); } if (fFallbackTextBlob) { @@ -657,8 +653,8 @@ void GrStencilAndCoverTextContext::TextRun::draw(GrContext* ctx, fallbackSkPaint.setStrokeWidth(fStyle.strokeRec().getWidth() * fTextRatio); } - fallbackTextContext->drawTextBlob(ctx, dc, clip, fallbackSkPaint, viewMatrix, props, - fFallbackTextBlob, x, y, nullptr, clipBounds); + fallbackTextContext->drawTextBlob(ctx, drawContext, clip, fallbackSkPaint, viewMatrix, + props, fFallbackTextBlob, x, y, nullptr, clipBounds); } } diff --git a/src/gpu/vk/GrVkStencilAttachment.cpp b/src/gpu/vk/GrVkStencilAttachment.cpp index 0343504afc..8e5940df9d 100644 --- a/src/gpu/vk/GrVkStencilAttachment.cpp +++ b/src/gpu/vk/GrVkStencilAttachment.cpp @@ -18,8 +18,7 @@ GrVkStencilAttachment::GrVkStencilAttachment(GrVkGpu* gpu, const GrVkImage::ImageDesc& desc, const GrVkImageInfo& info, const GrVkImageView* stencilView) - : GrStencilAttachment(gpu, desc.fWidth, desc.fHeight, - format.fStencilBits, desc.fSamples) + : GrStencilAttachment(gpu, desc.fWidth, desc.fHeight, format.fStencilBits, desc.fSamples) , GrVkImage(info, GrVkImage::kNot_Wrapped) , fFormat(format) , fStencilView(stencilView) { diff --git a/tests/GLProgramsTest.cpp b/tests/GLProgramsTest.cpp index 7fabf32f1d..2470061257 100644 --- a/tests/GLProgramsTest.cpp +++ b/tests/GLProgramsTest.cpp @@ -350,7 +350,6 @@ bool GrDrawingManager::ProgramUnitTest(GrContext* context, int maxStages) { } GrPipelineBuilder pipelineBuilder; - pipelineBuilder.setRenderTarget(drawContext->accessRenderTarget()); SkAutoTUnref<GrDrawBatch> batch(GrRandomDrawBatch(&random, context)); SkASSERT(batch); @@ -387,7 +386,6 @@ bool GrDrawingManager::ProgramUnitTest(GrContext* context, int maxStages) { drawContext.get(), dummyTextures); GrPipelineBuilder builder; builder.setXPFactory(GrPorterDuffXPFactory::Create(SkXfermode::kSrc_Mode))->unref(); - builder.setRenderTarget(drawContext->accessRenderTarget()); SkAutoTUnref<const GrFragmentProcessor> fp( GrProcessorTestFactory<GrFragmentProcessor>::CreateIdx(i, &ptd)); diff --git a/tests/PrimitiveProcessorTest.cpp b/tests/PrimitiveProcessorTest.cpp index c2ab05c4fb..5ef49942ba 100644 --- a/tests/PrimitiveProcessorTest.cpp +++ b/tests/PrimitiveProcessorTest.cpp @@ -104,9 +104,9 @@ private: DEF_GPUTEST_FOR_ALL_GL_CONTEXTS(VertexAttributeCount, reporter, ctxInfo) { GrContext* context = ctxInfo.grContext(); - sk_sp<GrDrawContext> dc(context->newDrawContext(SkBackingFit::kApprox, - 1, 1, kRGBA_8888_GrPixelConfig)); - if (!dc) { + sk_sp<GrDrawContext> drawContext(context->newDrawContext(SkBackingFit::kApprox, + 1, 1, kRGBA_8888_GrPixelConfig)); + if (!drawContext) { ERRORF(reporter, "Could not create draw context."); return; } @@ -123,10 +123,9 @@ DEF_GPUTEST_FOR_ALL_GL_CONTEXTS(VertexAttributeCount, reporter, ctxInfo) { #endif SkAutoTUnref<GrDrawBatch> batch; GrPipelineBuilder pb; - pb.setRenderTarget(dc->accessRenderTarget()); // This one should succeed. batch.reset(new Batch(attribCnt)); - dc->drawContextPriv().testingOnly_drawBatch(pb, batch); + drawContext->drawContextPriv().testingOnly_drawBatch(pb, batch); context->flush(); #if GR_GPU_STATS REPORTER_ASSERT(reporter, context->getGpu()->stats()->numDraws() == 1); @@ -135,7 +134,7 @@ DEF_GPUTEST_FOR_ALL_GL_CONTEXTS(VertexAttributeCount, reporter, ctxInfo) { context->resetGpuStats(); // This one should fail. batch.reset(new Batch(attribCnt+1)); - dc->drawContextPriv().testingOnly_drawBatch(pb, batch); + drawContext->drawContextPriv().testingOnly_drawBatch(pb, batch); context->flush(); #if GR_GPU_STATS REPORTER_ASSERT(reporter, context->getGpu()->stats()->numDraws() == 0); diff --git a/tools/gpu/GrTest.h b/tools/gpu/GrTest.h index 217efe6b7d..7c94c9fc30 100644 --- a/tools/gpu/GrTest.h +++ b/tools/gpu/GrTest.h @@ -29,7 +29,6 @@ public: void init(GrContext*, sk_sp<GrDrawContext>); - GrDrawTarget* target() { return fDrawContext->getDrawTarget(); } GrResourceProvider* resourceProvider() { return fContext->resourceProvider(); } private: |