Further centralize computation of GrSurface VRAM consumption - take 2
This is the same as https://skia-review.googlesource.com/c/4383/ (Further centralize computation of GrSurface VRAM consumption) but with a suppression for Vulkan in the new test and removal of an assert Chromium was triggering.
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4450
Change-Id: Ie87d32fd5f0d35c21326b066a0c733cb6f8a5bea
Reviewed-on: https://skia-review.googlesource.com/4450
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/vk/GrVkTextureRenderTarget.h b/src/gpu/vk/GrVkTextureRenderTarget.h
index daa1687..2877a36 100644
--- a/src/gpu/vk/GrVkTextureRenderTarget.h
+++ b/src/gpu/vk/GrVkTextureRenderTarget.h
@@ -13,6 +13,8 @@
#include "GrVkRenderTarget.h"
#include "GrVkGpu.h"
+#include "GrTexturePriv.h"
+
#ifdef SK_BUILD_FOR_WIN
// Windows gives bogus warnings about inheriting asTexture/asRenderTarget via dominance.
#pragma warning(push)
@@ -112,7 +114,9 @@
// GrGLRenderTarget accounts for the texture's memory and any MSAA renderbuffer's memory.
size_t onGpuMemorySize() const override {
- return GrVkRenderTarget::onGpuMemorySize();
+ // The plus 1 is to account for the resolve texture.
+ return GrSurface::ComputeSize(fDesc, fDesc.fSampleCnt+1, // TODO: this still correct?
+ this->texturePriv().hasMipMaps());
}
};