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

Side by Side Diff: src/gpu/GrTexture.cpp

Issue 1793383002: Only recycle "kSampler2D" textures as scratch (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase for demo; do not submit 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | 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 #include "GrContext.h" 9 #include "GrContext.h"
10 #include "GrCaps.h" 10 #include "GrCaps.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 } 85 }
86 } 86 }
87 } 87 }
88 88
89 ////////////////////////////////////////////////////////////////////////////// 89 //////////////////////////////////////////////////////////////////////////////
90 GrTexture::GrTexture(GrGpu* gpu, LifeCycle lifeCycle, const GrSurfaceDesc& desc, 90 GrTexture::GrTexture(GrGpu* gpu, LifeCycle lifeCycle, const GrSurfaceDesc& desc,
91 GrSLType samplerType, bool wasMipMapDataProvided) 91 GrSLType samplerType, bool wasMipMapDataProvided)
92 : INHERITED(gpu, lifeCycle, desc) 92 : INHERITED(gpu, lifeCycle, desc)
93 , fSamplerType(samplerType) { 93 , fSamplerType(samplerType) {
94 if (!this->isExternal() && !GrPixelConfigIsCompressed(desc.fConfig) && 94 if (!this->isExternal() && !GrPixelConfigIsCompressed(desc.fConfig) &&
95 !desc.fTextureStorageAllocator.fAllocateTextureStorage) { 95 !desc.fTextureStorageAllocator.fAllocateTextureStorage &&
96 kSampler2D_GrSLType == samplerType) {
96 GrScratchKey key; 97 GrScratchKey key;
97 GrTexturePriv::ComputeScratchKey(desc, &key); 98 GrTexturePriv::ComputeScratchKey(desc, &key);
98 this->setScratchKey(key); 99 this->setScratchKey(key);
99 } 100 }
100 101
101 if (wasMipMapDataProvided) { 102 if (wasMipMapDataProvided) {
102 fMipMapsStatus = kValid_MipMapsStatus; 103 fMipMapsStatus = kValid_MipMapsStatus;
103 fMaxMipMapLevel = SkMipMap::ComputeLevelCount(fDesc.fWidth, fDesc.fHeigh t); 104 fMaxMipMapLevel = SkMipMap::ComputeLevelCount(fDesc.fWidth, fDesc.fHeigh t);
104 } else { 105 } else {
105 fMipMapsStatus = kNotAllocated_MipMapsStatus; 106 fMipMapsStatus = kNotAllocated_MipMapsStatus;
(...skipping 13 matching lines...) Expand all
119 SkASSERT(desc.fSampleCnt < (1 << 8)); 120 SkASSERT(desc.fSampleCnt < (1 << 8));
120 SkASSERT(flags < (1 << 10)); 121 SkASSERT(flags < (1 << 10));
121 SkASSERT(static_cast<int>(origin) < (1 << 8)); 122 SkASSERT(static_cast<int>(origin) < (1 << 8));
122 123
123 GrScratchKey::Builder builder(key, kType, 3); 124 GrScratchKey::Builder builder(key, kType, 3);
124 builder[0] = desc.fWidth; 125 builder[0] = desc.fWidth;
125 builder[1] = desc.fHeight; 126 builder[1] = desc.fHeight;
126 builder[2] = desc.fConfig | (desc.fIsMipMapped << 5) | (desc.fSampleCnt << 6 ) | (flags << 14) 127 builder[2] = desc.fConfig | (desc.fIsMipMapped << 5) | (desc.fSampleCnt << 6 ) | (flags << 14)
127 | (origin << 24); 128 | (origin << 24);
128 } 129 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698