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

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

Issue 891973002: Add texture create/upload stats and make nanobench have explicit gpu stats flag (Closed) Base URL: https://skia.googlesource.com/skia.git@lala
Patch Set: rebase Created 5 years, 10 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/GrTest.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 /* 2 /*
3 * Copyright 2010 Google Inc. 3 * Copyright 2010 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 9
10 #include "GrGpu.h" 10 #include "GrGpu.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 // TODO: defer this and attach dynamically 67 // TODO: defer this and attach dynamically
68 if (!this->attachStencilBufferToRenderTarget(tex->asRenderTarget(), budgeted)) { 68 if (!this->attachStencilBufferToRenderTarget(tex->asRenderTarget(), budgeted)) {
69 tex->unref(); 69 tex->unref();
70 return NULL; 70 return NULL;
71 } 71 }
72 } 72 }
73 } 73 }
74 if (!this->caps()->reuseScratchTextures() && !isRT) { 74 if (!this->caps()->reuseScratchTextures() && !isRT) {
75 tex->cacheAccess().removeScratchKey(); 75 tex->cacheAccess().removeScratchKey();
76 } 76 }
77 if (tex) {
78 fStats.incTextureCreates();
79 if (srcData) {
80 fStats.incTextureUploads();
81 }
82 }
77 return tex; 83 return tex;
78 } 84 }
79 85
80 bool GrGpu::attachStencilBufferToRenderTarget(GrRenderTarget* rt, bool budgeted) { 86 bool GrGpu::attachStencilBufferToRenderTarget(GrRenderTarget* rt, bool budgeted) {
81 SkASSERT(NULL == rt->getStencilBuffer()); 87 SkASSERT(NULL == rt->getStencilBuffer());
82 GrScratchKey sbKey; 88 GrScratchKey sbKey;
83 GrStencilBuffer::ComputeKey(rt->width(), rt->height(), rt->numSamples(), &sb Key); 89 GrStencilBuffer::ComputeKey(rt->width(), rt->height(), rt->numSamples(), &sb Key);
84 SkAutoTUnref<GrStencilBuffer> sb(static_cast<GrStencilBuffer*>( 90 SkAutoTUnref<GrStencilBuffer> sb(static_cast<GrStencilBuffer*>(
85 this->getContext()->getResourceCache2()->findAndRefScratchResource(sbKey ))); 91 this->getContext()->getResourceCache2()->findAndRefScratchResource(sbKey )));
86 if (sb) { 92 if (sb) {
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 this->handleDirtyContext(); 202 this->handleDirtyContext();
197 return this->onReadPixels(target, left, top, width, height, 203 return this->onReadPixels(target, left, top, width, height,
198 config, buffer, rowBytes); 204 config, buffer, rowBytes);
199 } 205 }
200 206
201 bool GrGpu::writeTexturePixels(GrTexture* texture, 207 bool GrGpu::writeTexturePixels(GrTexture* texture,
202 int left, int top, int width, int height, 208 int left, int top, int width, int height,
203 GrPixelConfig config, const void* buffer, 209 GrPixelConfig config, const void* buffer,
204 size_t rowBytes) { 210 size_t rowBytes) {
205 this->handleDirtyContext(); 211 this->handleDirtyContext();
206 return this->onWriteTexturePixels(texture, left, top, width, height, 212 if (this->onWriteTexturePixels(texture, left, top, width, height,
207 config, buffer, rowBytes); 213 config, buffer, rowBytes)) {
214 fStats.incTextureUploads();
215 return true;
216 }
217 return false;
208 } 218 }
209 219
210 void GrGpu::resolveRenderTarget(GrRenderTarget* target) { 220 void GrGpu::resolveRenderTarget(GrRenderTarget* target) {
211 SkASSERT(target); 221 SkASSERT(target);
212 this->handleDirtyContext(); 222 this->handleDirtyContext();
213 this->onResolveRenderTarget(target); 223 this->onResolveRenderTarget(target);
214 } 224 }
215 225
216 typedef GrTraceMarkerSet::Iter TMIter; 226 typedef GrTraceMarkerSet::Iter TMIter;
217 void GrGpu::saveActiveTraceMarkers() { 227 void GrGpu::saveActiveTraceMarkers() {
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 GrDrawTarget::PathIndexType indexType, 312 GrDrawTarget::PathIndexType indexType,
303 const float transformValues[], 313 const float transformValues[],
304 GrDrawTarget::PathTransformType transformType, 314 GrDrawTarget::PathTransformType transformType,
305 int count, 315 int count,
306 const GrStencilSettings& stencilSettings) { 316 const GrStencilSettings& stencilSettings) {
307 this->handleDirtyContext(); 317 this->handleDirtyContext();
308 pathRange->willDrawPaths(indices, indexType, count); 318 pathRange->willDrawPaths(indices, indexType, count);
309 this->onDrawPaths(args, pathRange, indices, indexType, transformValues, 319 this->onDrawPaths(args, pathRange, indices, indexType, transformValues,
310 transformType, count, stencilSettings); 320 transformType, count, stencilSettings);
311 } 321 }
OLDNEW
« no previous file with comments | « src/gpu/GrGpu.h ('k') | src/gpu/GrTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698