Index: include/gpu/GrRenderTarget.h |
diff --git a/include/gpu/GrRenderTarget.h b/include/gpu/GrRenderTarget.h |
index 40e006aa8aec8edb70b28cec5a3274f5b7f0e110..5144748fabda79f8d0b5527f4aade84c19dd2082 100644 |
--- a/include/gpu/GrRenderTarget.h |
+++ b/include/gpu/GrRenderTarget.h |
@@ -31,14 +31,39 @@ public: |
// GrRenderTarget |
/** |
- * @return true if the surface is multisampled, false otherwise |
+ * @param pipelineStage specifies the buffer(s) for which multisampling |
+ is queried |
+ * @return true if the surface is multisampled in all of the buffers |
+ * specified by the sample config, false if any are non-MSAA |
*/ |
Chris Dalton
2015/03/19 12:07:40
Maybe pipeline stage would be better to say than b
|
- bool isMultisampled() const { return 0 != fDesc.fSampleCnt; } |
+ bool isMultisampled(GrPipelineStage pipelineStage = |
+ kEverywhere_GrPipelineStage) const { |
+ return 0 != numSamples(pipelineStage); |
+ } |
/** |
- * @return the number of samples-per-pixel or zero if non-MSAA. |
+ * @param pipelineStage specifies the buffer(s) for which sample count |
+ is queried |
+ * @return the number of samples-per-pixel or zero if any of the specified |
+ * buffers is non-MSAA. |
*/ |
- int numSamples() const { return fDesc.fSampleCnt; } |
+ int numSamples(GrPipelineStage pipelineStage = |
+ kEverywhere_GrPipelineStage) const { |
+ if (kStencil_GrSampleConfig == fSampleConfig && |
+ kColorBuffer_GrPipelineStage == pipelineStage) { |
+ return 0; |
+ } |
+ return fDesc.fSampleCnt; |
+ } |
+ |
+ /** |
+ * @return sample config: kUnified_GrSampleConfig if both color and stencil |
+ buffers are MSAA, or kStencil_GrSampleConfig if only stencil |
+ buffer is MSAA. |
+ */ |
+ GrSampleConfig sampleConfig() const { |
+ return fSampleConfig; |
+ } |
/** |
* Call to indicate the multisample contents were modified such that the |
@@ -94,8 +119,10 @@ public: |
const GrRenderTargetPriv renderTargetPriv() const; |
protected: |
- GrRenderTarget(GrGpu* gpu, LifeCycle lifeCycle, const GrSurfaceDesc& desc) |
+ GrRenderTarget(GrGpu* gpu, LifeCycle lifeCycle, const GrSurfaceDesc& desc, |
+ GrSampleConfig sampleConfig) |
: INHERITED(gpu, lifeCycle, desc) |
+ , fSampleConfig(sampleConfig) |
, fStencilBuffer(NULL) { |
fResolveRect.setLargestInverted(); |
} |
@@ -110,6 +137,8 @@ private: |
friend class GrRenderTargetPriv; |
+ GrSampleConfig fSampleConfig; |
+ |
GrStencilBuffer* fStencilBuffer; |
SkIRect fResolveRect; |