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

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: moved the refactoring to another patch 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/GrResourceProvider.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 * 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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 210
211 GrRenderTarget* GrGpu::wrapBackendRenderTarget(const GrBackendRenderTargetDesc& desc, 211 GrRenderTarget* GrGpu::wrapBackendRenderTarget(const GrBackendRenderTargetDesc& desc,
212 GrWrapOwnership ownership) { 212 GrWrapOwnership ownership) {
213 if (!this->caps()->isConfigRenderable(desc.fConfig, desc.fSampleCnt > 0)) { 213 if (!this->caps()->isConfigRenderable(desc.fConfig, desc.fSampleCnt > 0)) {
214 return nullptr; 214 return nullptr;
215 } 215 }
216 this->handleDirtyContext(); 216 this->handleDirtyContext();
217 return this->onWrapBackendRenderTarget(desc, ownership); 217 return this->onWrapBackendRenderTarget(desc, ownership);
218 } 218 }
219 219
220 void GrGpu::computeBackendTextureKeyForWrapAsRenderTarget(
221 const GrBackendTextureDesc& desc, GrUniqueKey* key) {
222 this->onComputeBackendTextureKeyForWrapAsRenderTarget(desc, key);
223 }
224
225 bool GrGpu::rewrapRenderTargetWithBackendTexture(
226 const GrBackendTextureDesc& desc, GrRenderTarget* rt) {
227 if (!(desc.fFlags & kRenderTarget_GrBackendTextureFlag)) {
228 return nullptr;
229 }
230 if (!this->caps()->isConfigRenderable(desc.fConfig, desc.fSampleCnt > 0)) {
231 return nullptr;
232 }
233 int maxSize = this->caps()->maxTextureSize();
234 if (desc.fWidth > maxSize || desc.fHeight > maxSize) {
235 return nullptr;
236 }
237 this->handleDirtyContext();
238 return this->onRewrapRenderTargetWithBackendTexture(desc, rt);
239 }
240
220 GrRenderTarget* GrGpu::wrapBackendTextureAsRenderTarget(const GrBackendTextureDe sc& desc) { 241 GrRenderTarget* GrGpu::wrapBackendTextureAsRenderTarget(const GrBackendTextureDe sc& desc) {
221 this->handleDirtyContext(); 242 this->handleDirtyContext();
222 if (!(desc.fFlags & kRenderTarget_GrBackendTextureFlag)) { 243 if (!(desc.fFlags & kRenderTarget_GrBackendTextureFlag)) {
223 return nullptr; 244 return nullptr;
224 } 245 }
225 if (!this->caps()->isConfigRenderable(desc.fConfig, desc.fSampleCnt > 0)) { 246 if (!this->caps()->isConfigRenderable(desc.fConfig, desc.fSampleCnt > 0)) {
226 return nullptr; 247 return nullptr;
227 } 248 }
228 int maxSize = this->caps()->maxTextureSize(); 249 int maxSize = this->caps()->maxTextureSize();
229 if (desc.fWidth > maxSize || desc.fHeight > maxSize) { 250 if (desc.fWidth > maxSize || desc.fHeight > maxSize) {
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 int meshCount) { 498 int meshCount) {
478 if (primProc.numAttribs() > this->caps()->maxVertexAttributes()) { 499 if (primProc.numAttribs() > this->caps()->maxVertexAttributes()) {
479 fStats.incNumFailedDraws(); 500 fStats.incNumFailedDraws();
480 return false; 501 return false;
481 } 502 }
482 this->handleDirtyContext(); 503 this->handleDirtyContext();
483 504
484 this->onDraw(pipeline, primProc, meshes, meshCount); 505 this->onDraw(pipeline, primProc, meshes, meshCount);
485 return true; 506 return true;
486 } 507 }
OLDNEW
« no previous file with comments | « src/gpu/GrGpu.h ('k') | src/gpu/GrResourceProvider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698