aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrResourceProvider.cpp
diff options
context:
space:
mode:
authorGravatar Brian Salomon <bsalomon@google.com>2018-02-02 13:51:50 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-02-02 23:37:59 +0000
commit5bb82cbecd740d21b92e8d2944280ab6eb6af7a6 (patch)
tree8171a4ea5d7f72dbba276b58a89a7e115066f24c /src/gpu/GrResourceProvider.cpp
parent1e5ef4f81ca18cd9448426891cda5120cea51de8 (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/GrResourceProvider.cpp')
-rw-r--r--src/gpu/GrResourceProvider.cpp34
1 files changed, 6 insertions, 28 deletions
diff --git a/src/gpu/GrResourceProvider.cpp b/src/gpu/GrResourceProvider.cpp
index 3800383581..ec94968e21 100644
--- a/src/gpu/GrResourceProvider.cpp
+++ b/src/gpu/GrResourceProvider.cpp
@@ -46,28 +46,6 @@ GrResourceProvider::GrResourceProvider(GrGpu* gpu, GrResourceCache* cache, GrSin
fQuadIndexBufferKey = gQuadIndexBufferKey;
}
-bool validate_desc(const GrSurfaceDesc& desc, const GrCaps& caps, int levelCount = 0) {
- if (desc.fWidth <= 0 || desc.fHeight <= 0) {
- return false;
- }
- if (!caps.isConfigTexturable(desc.fConfig)) {
- return false;
- }
- if (desc.fFlags & kRenderTarget_GrSurfaceFlag) {
- if (!caps.isConfigRenderable(desc.fConfig, desc.fSampleCnt > 0)) {
- return false;
- }
- } else {
- if (desc.fSampleCnt) {
- return false;
- }
- }
- if (levelCount > 1 && (GrPixelConfigIsSint(desc.fConfig) || !caps.mipMapSupport())) {
- return false;
- }
- return true;
-}
-
sk_sp<GrTexture> GrResourceProvider::createTexture(const GrSurfaceDesc& desc, SkBudgeted budgeted,
const GrMipLevel texels[], int mipLevelCount,
SkDestinationSurfaceColorMode mipColorMode) {
@@ -79,7 +57,8 @@ sk_sp<GrTexture> GrResourceProvider::createTexture(const GrSurfaceDesc& desc, Sk
return nullptr;
}
- if (!validate_desc(desc, *fCaps, mipLevelCount)) {
+ GrMipMapped mipMapped = mipLevelCount > 1 ? GrMipMapped::kYes : GrMipMapped::kNo;
+ if (!fCaps->validateSurfaceDesc(desc, mipMapped)) {
return nullptr;
}
@@ -125,7 +104,7 @@ sk_sp<GrTexture> GrResourceProvider::createTexture(const GrSurfaceDesc& desc,
return nullptr;
}
- if (!validate_desc(desc, *fCaps)) {
+ if (!fCaps->validateSurfaceDesc(desc, GrMipMapped::kNo)) {
return nullptr;
}
@@ -157,12 +136,11 @@ sk_sp<GrTexture> GrResourceProvider::createTexture(const GrSurfaceDesc& desc,
sk_sp<GrTexture> GrResourceProvider::createTexture(const GrSurfaceDesc& desc, SkBudgeted budgeted,
uint32_t flags) {
ASSERT_SINGLE_OWNER
-
if (this->isAbandoned()) {
return nullptr;
}
- if (!validate_desc(desc, *fCaps)) {
+ if (!fCaps->validateSurfaceDesc(desc, GrMipMapped::kNo)) {
return nullptr;
}
@@ -183,7 +161,7 @@ sk_sp<GrTexture> GrResourceProvider::createApproxTexture(const GrSurfaceDesc& de
return nullptr;
}
- if (!validate_desc(desc, *fCaps)) {
+ if (!fCaps->validateSurfaceDesc(desc, GrMipMapped::kNo)) {
return nullptr;
}
@@ -212,7 +190,7 @@ sk_sp<GrTexture> GrResourceProvider::refScratchTexture(const GrSurfaceDesc& desc
uint32_t flags) {
ASSERT_SINGLE_OWNER
SkASSERT(!this->isAbandoned());
- SkASSERT(validate_desc(desc, *fCaps));
+ SkASSERT(fCaps->validateSurfaceDesc(desc, GrMipMapped::kNo));
// We could make initial clears work with scratch textures but it is a rare case so we just opt
// to fall back to making a new texture.