diff options
author | Brian Salomon <bsalomon@google.com> | 2018-02-02 13:51:50 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-02-02 23:37:59 +0000 |
commit | 5bb82cbecd740d21b92e8d2944280ab6eb6af7a6 (patch) | |
tree | 8171a4ea5d7f72dbba276b58a89a7e115066f24c /src/gpu/GrProxyProvider.cpp | |
parent | 1e5ef4f81ca18cd9448426891cda5120cea51de8 (diff) |
Revert "Revert "Revert "Revert "Redefine the meaning of sample counts in GPU backend.""""
This reverts commit 18c52a7b52211de5d0dcd86dc048adef758c6c75.
Also relands "More sample count cleanup:" and "Add new GrContext queries for imagability, surfacability, and max sample count of color types"
Bug: skia:
Change-Id: I4028105a3a1f16ce3944e134619eb6245af6b947
Reviewed-on: https://skia-review.googlesource.com/102940
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src/gpu/GrProxyProvider.cpp')
-rw-r--r-- | src/gpu/GrProxyProvider.cpp | 41 |
1 files changed, 9 insertions, 32 deletions
diff --git a/src/gpu/GrProxyProvider.cpp b/src/gpu/GrProxyProvider.cpp index e453246b62..6641bcf9a8 100644 --- a/src/gpu/GrProxyProvider.cpp +++ b/src/gpu/GrProxyProvider.cpp @@ -315,37 +315,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 > 0)) { + if (!this->caps()->validateSurfaceDesc(desc, GrMipMapped::kNo)) { return nullptr; } - - // We currently do not support multisampled textures - if (!willBeRT && desc.fSampleCnt > 0) { - 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 @@ -363,11 +340,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)); @@ -507,7 +484,7 @@ sk_sp<GrTextureProxy> GrProxyProvider::createFullyLazyProxy(LazyInstantiateCallb desc.fWidth = -1; desc.fHeight = -1; desc.fConfig = config; - desc.fSampleCnt = 0; + desc.fSampleCnt = 1; return this->createLazyProxy(std::move(callback), desc, GrMipMapped::kNo, SkBackingFit::kApprox, SkBudgeted::kYes); |