aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrRenderTarget.cpp
diff options
context:
space:
mode:
authorGravatar Ben Wagner <benjaminwagner@google.com>2016-11-06 12:33:22 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2016-11-06 12:47:22 +0000
commit9c46b68d5340efc91368cef1cc5775f13c97cab8 (patch)
tree5185d315cb799a8c51b41c3067b9022b4effeb3a /src/gpu/GrRenderTarget.cpp
parentce4d04ae8eace6ba53ff8b8c8d8f4a2e6af4e59f (diff)
Revert "Further centralize computation of GrSurface VRAM consumption"
This reverts commit ccd3c8937fce4bb28df19533ed043cad209e277d. Reason for revert: Blocking Chromium roll: https://codereview.chromium.org/2482643002/ Original change's description: > Further centralize computation of GrSurface VRAM consumption > > GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4383 > > Change-Id: I054b74f2cd15f904f8e05af0fda58d6e8a523eb9 > Reviewed-on: https://skia-review.googlesource.com/4383 > Commit-Queue: Robert Phillips <robertphillips@google.com> > Reviewed-by: Brian Salomon <bsalomon@google.com> > TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com,reviews@skia.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=662630 Change-Id: I186db2a41eb2bd789e6f681b3547e32d9ca374cf Reviewed-on: https://skia-review.googlesource.com/4443 Commit-Queue: Ben Wagner <benjaminwagner@google.com> Reviewed-by: Ben Wagner <benjaminwagner@google.com>
Diffstat (limited to 'src/gpu/GrRenderTarget.cpp')
-rw-r--r--src/gpu/GrRenderTarget.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/gpu/GrRenderTarget.cpp b/src/gpu/GrRenderTarget.cpp
index f15e3b01bf..2828866435 100644
--- a/src/gpu/GrRenderTarget.cpp
+++ b/src/gpu/GrRenderTarget.cpp
@@ -84,6 +84,17 @@ void GrRenderTarget::onAbandon() {
INHERITED::onAbandon();
}
+size_t GrRenderTarget::ComputeSize(const GrSurfaceDesc& desc, int colorValuesPerPixel) {
+ SkASSERT(kUnknown_GrPixelConfig != desc.fConfig);
+ SkASSERT(!GrPixelConfigIsCompressed(desc.fConfig));
+ size_t colorBytes = GrBytesPerPixel(desc.fConfig);
+ SkASSERT(colorBytes > 0);
+
+ size_t rtSize = colorValuesPerPixel * desc.fWidth * desc.fHeight * colorBytes;
+ SkASSERT(rtSize <= WorstCaseSize(desc));
+ return rtSize;
+}
+
///////////////////////////////////////////////////////////////////////////////
bool GrRenderTargetPriv::attachStencilAttachment(GrStencilAttachment* stencil) {