Add texture create/upload stats and make nanobench have explicit gpu stats flag
Review URL: https://codereview.chromium.org/891973002
diff --git a/src/gpu/GrGpu.cpp b/src/gpu/GrGpu.cpp
index 1566aab..67637e7 100644
--- a/src/gpu/GrGpu.cpp
+++ b/src/gpu/GrGpu.cpp
@@ -74,6 +74,12 @@
if (!this->caps()->reuseScratchTextures() && !isRT) {
tex->cacheAccess().removeScratchKey();
}
+ if (tex) {
+ fStats.incTextureCreates();
+ if (srcData) {
+ fStats.incTextureUploads();
+ }
+ }
return tex;
}
@@ -203,8 +209,12 @@
GrPixelConfig config, const void* buffer,
size_t rowBytes) {
this->handleDirtyContext();
- return this->onWriteTexturePixels(texture, left, top, width, height,
- config, buffer, rowBytes);
+ if (this->onWriteTexturePixels(texture, left, top, width, height,
+ config, buffer, rowBytes)) {
+ fStats.incTextureUploads();
+ return true;
+ }
+ return false;
}
void GrGpu::resolveRenderTarget(GrRenderTarget* target) {