Index: include/gpu/GrTypes.h |
diff --git a/include/gpu/GrTypes.h b/include/gpu/GrTypes.h |
index 5868a39e7d22add6a914351a166d6d28e0d08188..ba40718a06d3c3a07e15b36e5a74941e60e8bba2 100644 |
--- a/include/gpu/GrTypes.h |
+++ b/include/gpu/GrTypes.h |
@@ -634,6 +634,37 @@ enum GrCompressedFormat { |
static const int kGrCompressedFormatCount = kLast_GrCompressedFormat + 1; |
/** |
+ * This structure contains relevant information for the various kinds of |
+ * compressed texture formats. The information is used when determining |
+ * data size of compressed textures for a given width and height, along |
+ * with how to properly index into compressed textures for a given pixel |
+ * location. |
+ */ |
+struct GrCompressedFormatDesc { |
+ int fBlockSizeX; |
+ int fBlockSizeY; |
+ int fBytesPerBlock; |
+}; |
+ |
+static inline GrCompressedFormatDesc |
+GrGetCompressedFormatDesc(GrCompressedFormat fmt) { |
+ GrCompressedFormatDesc desc; |
+ switch (fmt) { |
+ case kETC1_GrCompressedFormat: |
+ case kETC2_GrCompressedFormat: |
+ case kDXT1_GrCompressedFormat: |
+ desc.fBlockSizeX = 4; |
+ desc.fBlockSizeY = 4; |
+ desc.fBytesPerBlock = 4; |
robertphillips
2014/05/27 22:01:50
break; ?
krajcevski
2014/05/27 22:19:29
Done.
|
+ |
+ default: |
+ SkASSERT(!"Unknown compressed format!"); |
+ break; |
+ } |
+ return desc; |
+} |
+ |
+/** |
* This value translates to reseting all the context state for any backend. |
*/ |
static const uint32_t kAll_GrBackendState = 0xffffffff; |