Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(563)

Unified Diff: src/gpu/gl/GrGLRenderTarget.cpp

Issue 1115233002: Fix gpu memory accounting for auto-resolving MSAA. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: cache the total computed vram size, not the color values per pixel Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/gl/GrGLRenderTarget.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/GrGLRenderTarget.cpp
diff --git a/src/gpu/gl/GrGLRenderTarget.cpp b/src/gpu/gl/GrGLRenderTarget.cpp
index 3eb2ae09fea489802fe38faa77523be8c6c17fc9..c9e65d4fabda77d690fb748a2043c6d177c48fac 100644
--- a/src/gpu/gl/GrGLRenderTarget.cpp
+++ b/src/gpu/gl/GrGLRenderTarget.cpp
@@ -39,19 +39,23 @@ void GrGLRenderTarget::init(const GrSurfaceDesc& desc, const IDDesc& idDesc) {
fViewport.fHeight = desc.fHeight;
// We own one color value for each MSAA sample.
- fColorValuesPerPixel = SkTMax(1, fDesc.fSampleCnt);
+ int colorValuesPerPixel = SkTMax(1, fDesc.fSampleCnt);
if (fTexFBOID != fRTFBOID) {
// If we own the resolve buffer then that is one more sample per pixel.
- fColorValuesPerPixel += 1;
- }
-}
-
-size_t GrGLRenderTarget::onGpuMemorySize() const {
+ colorValuesPerPixel += 1;
+ } else if (fTexFBOID != 0) {
+ // For auto-resolving FBOs, the MSAA buffer is free.
+ colorValuesPerPixel = 1;
+ }
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;
+ fGpuMemorySize = colorValuesPerPixel * fDesc.fWidth * fDesc.fHeight * colorBytes;
+}
+
+size_t GrGLRenderTarget::onGpuMemorySize() const {
+ return fGpuMemorySize;
}
void GrGLRenderTarget::onRelease() {
« no previous file with comments | « src/gpu/gl/GrGLRenderTarget.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698