Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Unified Diff: include/gpu/GrRenderTarget.h

Issue 1001503002: Implement support for mixed sampled render targets (Closed) Base URL: https://skia.googlesource.com/skia.git@mix1
Patch Set: GrProcOptInfo bug Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | include/gpu/GrTypes.h » ('j') | include/gpu/GrTypes.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/gpu/GrRenderTarget.h
diff --git a/include/gpu/GrRenderTarget.h b/include/gpu/GrRenderTarget.h
index 40e006aa8aec8edb70b28cec5a3274f5b7f0e110..933e0923b5057b2d99feea641bd3be705507f2d1 100644
--- a/include/gpu/GrRenderTarget.h
+++ b/include/gpu/GrRenderTarget.h
@@ -31,14 +31,55 @@ public:
// GrRenderTarget
/**
- * @return true if the surface is multisampled, false otherwise
+ * On some hardware it is possible for a render target to have multisampling
+ * only in certain stages of the graphics pipeline. This enum allows
+ * the caller to query about specific stages in isMultisampled() and
+ * numSamples().
*/
- bool isMultisampled() const { return 0 != fDesc.fSampleCnt; }
+ enum PipelineStage {
bsalomon 2015/03/31 16:37:33 I'm not sure about this name... enum BufferType
Chris Dalton 2015/03/31 19:47:30 I'm going to try replying inline. Hopefully it wor
Chris Dalton 2015/03/31 22:24:57 Sorry to pollute your inboxes :) I've thought abou
vbuzinov 2015/04/02 13:10:37 This bitfield implementation is certainly easier t
+ kColorBuffer_PipelineStage,
+ kStencilBuffer_PipelineStage,
+ // We only support two sample configs at the moment, unified and
+ // stencil. So we can query multisample info for everywhere/anywhere
+ // by checking the correct buffer.
+ kEverywhere_PipelineStage = kColorBuffer_PipelineStage,
+ kAnywhere_PipelineStage = kStencilBuffer_PipelineStage
+ };
+
+ /**
+ * @param pipelineStage specifies the pipeline stage for which
+ * multisampling is queried
+ * @return true if the surface is multisampled in the specified pipeline
+ * stage(s), false otherwise
+ */
+ bool isMultisampled(PipelineStage pipelineStage =
+ kEverywhere_PipelineStage) const {
+ if (kStencil_GrSampleConfig == fSampleConfig &&
+ kColorBuffer_PipelineStage == pipelineStage) {
+ return false;
+ }
+ return 0 != fDesc.fSampleCnt;
+ }
+
+ /**
+ * @param pipelineStage specifies the pipeline stage for which
+ * multisampling is queried
+ * @return the number of samples-per-pixel, or zero if the render target
+ * is not multisampled in the specified pipeline stage(s)
+ */
+ int numSamples(PipelineStage pipelineStage =
+ kEverywhere_PipelineStage) const {
+ return this->isMultisampled(pipelineStage) ? fDesc.fSampleCnt : 0;
+ }
/**
- * @return the number of samples-per-pixel or zero if non-MSAA.
+ * @return sample config: kUnified_GrSampleConfig if both color and stencil
+ buffers are MSAA, or kStencil_GrSampleConfig if only stencil
+ buffer is MSAA.
*/
- int numSamples() const { return fDesc.fSampleCnt; }
+ GrSampleConfig sampleConfig() const {
+ return fSampleConfig;
+ }
/**
* Call to indicate the multisample contents were modified such that the
@@ -94,8 +135,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 +153,8 @@ private:
friend class GrRenderTargetPriv;
+ GrSampleConfig fSampleConfig;
+
GrStencilBuffer* fStencilBuffer;
SkIRect fResolveRect;
« no previous file with comments | « no previous file | include/gpu/GrTypes.h » ('j') | include/gpu/GrTypes.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698