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

Side by Side 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: Add #define to not always compile in ETC1 support Created 6 years, 6 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 unified diff | Download patch
« no previous file with comments | « include/gpu/GrTypes.h ('k') | src/gpu/GrGpu.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "GrContext.h" 10 #include "GrContext.h"
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 GrTexture* GrContext::createTexture(const GrTextureParams* params, 381 GrTexture* GrContext::createTexture(const GrTextureParams* params,
382 const GrTextureDesc& desc, 382 const GrTextureDesc& desc,
383 const GrCacheID& cacheID, 383 const GrCacheID& cacheID,
384 const void* srcData, 384 const void* srcData,
385 size_t rowBytes, 385 size_t rowBytes,
386 GrResourceKey* cacheKey) { 386 GrResourceKey* cacheKey) {
387 GrResourceKey resourceKey = GrTextureImpl::ComputeKey(fGpu, params, desc, ca cheID); 387 GrResourceKey resourceKey = GrTextureImpl::ComputeKey(fGpu, params, desc, ca cheID);
388 388
389 GrTexture* texture; 389 GrTexture* texture;
390 if (GrTextureImpl::NeedsResizing(resourceKey)) { 390 if (GrTextureImpl::NeedsResizing(resourceKey)) {
391 // We do not know how to resize compressed textures.
392 SkASSERT(!GrPixelConfigIsCompressed(desc.fConfig));
393
391 texture = this->createResizedTexture(desc, cacheID, 394 texture = this->createResizedTexture(desc, cacheID,
392 srcData, rowBytes, 395 srcData, rowBytes,
393 GrTextureImpl::NeedsBilerp(resource Key)); 396 GrTextureImpl::NeedsBilerp(resource Key));
394 } else { 397 } else {
395 texture= fGpu->createTexture(desc, srcData, rowBytes); 398 texture = fGpu->createTexture(desc, srcData, rowBytes);
396 } 399 }
397 400
398 if (NULL != texture) { 401 if (NULL != texture) {
399 // Adding a resource could put us overbudget. Try to free up the 402 // Adding a resource could put us overbudget. Try to free up the
400 // necessary space before adding it. 403 // necessary space before adding it.
401 fResourceCache->purgeAsNeeded(1, texture->gpuMemorySize()); 404 fResourceCache->purgeAsNeeded(1, texture->gpuMemorySize());
402 fResourceCache->addResource(resourceKey, texture); 405 fResourceCache->addResource(resourceKey, texture);
403 406
404 if (NULL != cacheKey) { 407 if (NULL != cacheKey) {
405 *cacheKey = resourceKey; 408 *cacheKey = resourceKey;
(...skipping 1429 matching lines...) Expand 10 before | Expand all | Expand 10 after
1835 SkSafeRef(resource); 1838 SkSafeRef(resource);
1836 return resource; 1839 return resource;
1837 } 1840 }
1838 1841
1839 /////////////////////////////////////////////////////////////////////////////// 1842 ///////////////////////////////////////////////////////////////////////////////
1840 #if GR_CACHE_STATS 1843 #if GR_CACHE_STATS
1841 void GrContext::printCacheStats() const { 1844 void GrContext::printCacheStats() const {
1842 fResourceCache->printStats(); 1845 fResourceCache->printStats();
1843 } 1846 }
1844 #endif 1847 #endif
OLDNEW
« no previous file with comments | « include/gpu/GrTypes.h ('k') | src/gpu/GrGpu.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698