diff options
author | krajcevski <krajcevski@google.com> | 2014-07-16 15:21:13 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-07-16 15:21:14 -0700 |
commit | 7ef21622b2ed6b9c5fc4c149cb62944fc191f054 (patch) | |
tree | 1d75c59576fe9b193cdcab6c9995012295fa5dcd /include | |
parent | 03f3db02c10d82ccbb4e3d3bd12fac689ce91fc6 (diff) |
Add new ASTC pixel config
R=bsalomon@google.com, robertphillips@google.com
Author: krajcevski@google.com
Review URL: https://codereview.chromium.org/399623004
Diffstat (limited to 'include')
-rw-r--r-- | include/gpu/GrColor.h | 24 | ||||
-rw-r--r-- | include/gpu/GrTypes.h | 19 |
2 files changed, 32 insertions, 11 deletions
diff --git a/include/gpu/GrColor.h b/include/gpu/GrColor.h index af394d713b..c53e4b219d 100644 --- a/include/gpu/GrColor.h +++ b/include/gpu/GrColor.h @@ -135,21 +135,23 @@ static inline uint32_t GrPixelConfigComponentMask(GrPixelConfig config) { kRGB_GrColorComponentFlags, // kETC1_GrPixelConfig kA_GrColorComponentFlag, // kLATC_GrPixelConfig kA_GrColorComponentFlag, // kR11_EAC_GrPixelConfig + kRGBA_GrColorComponentFlags, // kASTC_12x12_GrPixelConfig kRGBA_GrColorComponentFlags, // kRGBA_float_GrPixelConfig }; return kFlags[config]; - GR_STATIC_ASSERT(0 == kUnknown_GrPixelConfig); - GR_STATIC_ASSERT(1 == kAlpha_8_GrPixelConfig); - GR_STATIC_ASSERT(2 == kIndex_8_GrPixelConfig); - GR_STATIC_ASSERT(3 == kRGB_565_GrPixelConfig); - GR_STATIC_ASSERT(4 == kRGBA_4444_GrPixelConfig); - GR_STATIC_ASSERT(5 == kRGBA_8888_GrPixelConfig); - GR_STATIC_ASSERT(6 == kBGRA_8888_GrPixelConfig); - GR_STATIC_ASSERT(7 == kETC1_GrPixelConfig); - GR_STATIC_ASSERT(8 == kLATC_GrPixelConfig); - GR_STATIC_ASSERT(9 == kR11_EAC_GrPixelConfig); - GR_STATIC_ASSERT(10 == kRGBA_float_GrPixelConfig); + GR_STATIC_ASSERT(0 == kUnknown_GrPixelConfig); + GR_STATIC_ASSERT(1 == kAlpha_8_GrPixelConfig); + GR_STATIC_ASSERT(2 == kIndex_8_GrPixelConfig); + GR_STATIC_ASSERT(3 == kRGB_565_GrPixelConfig); + GR_STATIC_ASSERT(4 == kRGBA_4444_GrPixelConfig); + GR_STATIC_ASSERT(5 == kRGBA_8888_GrPixelConfig); + GR_STATIC_ASSERT(6 == kBGRA_8888_GrPixelConfig); + GR_STATIC_ASSERT(7 == kETC1_GrPixelConfig); + GR_STATIC_ASSERT(8 == kLATC_GrPixelConfig); + GR_STATIC_ASSERT(9 == kR11_EAC_GrPixelConfig); + GR_STATIC_ASSERT(10 == kASTC_12x12_GrPixelConfig); + GR_STATIC_ASSERT(11 == kRGBA_float_GrPixelConfig); GR_STATIC_ASSERT(SK_ARRAY_COUNT(kFlags) == kGrPixelConfigCnt); } diff --git a/include/gpu/GrTypes.h b/include/gpu/GrTypes.h index db013e33e5..0a73be9d85 100644 --- a/include/gpu/GrTypes.h +++ b/include/gpu/GrTypes.h @@ -287,6 +287,19 @@ enum GrPixelConfig { * (Corresponds to section C.3.5 of the OpenGL 4.4 core profile spec) */ kR11_EAC_GrPixelConfig, + + /** + * 12x12 ASTC Compressed Data + * ASTC stands for Adaptive Scalable Texture Compression. It is a technique + * that allows for a lot of customization in the compressed representataion + * of a block. The only thing fixed in the representation is the block size, + * which means that a texture that contains ASTC data must be treated as + * having RGBA values. However, there are single-channel encodings which set + * the alpha to opaque and all three RGB channels equal effectively making the + * compression format a single channel such as R11 EAC and LATC. + */ + kASTC_12x12_GrPixelConfig, + /** * Byte order is r, g, b, a. This color format is 32 bits per channel */ @@ -314,6 +327,7 @@ static inline bool GrPixelConfigIsCompressed(GrPixelConfig config) { case kETC1_GrPixelConfig: case kLATC_GrPixelConfig: case kR11_EAC_GrPixelConfig: + case kASTC_12x12_GrPixelConfig: return true; default: return false; @@ -678,6 +692,11 @@ static inline size_t GrCompressedFormatDataSize(GrPixelConfig config, SkASSERT((height & 3) == 0); return (width >> 2) * (height >> 2) * 8; + case kASTC_12x12_GrPixelConfig: + SkASSERT((width % 12) == 0); + SkASSERT((height % 12) == 0); + return (width / 12) * (height / 12) * 16; + default: SkFAIL("Unknown compressed pixel config"); return 4 * width * height; |