aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/image
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/image
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/image')
-rw-r--r--src/image/SkImage_Gpu.cpp9
-rw-r--r--src/image/SkImage_Lazy.cpp5
-rw-r--r--src/image/SkSurface.cpp4
-rw-r--r--src/image/SkSurface_Gpu.cpp20
4 files changed, 19 insertions, 19 deletions
diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp
index a136c7b49c..c00c50d000 100644
--- a/src/image/SkImage_Gpu.cpp
+++ b/src/image/SkImage_Gpu.cpp
@@ -438,8 +438,13 @@ static sk_sp<SkImage> make_from_yuv_textures_copy(GrContext* ctx, SkYUVColorSpac
// Needs to be a render target in order to draw to it for the yuv->rgb conversion.
sk_sp<GrRenderTargetContext> renderTargetContext(ctx->makeDeferredRenderTargetContext(
- SkBackingFit::kExact, width, height, kRGBA_8888_GrPixelConfig,
- std::move(imageColorSpace), 1, GrMipMapped::kNo, origin));
+ SkBackingFit::kExact,
+ width, height,
+ kRGBA_8888_GrPixelConfig,
+ std::move(imageColorSpace),
+ 0,
+ GrMipMapped::kNo,
+ origin));
if (!renderTargetContext) {
return nullptr;
}
diff --git a/src/image/SkImage_Lazy.cpp b/src/image/SkImage_Lazy.cpp
index 92d3a2fed9..ed4683542f 100644
--- a/src/image/SkImage_Lazy.cpp
+++ b/src/image/SkImage_Lazy.cpp
@@ -267,8 +267,9 @@ struct CacheCaps {
#if SK_SUPPORT_GPU
bool supportsHalfFloat() const {
- return !fCaps || (fCaps->isConfigTexturable(kRGBA_half_GrPixelConfig) &&
- fCaps->isConfigRenderable(kRGBA_half_GrPixelConfig));
+ return !fCaps ||
+ (fCaps->isConfigTexturable(kRGBA_half_GrPixelConfig) &&
+ fCaps->isConfigRenderable(kRGBA_half_GrPixelConfig, false));
}
bool supportsSRGB() const {
diff --git a/src/image/SkSurface.cpp b/src/image/SkSurface.cpp
index ef6d809957..0a684cce60 100644
--- a/src/image/SkSurface.cpp
+++ b/src/image/SkSurface.cpp
@@ -247,8 +247,8 @@ sk_sp<SkSurface> SkSurface::MakeNull(int width, int height) {
#if !SK_SUPPORT_GPU
-sk_sp<SkSurface> SkSurface::MakeRenderTarget(GrContext*, SkBudgeted, const SkImageInfo&, int,
- GrSurfaceOrigin, const SkSurfaceProps*, bool) {
+sk_sp<SkSurface> SkSurface::MakeRenderTarget(GrContext*, SkBudgeted, const SkImageInfo&,
+ int, GrSurfaceOrigin, const SkSurfaceProps*, bool) {
return nullptr;
}
diff --git a/src/image/SkSurface_Gpu.cpp b/src/image/SkSurface_Gpu.cpp
index 8759f3eeed..9f7ec3b7f5 100644
--- a/src/image/SkSurface_Gpu.cpp
+++ b/src/image/SkSurface_Gpu.cpp
@@ -256,7 +256,7 @@ sk_sp<SkSurface> SkSurface::MakeRenderTarget(GrContext* ctx, SkBudgeted budgeted
if (!SkSurface_Gpu::Valid(info)) {
return nullptr;
}
- sampleCount = SkTMax(1, sampleCount);
+
GrMipMapped mipMapped = shouldCreateWithMips ? GrMipMapped::kYes : GrMipMapped::kNo;
if (!ctx->caps()->mipMapSupport()) {
@@ -299,7 +299,6 @@ sk_sp<SkSurface> SkSurface::MakeFromBackendTexture(GrContext* context, const GrB
if (!SkSurface_Gpu::Valid(context, tex.config(), colorSpace.get())) {
return nullptr;
}
- sampleCnt = SkTMax(1, sampleCnt);
sk_sp<GrRenderTargetContext> rtc(context->contextPriv().makeBackendTextureRenderTargetContext(
tex,
@@ -334,9 +333,11 @@ bool validate_backend_texture(GrContext* ctx, const GrBackendTexture& tex, GrPix
return false;
}
- // We don't require that the client gave us an exact valid sample cnt. However, it must be
- // less than the max supported sample count and 1 if MSAA is unsupported for the color type.
- if (!ctx->caps()->getRenderTargetSampleCount(sampleCnt, *config)) {
+ if (!ctx->caps()->isConfigRenderable(*config, sampleCnt > 0)) {
+ return false;
+ }
+
+ if (ctx->caps()->getSampleCount(sampleCnt, *config) != sampleCnt) {
return false;
}
@@ -354,7 +355,6 @@ sk_sp<SkSurface> SkSurface::MakeFromBackendTexture(GrContext* context, const GrB
if (!context) {
return nullptr;
}
- sampleCnt = SkTMax(1, sampleCnt);
GrBackendTexture texCopy = tex;
if (!validate_backend_texture(context, texCopy, &texCopy.fConfig,
sampleCnt, colorType, colorSpace, true)) {
@@ -409,11 +409,7 @@ bool validate_backend_render_target(GrContext* ctx, const GrBackendRenderTarget&
return false;
}
- if (rt.sampleCnt() > 1) {
- if (ctx->caps()->maxRenderTargetSampleCount(*config) <= 1) {
- return false;
- }
- } else if (ctx->caps()->isConfigRenderable(*config)) {
+ if (!ctx->caps()->isConfigRenderable(*config, false)) {
return false;
}
@@ -449,7 +445,6 @@ sk_sp<SkSurface> SkSurface::MakeFromBackendTextureAsRenderTarget(GrContext* cont
if (!SkSurface_Gpu::Valid(context, tex.config(), colorSpace.get())) {
return nullptr;
}
- sampleCnt = SkTMax(1, sampleCnt);
sk_sp<GrRenderTargetContext> rtc(
context->contextPriv().makeBackendTextureAsRenderTargetRenderTargetContext(
@@ -480,7 +475,6 @@ sk_sp<SkSurface> SkSurface::MakeFromBackendTextureAsRenderTarget(GrContext* cont
if (!context) {
return nullptr;
}
- sampleCnt = SkTMax(1, sampleCnt);
GrBackendTexture texCopy = tex;
if (!validate_backend_texture(context, texCopy, &texCopy.fConfig,
sampleCnt, colorType, colorSpace, false)) {