diff options
author | Brian Salomon <bsalomon@google.com> | 2018-02-02 06:53:26 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-02-02 12:19:52 +0000 |
commit | 18c52a7b52211de5d0dcd86dc048adef758c6c75 (patch) | |
tree | 087aeca9b428687dc7e17578310db1f9621e59ea /include/gpu | |
parent | 85ae7159c9c8a9186a4c7e74304eabb35bca9a79 (diff) |
Revert "Revert "Revert "Redefine the meaning of sample counts in GPU backend."""
This reverts commit d0d7270fcc32546005b8e847df516cb11592cd30.
Revert "More sample count cleanup:"
This reverts commit d653cac70ed17983125ceed053138c09f1401846.
Revert "Add new GrContext queries for imagability, surfacability, and max sample count of color types"
This reverts commit 85ae7159c9c8a9186a4c7e74304eabb35bca9a79.
Need to understand NVPR perf changes before relanding
Change-Id: I0db075fb42438ef2a1f9885df184dce52892ac4b
Reviewed-on: https://skia-review.googlesource.com/102780
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 | 33 | ||||
-rw-r--r-- | include/gpu/GrContext.h | 24 | ||||
-rw-r--r-- | include/gpu/GrRenderTarget.h | 7 | ||||
-rw-r--r-- | include/gpu/GrTypes.h | 19 | ||||
-rw-r--r-- | include/gpu/mock/GrMockTypes.h | 7 |
5 files changed, 24 insertions, 66 deletions
diff --git a/include/gpu/GrCaps.h b/include/gpu/GrCaps.h index 0f03f162f0..f4d6e06280 100644 --- a/include/gpu/GrCaps.h +++ b/include/gpu/GrCaps.h @@ -134,6 +134,10 @@ 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. + virtual int getSampleCount(int requestedCount, GrPixelConfig config) const = 0; + int maxWindowRectangles() const { return fMaxWindowRectangles; } // A tuned, platform-specific value for the maximum number of analytic fragment processors we @@ -141,32 +145,9 @@ public: int maxClipAnalyticFPs() const { return fMaxClipAnalyticFPs; } virtual bool isConfigTexturable(GrPixelConfig) const = 0; - + virtual bool isConfigRenderable(GrPixelConfig config, bool withMSAA) const = 0; // Returns whether a texture of the given config can be copied to a texture of the same config. - virtual bool isConfigCopyable(GrPixelConfig) const = 0; - - // Returns the maximum supported sample count for a config. 0 means the config is not renderable - // 1 means the config is renderable but doesn't support MSAA. - virtual int maxRenderTargetSampleCount(GrPixelConfig) const = 0; - - bool isConfigRenderable(GrPixelConfig config) const { - return this->maxRenderTargetSampleCount(config) > 0; - } - - // TODO: Remove this after Flutter updated to no longer use it. - bool isConfigRenderable(GrPixelConfig config, bool withMSAA) const { - return this->maxRenderTargetSampleCount(config) > (withMSAA ? 1 : 0); - } - - // 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. - virtual int getRenderTargetSampleCount(int requestedCount, GrPixelConfig) const = 0; - // TODO: Remove. Legacy name used by Chrome. - int getSampleCount(int requestedCount, GrPixelConfig config) const { - return this->getRenderTargetSampleCount(requestedCount, config); - } + virtual bool isConfigCopyable(GrPixelConfig config) const = 0; bool suppressPrints() const { return fSuppressPrints; } @@ -197,8 +178,6 @@ public: virtual bool initDescForDstCopy(const GrRenderTargetProxy* src, GrSurfaceDesc* desc, bool* rectsMustMatch, bool* disallowSubrect) const = 0; - bool validateSurfaceDesc(const GrSurfaceDesc&, GrMipMapped) const; - /** * Returns true if the GrBackendTexutre can we used with the supplied SkColorType. If it is * compatible, the passed in GrPixelConfig will be set to a config that matches the backend diff --git a/include/gpu/GrContext.h b/include/gpu/GrContext.h index d0ca90e0f0..f85efc4940 100644 --- a/include/gpu/GrContext.h +++ b/include/gpu/GrContext.h @@ -216,26 +216,6 @@ public: /** Access the context capabilities */ const GrCaps* caps() const { return fCaps.get(); } - /** - * Can a SkImage be created with the given color type. - */ - bool colorTypeSupportedAsImage(SkColorType) const; - - /** - * Can a SkSurface be created with the given color type. To check whether MSAA is supported - * use maxSurfaceSampleCountForColorType(). - */ - bool colorTypeSupportedAsSurface(SkColorType colorType) const { - return this->maxSurfaceSampleCountForColorType(colorType) > 0; - } - - /** - * Gets the maximum supported sample count for a color type. 1 is returned if only non-MSAA - * rendering is supported for the color type. 0 is returned if rendering to this color type - * is not supported at all. - */ - int maxSurfaceSampleCountForColorType(SkColorType) const; - /* * Create a new render target context backed by a deferred-style * GrRenderTargetProxy. We guarantee that "asTextureProxy" will succeed for @@ -246,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, @@ -262,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/gpu/mock/GrMockTypes.h b/include/gpu/mock/GrMockTypes.h index 0954c5eadc..cf30a333f3 100644 --- a/include/gpu/mock/GrMockTypes.h +++ b/include/gpu/mock/GrMockTypes.h @@ -22,9 +22,8 @@ struct GrMockTextureInfo { */ struct GrMockOptions { GrMockOptions() { - using Renderability = ConfigOptions::Renderability; // By default RGBA_8888 is textureable and renderable and A8 and RGB565 are texturable. - fConfigOptions[kRGBA_8888_GrPixelConfig].fRenderability = Renderability::kNonMSAA; + fConfigOptions[kRGBA_8888_GrPixelConfig].fRenderable[0] = true; fConfigOptions[kRGBA_8888_GrPixelConfig].fTexturable = true; fConfigOptions[kAlpha_8_GrPixelConfig].fTexturable = true; fConfigOptions[kAlpha_8_as_Alpha_GrPixelConfig].fTexturable = true; @@ -33,8 +32,8 @@ struct GrMockOptions { } struct ConfigOptions { - enum Renderability { kNo, kNonMSAA, kMSAA }; - Renderability fRenderability; + /** The first value is for non-MSAA rendering, the second for MSAA. */ + bool fRenderable[2] = {false, false}; bool fTexturable = false; }; |