Fix another blurring bug with sRGB sources and legacy dests

By default, we propagate the input image's config to the temporary surface
used for blurring. Without sRGB write control (eg Vulkan), we would end up
unable to suppress the linear -> sRGB conversion, causing the blur results
to be far too bright. Now, if we're rendering to a non-color correct dest,
ensure that we never create an sRGB surface.

Bug: skia:
Change-Id: I18f5760005c11f788869251e58569029ce9f5c27
Reviewed-on: https://skia-review.googlesource.com/67845
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
This commit is contained in:
Brian Osman 2017-11-06 11:27:41 -05:00 committed by Skia Commit-Bot
parent e4aa0c4207
commit ce9c832c91

View File

@ -222,7 +222,15 @@ sk_sp<GrRenderTargetContext> GaussianBlur(GrContext* context,
// setup new clip
GrFixedClip clip(localDstBounds);
const GrPixelConfig config = srcProxy->config();
GrPixelConfig config = srcProxy->config();
if (GrPixelConfigIsSRGB(config) && !colorSpace) {
// If the context doesn't have sRGB write control, and we make an sRGB RTC, we won't be
// able to suppress the linear -> sRGB conversion out of the shader. Not all GL drivers
// have that feature, and Vulkan is missing it entirely. To keep things simple, switch to
// a non-sRGB destination, to ensure correct blurring behavior.
config = kRGBA_8888_GrPixelConfig;
}
SkASSERT(kBGRA_8888_GrPixelConfig == config || kRGBA_8888_GrPixelConfig == config ||
kRGBA_4444_GrPixelConfig == config || kRGB_565_GrPixelConfig == config ||