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

Side by Side Diff: src/gpu/GrGpu.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 unified diff | Download patch
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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 return nullptr; 145 return nullptr;
146 } 146 }
147 147
148 desc.fSampleCnt = SkTMin(desc.fSampleCnt, caps->maxSampleCount()); 148 desc.fSampleCnt = SkTMin(desc.fSampleCnt, caps->maxSampleCount());
149 // Attempt to catch un- or wrongly intialized sample counts; 149 // Attempt to catch un- or wrongly intialized sample counts;
150 SkASSERT(desc.fSampleCnt >= 0 && desc.fSampleCnt <= 64); 150 SkASSERT(desc.fSampleCnt >= 0 && desc.fSampleCnt <= 64);
151 151
152 desc.fOrigin = resolve_origin(desc.fOrigin, isRT); 152 desc.fOrigin = resolve_origin(desc.fOrigin, isRT);
153 153
154 GrTexture* tex = nullptr; 154 GrTexture* tex = nullptr;
155 GrGpuResource::LifeCycle lifeCycle = SkBudgeted::kYes == budgeted ?
156 GrGpuResource::kCached_LifeCycle :
157 GrGpuResource::kUncached_LifeCycle;
158
159 if (GrPixelConfigIsCompressed(desc.fConfig)) { 155 if (GrPixelConfigIsCompressed(desc.fConfig)) {
160 // We shouldn't be rendering into this 156 // We shouldn't be rendering into this
161 SkASSERT(!isRT); 157 SkASSERT(!isRT);
162 SkASSERT(0 == desc.fSampleCnt); 158 SkASSERT(0 == desc.fSampleCnt);
163 159
164 if (!caps->npotTextureTileSupport() && 160 if (!caps->npotTextureTileSupport() &&
165 (!SkIsPow2(desc.fWidth) || !SkIsPow2(desc.fHeight))) { 161 (!SkIsPow2(desc.fWidth) || !SkIsPow2(desc.fHeight))) {
166 return nullptr; 162 return nullptr;
167 } 163 }
168 164
169 this->handleDirtyContext(); 165 this->handleDirtyContext();
170 tex = this->onCreateCompressedTexture(desc, lifeCycle, texels); 166 tex = this->onCreateCompressedTexture(desc, budgeted, texels);
171 } else { 167 } else {
172 this->handleDirtyContext(); 168 this->handleDirtyContext();
173 tex = this->onCreateTexture(desc, lifeCycle, texels); 169 tex = this->onCreateTexture(desc, budgeted, texels);
174 } 170 }
175 if (tex) { 171 if (tex) {
176 if (!caps->reuseScratchTextures() && !isRT) { 172 if (!caps->reuseScratchTextures() && !isRT) {
177 tex->resourcePriv().removeScratchKey(); 173 tex->resourcePriv().removeScratchKey();
178 } 174 }
179 fStats.incTextureCreates(); 175 fStats.incTextureCreates();
180 if (!texels.empty()) { 176 if (!texels.empty()) {
181 if (texels[0].fPixels) { 177 if (texels[0].fPixels) {
182 fStats.incTextureUploads(); 178 fStats.incTextureUploads();
183 } 179 }
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 490
495 void GrGpu::draw(const GrPipeline& pipeline, 491 void GrGpu::draw(const GrPipeline& pipeline,
496 const GrPrimitiveProcessor& primProc, 492 const GrPrimitiveProcessor& primProc,
497 const GrMesh* meshes, 493 const GrMesh* meshes,
498 int meshCount) { 494 int meshCount) {
499 this->handleDirtyContext(); 495 this->handleDirtyContext();
500 496
501 this->onDraw(pipeline, primProc, meshes, meshCount); 497 this->onDraw(pipeline, primProc, meshes, meshCount);
502 } 498 }
503 499
OLDNEW
« no previous file with comments | « src/gpu/GrGpu.h ('k') | src/gpu/GrGpuResource.cpp » ('j') | src/gpu/gl/GrGLGpu.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698