diff options
author | 2016-03-17 12:26:37 -0700 | |
---|---|---|
committer | 2016-03-17 12:26:37 -0700 | |
commit | 9e3f1bf4e5cd8fc59554f986f36d6b034e99f9eb (patch) | |
tree | 15fc5d36dc3c97fbcb8e634d23f3a87fe48685bc /include/gpu/GrColor.h | |
parent | 0e3129d734212089f872f0e7de8f2537861a3f89 (diff) |
sRGB support in Ganesh. Several pieces:
sRGB support now also requires GL_EXT_texture_sRGB_decode, which allows
us to disable sRGB -> Linear conversion when reading textures. This gives
us an easy way to support "legacy" L32 mode. We disable decoding based on
the pixel config of the render target. Textures can override that behavior
(specifically for format-conversion draws where we want that behavior).
Added sBGRA pixel config, which is not-really-a-format. It's just sRGBA
internally, and the external format is BGR order, so TexImage calls will
swizzle correctly. This lets us interact with sRGB raster surfaces on BGR
platforms.
Devices without sRGB support behave like they always have: conversion from
color type and profile type ignores sRGB and always returns linear pixel
configs.
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1789663002
Review URL: https://codereview.chromium.org/1789663002
Diffstat (limited to 'include/gpu/GrColor.h')
-rw-r--r-- | include/gpu/GrColor.h | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/include/gpu/GrColor.h b/include/gpu/GrColor.h index 6b83237626..77f1a6cb08 100644 --- a/include/gpu/GrColor.h +++ b/include/gpu/GrColor.h @@ -208,7 +208,6 @@ static inline char GrColorComponentFlagToChar(GrColorComponentFlags component) { } static inline uint32_t GrPixelConfigComponentMask(GrPixelConfig config) { - SkASSERT(config >= 0 && config < kGrPixelConfigCnt); static const uint32_t kFlags[] = { 0, // kUnknown_GrPixelConfig kA_GrColorComponentFlag, // kAlpha_8_GrPixelConfig @@ -218,6 +217,7 @@ static inline uint32_t GrPixelConfigComponentMask(GrPixelConfig config) { kRGBA_GrColorComponentFlags, // kRGBA_8888_GrPixelConfig kRGBA_GrColorComponentFlags, // kBGRA_8888_GrPixelConfig kRGBA_GrColorComponentFlags, // kSRGBA_8888_GrPixelConfig + kRGBA_GrColorComponentFlags, // kSBGRA_8888_GrPixelConfig kRGB_GrColorComponentFlags, // kETC1_GrPixelConfig kA_GrColorComponentFlag, // kLATC_GrPixelConfig kA_GrColorComponentFlag, // kR11_EAC_GrPixelConfig @@ -236,13 +236,14 @@ static inline uint32_t GrPixelConfigComponentMask(GrPixelConfig config) { GR_STATIC_ASSERT(5 == kRGBA_8888_GrPixelConfig); GR_STATIC_ASSERT(6 == kBGRA_8888_GrPixelConfig); GR_STATIC_ASSERT(7 == kSRGBA_8888_GrPixelConfig); - GR_STATIC_ASSERT(8 == kETC1_GrPixelConfig); - GR_STATIC_ASSERT(9 == kLATC_GrPixelConfig); - GR_STATIC_ASSERT(10 == kR11_EAC_GrPixelConfig); - GR_STATIC_ASSERT(11 == kASTC_12x12_GrPixelConfig); - GR_STATIC_ASSERT(12 == kRGBA_float_GrPixelConfig); - GR_STATIC_ASSERT(13 == kAlpha_half_GrPixelConfig); - GR_STATIC_ASSERT(14 == kRGBA_half_GrPixelConfig); + GR_STATIC_ASSERT(8 == kSBGRA_8888_GrPixelConfig); + GR_STATIC_ASSERT(9 == kETC1_GrPixelConfig); + GR_STATIC_ASSERT(10 == kLATC_GrPixelConfig); + GR_STATIC_ASSERT(11 == kR11_EAC_GrPixelConfig); + GR_STATIC_ASSERT(12 == kASTC_12x12_GrPixelConfig); + GR_STATIC_ASSERT(13 == kRGBA_float_GrPixelConfig); + GR_STATIC_ASSERT(14 == kAlpha_half_GrPixelConfig); + GR_STATIC_ASSERT(15 == kRGBA_half_GrPixelConfig); GR_STATIC_ASSERT(SK_ARRAY_COUNT(kFlags) == kGrPixelConfigCnt); } |