aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/vk
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2016-11-03 10:19:14 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2016-11-03 16:44:50 +0000
commit29e52f13f632c701bd33d802701f5ff29a567eea (patch)
tree15678f2a2076a706f5d25dd4f898616676e3f898 /src/gpu/vk
parentd851795e7992565c1eb2b9474ee5ad01d1a01fad (diff)
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 <bsalomon@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/gpu/vk')
-rw-r--r--src/gpu/vk/GrVkRenderTarget.cpp6
-rw-r--r--src/gpu/vk/GrVkRenderTarget.h8
2 files changed, 2 insertions, 12 deletions
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.