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

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

Issue 1862043002: Refactor to separate backend object lifecycle and GpuResource budget decision (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix unrelated GrBuffer::onGpuMemorySize() lack of override keyword compile error Created 4 years, 8 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 | « src/gpu/GrGpu.h ('k') | src/gpu/GrGpuResource.cpp » ('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 * Copyright 2010 Google Inc. 2 * Copyright 2010 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 8
9 #include "GrGpu.h" 9 #include "GrGpu.h"
10 10
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 return nullptr; 143 return nullptr;
144 } 144 }
145 145
146 desc.fSampleCnt = SkTMin(desc.fSampleCnt, caps->maxSampleCount()); 146 desc.fSampleCnt = SkTMin(desc.fSampleCnt, caps->maxSampleCount());
147 // Attempt to catch un- or wrongly intialized sample counts; 147 // Attempt to catch un- or wrongly intialized sample counts;
148 SkASSERT(desc.fSampleCnt >= 0 && desc.fSampleCnt <= 64); 148 SkASSERT(desc.fSampleCnt >= 0 && desc.fSampleCnt <= 64);
149 149
150 desc.fOrigin = resolve_origin(desc.fOrigin, isRT); 150 desc.fOrigin = resolve_origin(desc.fOrigin, isRT);
151 151
152 GrTexture* tex = nullptr; 152 GrTexture* tex = nullptr;
153 GrGpuResource::LifeCycle lifeCycle = SkBudgeted::kYes == budgeted ?
154 GrGpuResource::kCached_LifeCycle :
155 GrGpuResource::kUncached_LifeCycle;
156 153
157 if (GrPixelConfigIsCompressed(desc.fConfig)) { 154 if (GrPixelConfigIsCompressed(desc.fConfig)) {
158 // We shouldn't be rendering into this 155 // We shouldn't be rendering into this
159 SkASSERT(!isRT); 156 SkASSERT(!isRT);
160 SkASSERT(0 == desc.fSampleCnt); 157 SkASSERT(0 == desc.fSampleCnt);
161 158
162 if (!caps->npotTextureTileSupport() && 159 if (!caps->npotTextureTileSupport() &&
163 (!SkIsPow2(desc.fWidth) || !SkIsPow2(desc.fHeight))) { 160 (!SkIsPow2(desc.fWidth) || !SkIsPow2(desc.fHeight))) {
164 return nullptr; 161 return nullptr;
165 } 162 }
166 163
167 this->handleDirtyContext(); 164 this->handleDirtyContext();
168 tex = this->onCreateCompressedTexture(desc, lifeCycle, texels); 165 tex = this->onCreateCompressedTexture(desc, budgeted, texels);
169 } else { 166 } else {
170 this->handleDirtyContext(); 167 this->handleDirtyContext();
171 tex = this->onCreateTexture(desc, lifeCycle, texels); 168 tex = this->onCreateTexture(desc, budgeted, texels);
172 } 169 }
173 if (tex) { 170 if (tex) {
174 if (!caps->reuseScratchTextures() && !isRT) { 171 if (!caps->reuseScratchTextures() && !isRT) {
175 tex->resourcePriv().removeScratchKey(); 172 tex->resourcePriv().removeScratchKey();
176 } 173 }
177 fStats.incTextureCreates(); 174 fStats.incTextureCreates();
178 if (!texels.empty()) { 175 if (!texels.empty()) {
179 if (texels[0].fPixels) { 176 if (texels[0].fPixels) {
180 fStats.incTextureUploads(); 177 fStats.incTextureUploads();
181 } 178 }
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 int meshCount) { 478 int meshCount) {
482 if (primProc.numAttribs() > this->caps()->maxVertexAttributes()) { 479 if (primProc.numAttribs() > this->caps()->maxVertexAttributes()) {
483 fStats.incNumFailedDraws(); 480 fStats.incNumFailedDraws();
484 return false; 481 return false;
485 } 482 }
486 this->handleDirtyContext(); 483 this->handleDirtyContext();
487 484
488 this->onDraw(pipeline, primProc, meshes, meshCount); 485 this->onDraw(pipeline, primProc, meshes, meshCount);
489 return true; 486 return true;
490 } 487 }
OLDNEW
« no previous file with comments | « src/gpu/GrGpu.h ('k') | src/gpu/GrGpuResource.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698