Add support for SRGB formats when validating backend formats and ColorTypes

Bug: skia:
Change-Id: I4413e8e629528608d773d41c6a4a4306eff154c8
Reviewed-on: https://skia-review.googlesource.com/85045
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
This commit is contained in:
Greg Daniel 2017-12-18 14:49:04 -05:00 committed by Skia Commit-Bot
parent f5d8758f29
commit 7b219ac45d
2 changed files with 8 additions and 0 deletions

View File

@ -2392,11 +2392,15 @@ bool GrGLCaps::onValidateBackendTexture(GrBackendTexture* tex, SkColorType ct) c
case kRGBA_8888_SkColorType: case kRGBA_8888_SkColorType:
if (GR_GL_RGBA8 == format) { if (GR_GL_RGBA8 == format) {
tex->fConfig = kRGBA_8888_GrPixelConfig; tex->fConfig = kRGBA_8888_GrPixelConfig;
} else if (GR_GL_SRGB8_ALPHA8 == format) {
tex->fConfig = kSRGBA_8888_GrPixelConfig;
} }
break; break;
case kBGRA_8888_SkColorType: case kBGRA_8888_SkColorType:
if (GR_GL_BGRA8 == format) { if (GR_GL_BGRA8 == format) {
tex->fConfig = kBGRA_8888_GrPixelConfig; tex->fConfig = kBGRA_8888_GrPixelConfig;
} else if (GR_GL_SRGB8_ALPHA8 == format) {
tex->fConfig = kSBGRA_8888_GrPixelConfig;
} }
break; break;
case kGray_8_SkColorType: case kGray_8_SkColorType:

View File

@ -444,11 +444,15 @@ bool GrVkCaps::onValidateBackendTexture(GrBackendTexture* tex, SkColorType ct) c
case kRGBA_8888_SkColorType: case kRGBA_8888_SkColorType:
if (VK_FORMAT_R8G8B8A8_UNORM == format) { if (VK_FORMAT_R8G8B8A8_UNORM == format) {
tex->fConfig = kRGBA_8888_GrPixelConfig; tex->fConfig = kRGBA_8888_GrPixelConfig;
} else if (VK_FORMAT_R8G8B8A8_SRGB == format) {
tex->fConfig = kSRGBA_8888_GrPixelConfig;
} }
break; break;
case kBGRA_8888_SkColorType: case kBGRA_8888_SkColorType:
if (VK_FORMAT_B8G8R8A8_UNORM == format) { if (VK_FORMAT_B8G8R8A8_UNORM == format) {
tex->fConfig = kBGRA_8888_GrPixelConfig; tex->fConfig = kBGRA_8888_GrPixelConfig;
} else if (VK_FORMAT_B8G8R8A8_SRGB == format) {
tex->fConfig = kSBGRA_8888_GrPixelConfig;
} }
break; break;
case kGray_8_SkColorType: case kGray_8_SkColorType: