aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrProxyProvider.cpp
diff options
context:
space:
mode:
authorGravatar Brian Salomon <bsalomon@google.com>2018-02-02 06:53:26 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-02-02 12:19:52 +0000
commit18c52a7b52211de5d0dcd86dc048adef758c6c75 (patch)
tree087aeca9b428687dc7e17578310db1f9621e59ea /src/gpu/GrProxyProvider.cpp
parent85ae7159c9c8a9186a4c7e74304eabb35bca9a79 (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 'src/gpu/GrProxyProvider.cpp')
-rw-r--r--src/gpu/GrProxyProvider.cpp41
1 files changed, 32 insertions, 9 deletions
diff --git a/src/gpu/GrProxyProvider.cpp b/src/gpu/GrProxyProvider.cpp
index 1a099144cf..ec05243d18 100644
--- a/src/gpu/GrProxyProvider.cpp
+++ b/src/gpu/GrProxyProvider.cpp
@@ -313,15 +313,38 @@ sk_sp<GrTextureProxy> GrProxyProvider::createProxy(const GrSurfaceDesc& desc,
uint32_t flags) {
SkASSERT(0 == flags || GrResourceProvider::kNoPendingIO_Flag == flags);
- if (!this->caps()->validateSurfaceDesc(desc, GrMipMapped::kNo)) {
+ 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;
}
- GrSurfaceDesc copyDesc = desc;
- if (desc.fFlags & kRenderTarget_GrSurfaceFlag) {
- copyDesc.fSampleCnt =
- this->caps()->getRenderTargetSampleCount(desc.fSampleCnt, desc.fConfig);
+
+ bool willBeRT = SkToBool(desc.fFlags & kRenderTarget_GrSurfaceFlag);
+ if (willBeRT && !caps->isConfigRenderable(desc.fConfig, desc.fSampleCnt > 0)) {
+ 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);
+
#ifdef SK_DISABLE_DEFERRED_PROXIES
// Temporarily force instantiation for crbug.com/769760 and crbug.com/769898
sk_sp<GrTexture> tex;
@@ -338,11 +361,11 @@ sk_sp<GrTextureProxy> GrProxyProvider::createProxy(const GrSurfaceDesc& desc,
return GrSurfaceProxy::MakeWrapped(std::move(tex), copyDesc.fOrigin);
#else
- if (copyDesc.fFlags & kRenderTarget_GrSurfaceFlag) {
+ if (willBeRT) {
// We know anything we instantiate later from this deferred path will be
// both texturable and renderable
- return sk_sp<GrTextureProxy>(
- new GrTextureRenderTargetProxy(*this->caps(), copyDesc, fit, budgeted, flags));
+ return sk_sp<GrTextureProxy>(new GrTextureRenderTargetProxy(*caps, copyDesc, fit,
+ budgeted, flags));
}
return sk_sp<GrTextureProxy>(new GrTextureProxy(copyDesc, fit, budgeted, nullptr, 0, flags));
@@ -482,7 +505,7 @@ sk_sp<GrTextureProxy> GrProxyProvider::createFullyLazyProxy(LazyInstantiateCallb
desc.fWidth = -1;
desc.fHeight = -1;
desc.fConfig = config;
- desc.fSampleCnt = 1;
+ desc.fSampleCnt = 0;
return this->createLazyProxy(std::move(callback), desc, GrMipMapped::kNo,
SkBackingFit::kApprox, SkBudgeted::kYes);