diff options
author | 2017-04-03 16:57:43 -0400 | |
---|---|---|
committer | 2017-04-03 21:35:47 +0000 | |
commit | 18dfa980765bee6a1ce7c5f430cb32f487da6590 (patch) | |
tree | f82444c520111b4710746480652fde74d2db3815 /src/gpu/GrPipeline.h | |
parent | b9c4a6fc7de252633f16d11c2df10ee6de16af03 (diff) |
Store the dst texture used by an XP in GrPipeline rather than in the XP.
This will allow the XP to be created before the dst texture.
Change-Id: I3e5bdfa8e5d47e58a3560792ce5cf3899d30a024
Reviewed-on: https://skia-review.googlesource.com/11011
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Diffstat (limited to 'src/gpu/GrPipeline.h')
-rw-r--r-- | src/gpu/GrPipeline.h | 46 |
1 files changed, 32 insertions, 14 deletions
diff --git a/src/gpu/GrPipeline.h b/src/gpu/GrPipeline.h index 91cd16456c..d7a4f4ebed 100644 --- a/src/gpu/GrPipeline.h +++ b/src/gpu/GrPipeline.h @@ -144,6 +144,17 @@ public: } } + /** + * If the GrXferProcessor uses a texture to access the dst color, then this returns that + * texture and the offset to the dst contents within that texture. + */ + GrTexture* dstTexture(SkIPoint* offset = nullptr) const { + if (offset) { + *offset = fDstTextureOffset; + } + return fDstTexture.get(); + } + const GrFragmentProcessor& getColorFragmentProcessor(int idx) const { SkASSERT(idx < this->numColorFragmentProcessors()); return *fFragmentProcessors[idx].get(); @@ -194,7 +205,10 @@ public: } GrXferBarrierType xferBarrierType(const GrCaps& caps) const { - return this->getXferProcessor().xferBarrierType(fRenderTarget.get(), caps); + if (fDstTexture.get() && fDstTexture.get() == fRenderTarget.get()->asTexture()) { + return kTexture_GrXferBarrierType; + } + return this->getXferProcessor().xferBarrierType(caps); } /** @@ -214,21 +228,25 @@ private: kStencilEnabled_Flag = 0x40, }; - typedef GrPendingIOResource<GrRenderTarget, kWrite_GrIOType> RenderTarget; - typedef GrPendingProgramElement<const GrFragmentProcessor> PendingFragmentProcessor; - typedef SkAutoSTArray<8, PendingFragmentProcessor> FragmentProcessorArray; - typedef GrPendingProgramElement<const GrXferProcessor> ProgramXferProcessor; - RenderTarget fRenderTarget; - GrScissorState fScissorState; - GrWindowRectsState fWindowRectsState; - const GrUserStencilSettings* fUserStencilSettings; - uint16_t fDrawFace; - uint16_t fFlags; - ProgramXferProcessor fXferProcessor; - FragmentProcessorArray fFragmentProcessors; + using RenderTarget = GrPendingIOResource<GrRenderTarget, kWrite_GrIOType>; + using DstTexture = GrPendingIOResource<GrTexture, kRead_GrIOType>; + using PendingFragmentProcessor = GrPendingProgramElement<const GrFragmentProcessor>; + using FragmentProcessorArray = SkAutoSTArray<8, PendingFragmentProcessor>; + using ProgramXferProcessor = GrPendingProgramElement<const GrXferProcessor>; + + DstTexture fDstTexture; + SkIPoint fDstTextureOffset; + RenderTarget fRenderTarget; + GrScissorState fScissorState; + GrWindowRectsState fWindowRectsState; + const GrUserStencilSettings* fUserStencilSettings; + uint16_t fDrawFace; + uint16_t fFlags; + ProgramXferProcessor fXferProcessor; + FragmentProcessorArray fFragmentProcessors; // This value is also the index in fFragmentProcessors where coverage processors begin. - int fNumColorProcessors; + int fNumColorProcessors; typedef SkRefCnt INHERITED; }; |