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

Unified Diff: src/gpu/GrContext.cpp

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: src/gpu/GrContext.cpp
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index baa002a54a5a0c387789e78b1003f4dc4399e955..3d29c9051fd39f7a747af6882a63ff0b1f7df801 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -407,6 +407,33 @@ GrTexture* GrContext::createTexture(const GrTextureParams* params,
return texture;
}
+GrTexture* GrContext::createCompressedTexture(const GrTextureParams* params,
+ const GrTextureDesc& desc,
+ const GrCacheID& cacheID,
+ const void* srcData,
+ GrCompressedFormat format,
+ GrResourceKey* cacheKey) {
+ GrResourceKey resourceKey = GrTextureImpl::ComputeKey(fGpu, params, desc, cacheID);
+
+ GrTexture* texture = NULL;
+ if (!GrTextureImpl::NeedsResizing(resourceKey)) {
+ texture = fGpu->createCompressedTexture(desc, srcData, format);
+ }
+
+ if (NULL != texture) {
+ // Adding a resource could put us overbudget. Try to free up the
+ // necessary space before adding it.
+ fResourceCache->purgeAsNeeded(1, texture->gpuMemorySize());
+ fResourceCache->addResource(resourceKey, texture);
+
+ if (NULL != cacheKey) {
+ *cacheKey = resourceKey;
+ }
+ }
+
+ return texture;
+}
+
static GrTexture* create_scratch_texture(GrGpu* gpu,
GrResourceCache* resourceCache,
const GrTextureDesc& desc) {

Powered by Google App Engine
This is Rietveld 408576698