aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar krajcevski <krajcevski@google.com>2014-06-02 07:38:14 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-06-02 07:38:15 -0700
commit9c0e629c64c0fa93ac9bf5c2eaa1821370a6fbe5 (patch)
tree56cb6c4e0ffa6b72d3054f526d1ce3892fdbcf23 /include
parentb30aa62294733c8dda1b7bbfa4fe9df688513e84 (diff)
Initial work to get ETC1 data up to the GPU
Committed: http://code.google.com/p/skia/source/detail?r=15001 R=bsalomon@google.com, robertphillips@google.com Author: krajcevski@google.com Review URL: https://codereview.chromium.org/302783002
Diffstat (limited to 'include')
-rw-r--r--include/gpu/GrContext.h6
-rw-r--r--include/gpu/GrTypes.h20
2 files changed, 23 insertions, 3 deletions
diff --git a/include/gpu/GrContext.h b/include/gpu/GrContext.h
index 5b7ef25ced..c54f2e6b23 100644
--- a/include/gpu/GrContext.h
+++ b/include/gpu/GrContext.h
@@ -204,10 +204,11 @@ public:
* for different wrap modes on GPUs with limited NPOT
* texture support). NULL implies clamp wrap modes.
* @param desc Description of the texture properties.
- * @param cacheID Cache-specific properties (e.g., texture gen ID)
+ * @param cacheID Cache-specific properties (e.g., texture gen ID)
* @param srcData Pointer to the pixel values.
* @param rowBytes The number of bytes between rows of the texture. Zero
- * implies tightly packed rows.
+ * implies tightly packed rows. For compressed pixel configs, this
+ * field is ignored.
* @param cacheKey (optional) If non-NULL, we'll write the cache key we used to cacheKey.
*/
GrTexture* createTexture(const GrTextureParams* params,
@@ -216,7 +217,6 @@ public:
const void* srcData,
size_t rowBytes,
GrResourceKey* cacheKey = NULL);
-
/**
* Search for an entry based on key and dimensions. If found, ref it and return it. The return
* value will be NULL if not found. The caller must balance with a call to unref.
diff --git a/include/gpu/GrTypes.h b/include/gpu/GrTypes.h
index 53e633da57..34f4e2827d 100644
--- a/include/gpu/GrTypes.h
+++ b/include/gpu/GrTypes.h
@@ -641,6 +641,26 @@ enum GrGLBackendState {
};
/**
+ * Returns the data size for the given compressed pixel config
+ */
+static inline size_t GrCompressedFormatDataSize(GrPixelConfig config,
+ int width, int height) {
+ SkASSERT(GrPixelConfigIsCompressed(config));
+
+ switch (config) {
+ case kLATC_GrPixelConfig:
+ case kETC1_GrPixelConfig:
+ SkASSERT((width & 3) == 0);
+ SkASSERT((height & 3) == 0);
+ return (width >> 2) * (height >> 2) * 8;
+
+ default:
+ SkFAIL("Unknown compressed pixel config");
+ return 4 * width * height;
+ }
+}
+
+/**
* This value translates to reseting all the context state for any backend.
*/
static const uint32_t kAll_GrBackendState = 0xffffffff;