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

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: PipelineStage enum relocation 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') | src/gpu/GrContext.cpp » ('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..1245bebb955b340d241e8a32c11b056b62a71ead 100644
--- a/include/gpu/GrRenderTarget.h
+++ b/include/gpu/GrRenderTarget.h
@@ -31,14 +31,52 @@ public:
// GrRenderTarget
/**
- * @return true if the surface is multisampled, false otherwise
+ * Pipeline stage serves as a query parameter to render target's isMultisampled
+ * and numSamples methods. It signifies whether the caller is interested in
+ * multisampling in color buffer or stencil buffer specifically, both, or any of
+ * the two. Used by the NV_framebuffer_mixed_samples implementation.
Chris Dalton 2015/03/20 07:01:45 This comment should probably talk about the pipeli
*/
- bool isMultisampled() const { return 0 != fDesc.fSampleCnt; }
+ enum PipelineStage {
+ kColorBuffer_PipelineStage,
+ kStencilBuffer_PipelineStage,
Chris Dalton 2015/03/20 07:01:45 These equalities seem like they need a comment.
+ 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 all of the buffers
+ * specified by the sample config, false if any are non-MSAA
Chris Dalton 2015/03/20 07:01:45 "true if the surface is multisampled in the specif
+ */
+ bool isMultisampled(PipelineStage pipelineStage =
+ kEverywhere_PipelineStage) const {
+ return 0 != numSamples(pipelineStage);
+ }
/**
- * @return the number of samples-per-pixel or zero if non-MSAA.
+ * @param pipelineStage specifies the pipeline stage for which
+ * multisampling is queried
+ * @return the number of samples-per-pixel or zero if any of the specified
+ * buffers is non-MSAA.
Chris Dalton 2015/03/20 07:01:45 "the number of samples-per-pixel, or zero if the r
*/
- int numSamples() const { return fDesc.fSampleCnt; }
+ int numSamples(PipelineStage pipelineStage =
+ kEverywhere_PipelineStage) const {
Chris Dalton 2015/03/20 07:01:45 Now I'm nit-picking, but I'm wondering if this fun
+ if (kStencil_GrSampleConfig == fSampleConfig &&
+ kColorBuffer_PipelineStage == 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 +132,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 +150,8 @@ private:
friend class GrRenderTargetPriv;
+ GrSampleConfig fSampleConfig;
+
GrStencilBuffer* fStencilBuffer;
SkIRect fResolveRect;
« no previous file with comments | « no previous file | include/gpu/GrTypes.h » ('j') | src/gpu/GrContext.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698