diff options
author | Brian Salomon <bsalomon@google.com> | 2018-02-01 14:16:02 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-02-01 21:15:39 +0000 |
commit | d0d7270fcc32546005b8e847df516cb11592cd30 (patch) | |
tree | 032f102536ecb8e665c348b733b230a062a1c010 /include/gpu | |
parent | 2331c82e0d10ee519d9afb3f9e85485c6cf0b3c3 (diff) |
Revert "Revert "Redefine the meaning of sample counts in GPU backend.""
Fixes gpu config default samples to be 1 and updates config parsing test accordingly.
This reverts commit c1ce2f7966babaae0deb150f93f1227ee5af9285.
Bug: skia:
Change-Id: I456973b1f52ced85a2011ea10fc49449bfc5846f
Reviewed-on: https://skia-review.googlesource.com/102147
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'include/gpu')
-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 |
4 files changed, 18 insertions, 16 deletions
diff --git a/include/gpu/GrCaps.h b/include/gpu/GrCaps.h index f4d6e06280..ab77c8877f 100644 --- a/include/gpu/GrCaps.h +++ b/include/gpu/GrCaps.h @@ -135,7 +135,9 @@ 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. If MSAA is not support for the config we will return 0. + // 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. 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 f85efc4940..3c79ac74ce 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 = 0, + int sampleCnt = 1, 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 = 0, + int sampleCnt = 1, GrMipMapped = GrMipMapped::kNo, GrSurfaceOrigin origin = kBottomLeft_GrSurfaceOrigin, const SkSurfaceProps* surfaceProps = nullptr, diff --git a/include/gpu/GrRenderTarget.h b/include/gpu/GrRenderTarget.h index 4eee7f63ce..9be6e1d8d0 100644 --- a/include/gpu/GrRenderTarget.h +++ b/include/gpu/GrRenderTarget.h @@ -33,10 +33,11 @@ public: const GrRenderTarget* asRenderTarget() const override { return this; } // GrRenderTarget - bool isStencilBufferMultisampled() const { return fSampleCnt > 0; } + bool isStencilBufferMultisampled() const { return fSampleCnt > 1; } GrFSAAType fsaaType() const { - if (!fSampleCnt) { + SkASSERT(fSampleCnt >= 1); + if (fSampleCnt <= 1) { SkASSERT(!(fFlags & GrRenderTargetFlags::kMixedSampled)); return GrFSAAType::kNone; } @@ -53,7 +54,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() ? 0 : fSampleCnt; + return GrFSAAType::kMixedSamples == this->fsaaType() ? 1 : fSampleCnt; } /** diff --git a/include/gpu/GrTypes.h b/include/gpu/GrTypes.h index 3081543aac..ab21fba732 100644 --- a/include/gpu/GrTypes.h +++ b/include/gpu/GrTypes.h @@ -402,13 +402,12 @@ struct GrMipLevel { */ struct GrSurfaceDesc { GrSurfaceDesc() - : fFlags(kNone_GrSurfaceFlags) - , fOrigin(kTopLeft_GrSurfaceOrigin) - , fWidth(0) - , fHeight(0) - , fConfig(kUnknown_GrPixelConfig) - , fSampleCnt(0) { - } + : fFlags(kNone_GrSurfaceFlags) + , fOrigin(kTopLeft_GrSurfaceOrigin) + , fWidth(0) + , fHeight(0) + , fConfig(kUnknown_GrPixelConfig) + , fSampleCnt(1) {} GrSurfaceFlags fFlags; //!< bitfield of TextureFlags GrSurfaceOrigin fOrigin; //!< origin of the texture @@ -422,11 +421,11 @@ struct GrSurfaceDesc { GrPixelConfig fConfig; /** - * The number of samples per pixel or 0 to disable full scene AA. This only + * The number of samples per pixel. Zero is treated equivalently to 1. 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, or down if it is larger than the - * max supported count. + * up to the next supported sample count. A value larger than the largest + * supported sample count will fail. */ int fSampleCnt; }; |