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

Unified Diff: src/gpu/GrTexture.cpp

Issue 1810323002: Cache render targets that render to wrapped textures Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 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/GrTexture.cpp
diff --git a/src/gpu/GrTexture.cpp b/src/gpu/GrTexture.cpp
index 28746b93056fa4361230f5e973814f24d60b4c36..9a8754bb119b2700eda512a3c4c525911aa75f92 100644
--- a/src/gpu/GrTexture.cpp
+++ b/src/gpu/GrTexture.cpp
@@ -51,7 +51,6 @@ size_t GrTexture::onGpuMemorySize() const {
textureSize += textureSize/3;
}
- SkASSERT(!SkToBool(fDesc.fFlags & kRenderTarget_GrSurfaceFlag));
SkASSERT(textureSize <= WorseCaseSize(fDesc));
return textureSize;
@@ -87,17 +86,10 @@ GrSurfaceOrigin resolve_origin(const GrSurfaceDesc& desc) {
}
//////////////////////////////////////////////////////////////////////////////
-GrTexture::GrTexture(GrGpu* gpu, LifeCycle lifeCycle, const GrSurfaceDesc& desc,
+GrTexture::GrTexture(GrGpu* gpu, SkBudgeted budgeted, const GrSurfaceDesc& desc,
GrSLType samplerType, bool wasMipMapDataProvided)
- : INHERITED(gpu, lifeCycle, desc)
+ : INHERITED(gpu, budgeted, desc)
, fSamplerType(samplerType) {
- if (!this->isExternal() && !GrPixelConfigIsCompressed(desc.fConfig) &&
- !desc.fTextureStorageAllocator.fAllocateTextureStorage) {
- GrScratchKey key;
- GrTexturePriv::ComputeScratchKey(desc, &key);
- this->setScratchKey(key);
- }
-
if (wasMipMapDataProvided) {
fMipMapsStatus = kValid_MipMapsStatus;
fMaxMipMapLevel = SkMipMap::ComputeLevelCount(fDesc.fWidth, fDesc.fHeight);
@@ -107,6 +99,15 @@ GrTexture::GrTexture(GrGpu* gpu, LifeCycle lifeCycle, const GrSurfaceDesc& desc,
}
}
+void GrTexture::initScratchKeyIfNeeded() {
+ if (!this->refsWrappedResources() && !GrPixelConfigIsCompressed(fDesc.fConfig) &&
+ !fDesc.fTextureStorageAllocator.fAllocateTextureStorage) {
+ GrScratchKey key;
+ GrTexturePriv::ComputeScratchKey(fDesc, &key);
+ this->setScratchKey(key);
+ }
+}
+
void GrTexturePriv::ComputeScratchKey(const GrSurfaceDesc& desc, GrScratchKey* key) {
static const GrScratchKey::ResourceType kType = GrScratchKey::GenerateResourceType();
« no previous file with comments | « src/gpu/GrTest.cpp ('k') | src/gpu/GrTextureProvider.cpp » ('j') | src/gpu/gl/GrGLGpu.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698