diff options
author | Brian Salomon <bsalomon@google.com> | 2018-02-01 18:34:32 +0000 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-02-01 18:34:40 +0000 |
commit | c1ce2f7966babaae0deb150f93f1227ee5af9285 (patch) | |
tree | ab4caf4bd03f6e642f618739e4283eb9ef62ebaf /include | |
parent | 130fb3f7aac19e40eddfc8fa85a9b39e7c99a7e8 (diff) |
Revert "Redefine the meaning of sample counts in GPU backend."
This reverts commit 48825b11ad25c98b9a4884d5cc0edd4e290c4409.
Reason for revert: nanobench
Original change's description:
> Redefine the meaning of sample counts in GPU backend.
>
> Old: 0 -> nonMSAA
> 1+ -> MSAA
>
> New:
> 0 -> error/unsupported
> 1 -> nonMSAA
> 2+ -> MSAA
>
> We still allow 0 to mean nonMSAA in three sets of public APIs for backwards compatibility:
>
> 1) SkSurface factories
> 2) GrBackendRenderTarget constructors
> 3) GrCaps::getSampleCnt()'s requestedCount parameter
>
> However, we immediately clamp to 1 and treat 0 as invalid/non-renderable internally.
>
> This also changes the behavior when using a large sample count. We now fail in that case rather than using the largest sample available sample count. GrCaps::getSampleCount() will return 0 in this case.
>
>
> Bug: skia:
> Change-Id: Ida22c6b22c1365e563c9046b611e88bf5eb3ff33
> Reviewed-on: https://skia-review.googlesource.com/101560
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>
TBR=egdaniel@google.com,bsalomon@google.com
Change-Id: Ic257619a8a5ee9ac15419ecf10259e42daed7f82
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/102662
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/core/SkSurface.h | 10 | ||||
-rw-r--r-- | include/gpu/GrCaps.h | 4 | ||||
-rw-r--r-- | include/gpu/GrContext.h | 4 | ||||
-rw-r--r-- | include/gpu/GrRenderTarget.h | 7 | ||||
-rw-r--r-- | include/gpu/GrTypes.h | 19 | ||||
-rw-r--r-- | include/private/GrRenderTargetProxy.h | 4 |
6 files changed, 23 insertions, 25 deletions
diff --git a/include/core/SkSurface.h b/include/core/SkSurface.h index d621fdf062..1f2c4b7f07 100644 --- a/include/core/SkSurface.h +++ b/include/core/SkSurface.h @@ -90,7 +90,7 @@ public: /** * Used to wrap a pre-existing backend 3D API texture as a SkSurface. Skia will not assume * ownership of the texture and the client must ensure the texture is valid for the lifetime - * of the SkSurface. If sampleCnt > 1, then we will create an intermediate mssa surface which + * of the SkSurface. If sampleCnt > 0, then we will create an intermediate mssa surface which * we will use for rendering. We then resolve into the passed in texture. */ static sk_sp<SkSurface> MakeFromBackendTexture(GrContext* context, @@ -102,13 +102,13 @@ public: /** * Used to wrap a pre-existing backend 3D API texture as a SkSurface. Skia will not assume * ownership of the texture and the client must ensure the texture is valid for the lifetime - * of the SkSurface. If sampleCnt > 1, then we will create an intermediate mssa surface which + * of the SkSurface. If sampleCnt > 0, then we will create an intermediate mssa surface which * we will use for rendering. We then resolve into the passed in texture. * * The GrBackendTexture must have a valid backend format supplied (GrGLTextureInfo::fFormat, * GrVkImageInfo::fFormat, etc.) in it. The passed in SkColorType informs skia how it should * interpret the backend format supplied by the GrBackendTexture. If the format in the - * GrBackendTexture is not compatible with the sampleCnt, SkColorType, and SkColorSpace we + * GrBackendTexture is not compitable with the sampleCnt, SkColorType, and SkColorSpace we * will return nullptr. */ static sk_sp<SkSurface> MakeFromBackendTexture(GrContext* context, @@ -128,7 +128,7 @@ public: * The GrBackendRenderTarget must have a valid backend format set (GrGLTextureInfo::fFormat, * GrVkImageInfo::fFormat, etc.) in it. The passed in SkColorType informs skia how it should * interpret the backend format supplied by the GrBackendRenderTarget. If the format in the - * GrBackendRenderTarget is not compatible with the sampleCnt, SkColorType, and SkColorSpace + * GrBackendRenderTarget is not compitable with the sampleCnt, SkColorType, and SkColorSpace * we will return nullptr. */ static sk_sp<SkSurface> MakeFromBackendRenderTarget(GrContext* context, @@ -162,7 +162,7 @@ public: * The GrBackendTexture must have a valid backend format supplied (GrGLTextureInfo::fFormat, * GrVkImageInfo::fFormat, etc.) in it. The passed in SkColorType informs skia how it should * interpret the backend format supplied by the GrBackendTexture. If the format in the - * GrBackendTexture is not compatible with the sampleCnt, SkColorType, and SkColorSpace we + * GrBackendTexture is not compitable with the sampleCnt, SkColorType, and SkColorSpace we * will return nullptr. */ static sk_sp<SkSurface> MakeFromBackendTextureAsRenderTarget(GrContext* context, diff --git a/include/gpu/GrCaps.h b/include/gpu/GrCaps.h index ab77c8877f..f4d6e06280 100644 --- a/include/gpu/GrCaps.h +++ b/include/gpu/GrCaps.h @@ -135,9 +135,7 @@ public: int maxRasterSamples() const { return fMaxRasterSamples; } // Find a sample count greater than or equal to the requested count which is supported for a - // color buffer of the given config or 0 if no such sample count is supported. If the requested - // sample count is 1 then 1 will be returned if non-MSAA rendering is supported, otherwise 0. - // For historical reasons requestedCount==0 is handled identically to requestedCount==1. + // color buffer of the given config. If MSAA is not support for the config we will return 0. virtual int getSampleCount(int requestedCount, GrPixelConfig config) const = 0; int maxWindowRectangles() const { return fMaxWindowRectangles; } diff --git a/include/gpu/GrContext.h b/include/gpu/GrContext.h index 3c79ac74ce..f85efc4940 100644 --- a/include/gpu/GrContext.h +++ b/include/gpu/GrContext.h @@ -226,7 +226,7 @@ public: int width, int height, GrPixelConfig config, sk_sp<SkColorSpace> colorSpace, - int sampleCnt = 1, + int sampleCnt = 0, GrMipMapped = GrMipMapped::kNo, GrSurfaceOrigin origin = kBottomLeft_GrSurfaceOrigin, const SkSurfaceProps* surfaceProps = nullptr, @@ -242,7 +242,7 @@ public: int width, int height, GrPixelConfig config, sk_sp<SkColorSpace> colorSpace, - int sampleCnt = 1, + int sampleCnt = 0, GrMipMapped = GrMipMapped::kNo, GrSurfaceOrigin origin = kBottomLeft_GrSurfaceOrigin, const SkSurfaceProps* surfaceProps = nullptr, diff --git a/include/gpu/GrRenderTarget.h b/include/gpu/GrRenderTarget.h index 9be6e1d8d0..4eee7f63ce 100644 --- a/include/gpu/GrRenderTarget.h +++ b/include/gpu/GrRenderTarget.h @@ -33,11 +33,10 @@ public: const GrRenderTarget* asRenderTarget() const override { return this; } // GrRenderTarget - bool isStencilBufferMultisampled() const { return fSampleCnt > 1; } + bool isStencilBufferMultisampled() const { return fSampleCnt > 0; } GrFSAAType fsaaType() const { - SkASSERT(fSampleCnt >= 1); - if (fSampleCnt <= 1) { + if (!fSampleCnt) { SkASSERT(!(fFlags & GrRenderTargetFlags::kMixedSampled)); return GrFSAAType::kNone; } @@ -54,7 +53,7 @@ public: * Returns the number of samples/pixel in the color buffer (Zero if non-MSAA or mixed sampled). */ int numColorSamples() const { - return GrFSAAType::kMixedSamples == this->fsaaType() ? 1 : fSampleCnt; + return GrFSAAType::kMixedSamples == this->fsaaType() ? 0 : fSampleCnt; } /** diff --git a/include/gpu/GrTypes.h b/include/gpu/GrTypes.h index ab21fba732..3081543aac 100644 --- a/include/gpu/GrTypes.h +++ b/include/gpu/GrTypes.h @@ -402,12 +402,13 @@ struct GrMipLevel { */ struct GrSurfaceDesc { GrSurfaceDesc() - : fFlags(kNone_GrSurfaceFlags) - , fOrigin(kTopLeft_GrSurfaceOrigin) - , fWidth(0) - , fHeight(0) - , fConfig(kUnknown_GrPixelConfig) - , fSampleCnt(1) {} + : fFlags(kNone_GrSurfaceFlags) + , fOrigin(kTopLeft_GrSurfaceOrigin) + , fWidth(0) + , fHeight(0) + , fConfig(kUnknown_GrPixelConfig) + , fSampleCnt(0) { + } GrSurfaceFlags fFlags; //!< bitfield of TextureFlags GrSurfaceOrigin fOrigin; //!< origin of the texture @@ -421,11 +422,11 @@ struct GrSurfaceDesc { GrPixelConfig fConfig; /** - * The number of samples per pixel. Zero is treated equivalently to 1. This only + * The number of samples per pixel or 0 to disable full scene AA. This only * applies if the kRenderTarget_GrSurfaceFlag is set. The actual number * of samples may not exactly match the request. The request will be rounded - * up to the next supported sample count. A value larger than the largest - * supported sample count will fail. + * up to the next supported sample count, or down if it is larger than the + * max supported count. */ int fSampleCnt; }; diff --git a/include/private/GrRenderTargetProxy.h b/include/private/GrRenderTargetProxy.h index 1d5d8042ce..1cd3d5d1a2 100644 --- a/include/private/GrRenderTargetProxy.h +++ b/include/private/GrRenderTargetProxy.h @@ -26,7 +26,7 @@ public: bool instantiate(GrResourceProvider*) override; GrFSAAType fsaaType() const { - if (fSampleCnt <= 1) { + if (!fSampleCnt) { SkASSERT(!(fRenderTargetFlags & GrRenderTargetFlags::kMixedSampled)); return GrFSAAType::kNone; } @@ -50,7 +50,7 @@ public: * Returns the number of samples/pixel in the color buffer (Zero if non-MSAA or mixed sampled). */ int numColorSamples() const { - return GrFSAAType::kMixedSamples == this->fsaaType() ? 1 : fSampleCnt; + return GrFSAAType::kMixedSamples == this->fsaaType() ? 0 : fSampleCnt; } int maxWindowRectangles(const GrCaps& caps) const; |