From 29e52f13f632c701bd33d802701f5ff29a567eea Mon Sep 17 00:00:00 2001 From: Robert Phillips Date: Thu, 3 Nov 2016 10:19:14 -0400 Subject: Centralize computation of GrRenderTarget & GrTexture VRAM consumption GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4310 Change-Id: I676749ecf1e489f825799b619a15a45fc7dcd219 Reviewed-on: https://skia-review.googlesource.com/4310 Reviewed-by: Brian Salomon Commit-Queue: Robert Phillips --- src/gpu/vk/GrVkRenderTarget.cpp | 6 ------ src/gpu/vk/GrVkRenderTarget.h | 8 ++------ 2 files changed, 2 insertions(+), 12 deletions(-) (limited to 'src/gpu/vk') diff --git a/src/gpu/vk/GrVkRenderTarget.cpp b/src/gpu/vk/GrVkRenderTarget.cpp index e2f0019d9c..278c939c22 100644 --- a/src/gpu/vk/GrVkRenderTarget.cpp +++ b/src/gpu/vk/GrVkRenderTarget.cpp @@ -39,8 +39,6 @@ GrVkRenderTarget::GrVkRenderTarget(GrVkGpu* gpu, , fFramebuffer(nullptr) , fCachedSimpleRenderPass(nullptr) { SkASSERT(desc.fSampleCnt); - // The plus 1 is to account for the resolve texture. - fColorValuesPerPixel = desc.fSampleCnt + 1; // TODO: this still correct? this->createFramebuffer(gpu); this->registerWithCache(budgeted); } @@ -64,8 +62,6 @@ GrVkRenderTarget::GrVkRenderTarget(GrVkGpu* gpu, , fFramebuffer(nullptr) , fCachedSimpleRenderPass(nullptr) { SkASSERT(desc.fSampleCnt); - // The plus 1 is to account for the resolve texture. - fColorValuesPerPixel = desc.fSampleCnt + 1; // TODO: this still correct? this->createFramebuffer(gpu); } @@ -86,7 +82,6 @@ GrVkRenderTarget::GrVkRenderTarget(GrVkGpu* gpu, , fFramebuffer(nullptr) , fCachedSimpleRenderPass(nullptr) { SkASSERT(!desc.fSampleCnt); - fColorValuesPerPixel = 1; this->createFramebuffer(gpu); this->registerWithCache(budgeted); } @@ -107,7 +102,6 @@ GrVkRenderTarget::GrVkRenderTarget(GrVkGpu* gpu, , fFramebuffer(nullptr) , fCachedSimpleRenderPass(nullptr) { SkASSERT(!desc.fSampleCnt); - fColorValuesPerPixel = 1; this->createFramebuffer(gpu); } diff --git a/src/gpu/vk/GrVkRenderTarget.h b/src/gpu/vk/GrVkRenderTarget.h index 0855a6d020..2e2f60a5fd 100644 --- a/src/gpu/vk/GrVkRenderTarget.h +++ b/src/gpu/vk/GrVkRenderTarget.h @@ -99,11 +99,8 @@ protected: // This accounts for the texture's memory and any MSAA renderbuffer's memory. size_t onGpuMemorySize() const override { - SkASSERT(kUnknown_GrPixelConfig != fDesc.fConfig); - SkASSERT(!GrPixelConfigIsCompressed(fDesc.fConfig)); - size_t colorBytes = GrBytesPerPixel(fDesc.fConfig); - SkASSERT(colorBytes > 0); - return fColorValuesPerPixel * fDesc.fWidth * fDesc.fHeight * colorBytes; + // The plus 1 is to account for the resolve texture. + return GrRenderTarget::ComputeSize(fDesc, fDesc.fSampleCnt+1); // TODO: this still correct? } void createFramebuffer(GrVkGpu* gpu); @@ -138,7 +135,6 @@ private: void abandonInternalObjects(); const GrVkFramebuffer* fFramebuffer; - int fColorValuesPerPixel; // This is a cached pointer to a simple render pass. The render target should unref it // once it is done with it. -- cgit v1.2.3