diff options
author | 2015-09-14 12:56:10 -0700 | |
---|---|---|
committer | 2015-09-14 12:56:10 -0700 | |
commit | ec00d94199fad7723b5987b86c1abef8ddafe2d8 (patch) | |
tree | 4161bb293ffe433cbe0fd41a4ad0263b36eedffd /include/gpu/GrRenderTarget.h | |
parent | 37497dc9de9cf8df4f9dd972b50cbd35b9da6682 (diff) |
Move some of the adding stencil attachment logic of Gpu and into Render Target.
The new flow of calls for attaching a Stencil looks like:
Client
rt->attachStencilAttachment()
gpu->getStencilAttachment()
glgpu->createStencilAttachment()
glrt->completeStencilAttachment() //actually attaches
BUG=skia:
Review URL: https://codereview.chromium.org/1333383002
Diffstat (limited to 'include/gpu/GrRenderTarget.h')
-rw-r--r-- | include/gpu/GrRenderTarget.h | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/include/gpu/GrRenderTarget.h b/include/gpu/GrRenderTarget.h index 8983d53a25..2309dbd876 100644 --- a/include/gpu/GrRenderTarget.h +++ b/include/gpu/GrRenderTarget.h @@ -144,15 +144,18 @@ public: */ virtual GrBackendObject getRenderTargetHandle() const = 0; + // Checked when this object is asked to attach a stencil buffer. + virtual bool canAttemptStencilAttachment() const = 0; + // Provides access to functions that aren't part of the public API. GrRenderTargetPriv renderTargetPriv(); const GrRenderTargetPriv renderTargetPriv() const; protected: GrRenderTarget(GrGpu* gpu, LifeCycle lifeCycle, const GrSurfaceDesc& desc, - SampleConfig sampleConfig) + SampleConfig sampleConfig, GrStencilAttachment* stencil = nullptr) : INHERITED(gpu, lifeCycle, desc) - , fStencilAttachment(NULL) + , fStencilAttachment(stencil) , fSampleConfig(sampleConfig) { fResolveRect.setLargestInverted(); } @@ -162,8 +165,11 @@ protected: void onRelease() override; private: - // Checked when this object is asked to attach a stencil buffer. - virtual bool canAttemptStencilAttachment() const = 0; + // Allows the backends to perform any additional work that is required for attaching a + // GrStencilAttachment. When this is called, the GrStencilAttachment has already been put onto + // the GrRenderTarget. This function must return false if any failures occur when completing the + // stencil attachment. + virtual bool completeStencilAttachment() = 0; friend class GrRenderTargetPriv; |