| Index: include/gpu/GrRenderTarget.h
|
| diff --git a/include/gpu/GrRenderTarget.h b/include/gpu/GrRenderTarget.h
|
| index 77b04d24d3f993d1cafbf30712ca34afe79b1f3c..1f87787d45dcd92c154bfbf8f3ba6f64a5df4321 100644
|
| --- a/include/gpu/GrRenderTarget.h
|
| +++ b/include/gpu/GrRenderTarget.h
|
| @@ -30,66 +30,28 @@ public:
|
| const GrRenderTarget* asRenderTarget() const override { return this; }
|
|
|
| // GrRenderTarget
|
| - /**
|
| - * On some hardware it is possible for a render target to have multisampling
|
| - * only in certain buffers.
|
| - * Enforce only two legal sample configs.
|
| - * kUnified_SampleConfig signifies multisampling in both color and stencil
|
| - * buffers and is available across all hardware.
|
| - * kStencil_SampleConfig means multisampling is present in stencil buffer
|
| - * only; this config requires hardware support of
|
| - * NV_framebuffer_mixed_samples.
|
| - */
|
| - enum SampleConfig {
|
| - kUnified_SampleConfig = 0,
|
| - kStencil_SampleConfig = 1
|
| - };
|
| -
|
| - /**
|
| - * @return true if the surface is multisampled in all buffers,
|
| - * false otherwise
|
| - */
|
| - bool isUnifiedMultisampled() const {
|
| - if (fSampleConfig != kUnified_SampleConfig) {
|
| - return false;
|
| - }
|
| - return 0 != fDesc.fSampleCnt;
|
| - }
|
| + bool isStencilBufferMultisampled() const { return fDesc.fSampleCnt > 0; }
|
|
|
| /**
|
| - * @return true if the surface is multisampled in the stencil buffer,
|
| - * false otherwise
|
| + * For our purposes, "Mixed Sampled" means the stencil buffer is multisampled but the color
|
| + * buffer is not.
|
| */
|
| - bool isStencilBufferMultisampled() const {
|
| - return 0 != fDesc.fSampleCnt;
|
| - }
|
| + bool isMixedSampled() const { return fFlags & Flags::kMixedSampled; }
|
|
|
| /**
|
| - * @return the number of color samples-per-pixel, or zero if non-MSAA or
|
| - * multisampled in the stencil buffer only.
|
| + * "Unified Sampled" means the stencil and color buffers are both multisampled.
|
| */
|
| - int numColorSamples() const {
|
| - if (fSampleConfig == kUnified_SampleConfig) {
|
| - return fDesc.fSampleCnt;
|
| - }
|
| - return 0;
|
| - }
|
| + bool isUnifiedMultisampled() const { return fDesc.fSampleCnt > 0 && !this->isMixedSampled(); }
|
|
|
| /**
|
| - * @return the number of stencil samples-per-pixel, or zero if non-MSAA.
|
| + * Returns the number of samples/pixel in the stencil buffer (Zero if non-MSAA).
|
| */
|
| - int numStencilSamples() const {
|
| - return fDesc.fSampleCnt;
|
| - }
|
| + int numStencilSamples() const { return fDesc.fSampleCnt; }
|
|
|
| /**
|
| - * @return true if the surface is mixed sampled, false otherwise.
|
| + * Returns the number of samples/pixel in the color buffer (Zero if non-MSAA or mixed sampled).
|
| */
|
| - bool hasMixedSamples() const {
|
| - SkASSERT(kStencil_SampleConfig != fSampleConfig ||
|
| - this->isStencilBufferMultisampled());
|
| - return kStencil_SampleConfig == fSampleConfig;
|
| - }
|
| + int numColorSamples() const { return this->isMixedSampled() ? 0 : fDesc.fSampleCnt; }
|
|
|
| /**
|
| * Call to indicate the multisample contents were modified such that the
|
| @@ -156,19 +118,17 @@ public:
|
| void setLastDrawTarget(GrDrawTarget* dt);
|
| GrDrawTarget* getLastDrawTarget() { return fLastDrawTarget; }
|
|
|
| - static SampleConfig ComputeSampleConfig(const GrCaps& caps, int sampleCnt);
|
| -
|
| protected:
|
| - GrRenderTarget(GrGpu* gpu, const GrSurfaceDesc& desc,
|
| - SampleConfig sampleConfig, GrStencilAttachment* stencil = nullptr)
|
| - : INHERITED(gpu, desc)
|
| - , fStencilAttachment(stencil)
|
| - , fMultisampleSpecsID(0)
|
| - , fSampleConfig(sampleConfig)
|
| - , fLastDrawTarget(nullptr) {
|
| - fResolveRect.setLargestInverted();
|
| - }
|
| + enum class Flags {
|
| + kNone = 0,
|
| + kMixedSampled = 1 << 0,
|
| + kWindowRectsSupport = 1 << 1
|
| + };
|
| +
|
| + GR_DECL_BITFIELD_CLASS_OPS_FRIENDS(Flags);
|
|
|
| + GrRenderTarget(GrGpu*, const GrSurfaceDesc&, Flags = Flags::kNone,
|
| + GrStencilAttachment* = nullptr);
|
| ~GrRenderTarget() override;
|
|
|
| // override of GrResource
|
| @@ -186,7 +146,7 @@ private:
|
|
|
| GrStencilAttachment* fStencilAttachment;
|
| uint8_t fMultisampleSpecsID;
|
| - SampleConfig fSampleConfig;
|
| + Flags fFlags;
|
|
|
| SkIRect fResolveRect;
|
|
|
| @@ -201,5 +161,6 @@ private:
|
| typedef GrSurface INHERITED;
|
| };
|
|
|
| +GR_MAKE_BITFIELD_CLASS_OPS(GrRenderTarget::Flags);
|
|
|
| #endif
|
|
|