aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-05-30 13:55:58 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-05-30 13:55:58 +0000
commit6e7ddaae0a077a777b8b8872ec27f8faab275536 (patch)
tree872f00199db3396a6f31d1339c431a747a8432e6 /include
parent687a26defaa28ce1ede534bf199bbbfc92cee5a3 (diff)
Move the LATC and ETC1 enum values to GrPixelConfig. I also tried to put in checks in a few places to make sure that we weren't using these pixel configurations in places that we shouldn't be.
LATC is a DXT-esque alpha compression format that goes by a few other names (RGTC, 3DC). It might be useful to investigate using it to compress the alpha masks that we get from software rasterization. This patch set adds enums for that and recognition whether or not the device can support it. R=bsalomon@google.com, robertphillips@google.com Author: krajcevski@google.com Review URL: https://codereview.chromium.org/304743004 git-svn-id: http://skia.googlecode.com/svn/trunk@14991 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include')
-rw-r--r--include/gpu/GrColor.h4
-rw-r--r--include/gpu/GrTypes.h37
2 files changed, 26 insertions, 15 deletions
diff --git a/include/gpu/GrColor.h b/include/gpu/GrColor.h
index 183781ac3e..9f6eb1cde2 100644
--- a/include/gpu/GrColor.h
+++ b/include/gpu/GrColor.h
@@ -132,6 +132,8 @@ static inline uint32_t GrPixelConfigComponentMask(GrPixelConfig config) {
kRGBA_GrColorComponentFlags, // kRGBA_4444_GrPixelConfig
kRGBA_GrColorComponentFlags, // kRGBA_8888_GrPixelConfig
kRGBA_GrColorComponentFlags, // kBGRA_8888_GrPixelConfig
+ kRGB_GrColorComponentFlags, // kETC1_GrPixelConfig
+ kA_GrColorComponentFlag, // kLATC_GrPixelConfig
};
return kFlags[config];
@@ -142,6 +144,8 @@ static inline uint32_t GrPixelConfigComponentMask(GrPixelConfig config) {
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(SK_ARRAY_COUNT(kFlags) == kGrPixelConfigCnt);
}
diff --git a/include/gpu/GrTypes.h b/include/gpu/GrTypes.h
index 5868a39e7d..53e633da57 100644
--- a/include/gpu/GrTypes.h
+++ b/include/gpu/GrTypes.h
@@ -281,8 +281,16 @@ enum GrPixelConfig {
* Premultiplied. Byte order is b,g,r,a.
*/
kBGRA_8888_GrPixelConfig,
+ /**
+ * ETC1 Compressed Data
+ */
+ kETC1_GrPixelConfig,
+ /**
+ * LATC/RGTC/3Dc/BC4 Compressed Data
+ */
+ kLATC_GrPixelConfig,
- kLast_GrPixelConfig = kBGRA_8888_GrPixelConfig
+ kLast_GrPixelConfig = kLATC_GrPixelConfig
};
static const int kGrPixelConfigCnt = kLast_GrPixelConfig + 1;
@@ -298,6 +306,18 @@ static const int kGrPixelConfigCnt = kLast_GrPixelConfig + 1;
#error "SK_*32_SHIFT values must correspond to GL_BGRA or GL_RGBA format."
#endif
+// Returns true if the pixel config is a GPU-specific compressed format
+// representation.
+static inline bool GrPixelConfigIsCompressed(GrPixelConfig config) {
+ switch (config) {
+ case kETC1_GrPixelConfig:
+ case kLATC_GrPixelConfig:
+ return true;
+ default:
+ return false;
+ }
+}
+
// Returns true if the pixel config is 32 bits per pixel
static inline bool GrPixelConfigIs8888(GrPixelConfig config) {
switch (config) {
@@ -340,6 +360,7 @@ static inline size_t GrBytesPerPixel(GrPixelConfig config) {
static inline bool GrPixelConfigIsOpaque(GrPixelConfig config) {
switch (config) {
+ case kETC1_GrPixelConfig:
case kRGB_565_GrPixelConfig:
return true;
default:
@@ -620,20 +641,6 @@ enum GrGLBackendState {
};
/**
- * The compressed texture formats that may be supported by the renderer.
- * Make sure to check for the required capabilities using
- * GrDrawTargetCaps::compressedTextureSupport
- */
-enum GrCompressedFormat {
- kETC1_GrCompressedFormat,
- kETC2_GrCompressedFormat,
- kDXT1_GrCompressedFormat,
-
- kLast_GrCompressedFormat = kDXT1_GrCompressedFormat
-};
-static const int kGrCompressedFormatCount = kLast_GrCompressedFormat + 1;
-
-/**
* This value translates to reseting all the context state for any backend.
*/
static const uint32_t kAll_GrBackendState = 0xffffffff;