diff options
author | brianosman <brianosman@google.com> | 2016-04-14 12:39:00 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-04-14 12:39:00 -0700 |
commit | 6b08652abff788a251db82ca2b5f6b359ffe2590 (patch) | |
tree | b8a879ed17887fc61be769611b30f42d46ea8979 /src/gpu | |
parent | cbe3c1af987d622ea67ef560d855b41bb14a0ce9 (diff) |
Several fixes for fp 16 rendering:
With the GPU backend, allow F16 render targets to be created (along with
any other renderable format). We were previously just falling back to 8888.
In SampleApp, if the window configuration is F16, don't render directly
to the primary surface (which is actually sRGB 8888). Intead, make an
off-screen F16 surface, then blit it back to the framebuffer when we're done.
In DM, clamp values outside of [0,1]. These were wrapping, producing very
incorrect images. (Many filters can trigger out-of-range values due to
ringing).
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1890923003
Review URL: https://codereview.chromium.org/1890923003
Diffstat (limited to 'src/gpu')
-rw-r--r-- | src/gpu/SkGpuDevice.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp index 4d82b201e7..08eab55d26 100644 --- a/src/gpu/SkGpuDevice.cpp +++ b/src/gpu/SkGpuDevice.cpp @@ -191,15 +191,19 @@ GrRenderTarget* SkGpuDevice::CreateRenderTarget(GrContext* context, SkBudgeted b SkColorType ct = origInfo.colorType(); SkAlphaType at = origInfo.alphaType(); SkColorProfileType pt = origInfo.profileType(); - if (kRGB_565_SkColorType == ct) { + if (kRGB_565_SkColorType == ct || kGray_8_SkColorType == ct) { at = kOpaque_SkAlphaType; // force this setting - } else if (ct != kBGRA_8888_SkColorType && ct != kRGBA_8888_SkColorType) { - // Fall back from whatever ct was to default of kRGBA or kBGRA which is aliased as kN32 - ct = kN32_SkColorType; } if (kOpaque_SkAlphaType != at) { at = kPremul_SkAlphaType; // force this setting } + + GrPixelConfig origConfig = SkImageInfo2GrPixelConfig(ct, at, pt, *context->caps()); + if (!context->caps()->isConfigRenderable(origConfig, sampleCount > 0)) { + // Fall back from whatever ct was to default of kRGBA or kBGRA which is aliased as kN32 + ct = kN32_SkColorType; + } + const SkImageInfo info = SkImageInfo::Make(origInfo.width(), origInfo.height(), ct, at, pt); GrSurfaceDesc desc; |