Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1582)

Unified Diff: include/gpu/GrTypes.h

Issue 302783002: Initial work to get ETC1 data up to the GPU (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix some code clarity issues Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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;

Powered by Google App Engine
This is Rietveld 408576698