diff options
author | 2018-02-01 13:58:00 -0500 | |
---|---|---|
committer | 2018-02-01 21:56:49 +0000 | |
commit | d653cac70ed17983125ceed053138c09f1401846 (patch) | |
tree | 1c9c5395e5e16ba1be082f4160381285a8240a1d /src/gpu/GrProxyProvider.cpp | |
parent | 704cff2c0cacdb13b7b0cd8da2cee72f24e4776c (diff) |
More sample count cleanup:
rename getSampleCount -> getRenderTargetSampleCount because it will return
0 when a config is not renderable but *is* supported as a texture format.
(Old name kept around until Chrome stops calling it)
Add virtual GrCaps::maxRenderTargetSampleCount(GrPixelConfig).
Devirtualize isConfigRenderable() and implement as maxRTSC != 0. Separate implementation for version with bool withMSAA param to be removed after Flutter is updated to no longer call.
Consolidate various file static GrSurfaceDesc validators fns into GrCaps::validateSurfaceDesc().
Bug: skia:
Change-Id: Ie30a291aa027e910df3bd90fac8518ccdb39e53f
Reviewed-on: https://skia-review.googlesource.com/102141
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Diffstat (limited to 'src/gpu/GrProxyProvider.cpp')
-rw-r--r-- | src/gpu/GrProxyProvider.cpp | 43 |
1 files changed, 8 insertions, 35 deletions
diff --git a/src/gpu/GrProxyProvider.cpp b/src/gpu/GrProxyProvider.cpp index 193b321190..1a099144cf 100644 --- a/src/gpu/GrProxyProvider.cpp +++ b/src/gpu/GrProxyProvider.cpp @@ -313,41 +313,14 @@ sk_sp<GrTextureProxy> GrProxyProvider::createProxy(const GrSurfaceDesc& desc, uint32_t flags) { SkASSERT(0 == flags || GrResourceProvider::kNoPendingIO_Flag == flags); - const GrCaps* caps = this->caps(); - - // TODO: move this logic into GrResourceProvider! - // TODO: share this testing code with check_texture_creation_params - if (!caps->isConfigTexturable(desc.fConfig)) { - return nullptr; - } - - bool willBeRT = SkToBool(desc.fFlags & kRenderTarget_GrSurfaceFlag); - if (willBeRT && !caps->isConfigRenderable(desc.fConfig, desc.fSampleCnt > 1)) { - return nullptr; - } - - // We currently do not support multisampled textures - if (!willBeRT && desc.fSampleCnt > 1) { - return nullptr; - } - - if (willBeRT && !caps->getSampleCount(desc.fSampleCnt, desc.fConfig)) { + if (!this->caps()->validateSurfaceDesc(desc, GrMipMapped::kNo)) { return nullptr; } - - int maxSize; - if (willBeRT) { - maxSize = caps->maxRenderTargetSize(); - } else { - maxSize = caps->maxTextureSize(); - } - - if (desc.fWidth > maxSize || desc.fHeight > maxSize || desc.fWidth <= 0 || desc.fHeight <= 0) { - return nullptr; - } - GrSurfaceDesc copyDesc = desc; - copyDesc.fSampleCnt = caps->getSampleCount(desc.fSampleCnt, desc.fConfig); + if (desc.fFlags & kRenderTarget_GrSurfaceFlag) { + copyDesc.fSampleCnt = + this->caps()->getRenderTargetSampleCount(desc.fSampleCnt, desc.fConfig); + } #ifdef SK_DISABLE_DEFERRED_PROXIES // Temporarily force instantiation for crbug.com/769760 and crbug.com/769898 @@ -365,11 +338,11 @@ sk_sp<GrTextureProxy> GrProxyProvider::createProxy(const GrSurfaceDesc& desc, return GrSurfaceProxy::MakeWrapped(std::move(tex), copyDesc.fOrigin); #else - if (willBeRT) { + if (copyDesc.fFlags & kRenderTarget_GrSurfaceFlag) { // We know anything we instantiate later from this deferred path will be // both texturable and renderable - return sk_sp<GrTextureProxy>(new GrTextureRenderTargetProxy(*caps, copyDesc, fit, - budgeted, flags)); + return sk_sp<GrTextureProxy>( + new GrTextureRenderTargetProxy(*this->caps(), copyDesc, fit, budgeted, flags)); } return sk_sp<GrTextureProxy>(new GrTextureProxy(copyDesc, fit, budgeted, nullptr, 0, flags)); |