From c586bef45216c0379929b7dedab531e57e1ed5a9 Mon Sep 17 00:00:00 2001 From: samcake Date: Tue, 25 Oct 2016 12:56:26 -0700 Subject: [PATCH] Actually remove the multiplication of the color buffer cost by the swapchain length in the pixel SIze estimation since it doesn;t look true --- libraries/gl/src/gl/Context.cpp | 7 ++++--- libraries/gl/src/gl/GLHelpers.cpp | 8 +++++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/libraries/gl/src/gl/Context.cpp b/libraries/gl/src/gl/Context.cpp index f748703506..ec1c284e99 100644 --- a/libraries/gl/src/gl/Context.cpp +++ b/libraries/gl/src/gl/Context.cpp @@ -109,7 +109,7 @@ Context::~Context() { void Context::updateSwapchainMemoryCounter() { if (_window) { auto newSize = _window->size(); - auto newMemSize = gl::Context::evalSurfaceMemoryUsage(newSize.width(), newSize.height(), _swapchainPixelSize); + auto newMemSize = gl::Context::evalSurfaceMemoryUsage(newSize.width(), newSize.height(), (uint32_t) _swapchainPixelSize); gl::Context::updateSwapchainMemoryUsage(_swapchainMemoryUsage, newMemSize); _swapchainMemoryUsage = newMemSize; } else { @@ -257,8 +257,9 @@ void Context::create() { wglChoosePixelFormatARB(_hdc, &formatAttribs[0], NULL, 1, &pixelFormat, &numFormats); DescribePixelFormat(_hdc, pixelFormat, sizeof(pfd), &pfd); } - // The swap chain pixel size for swap chains is : rgba32 * double buffer + depth24stencil8 - _swapchainPixelSize = 32 * 2 + 32; + // The swap chain pixel size for swap chains is : rgba32 + depth24stencil8 + // We don't apply the length of the swap chain into this pixelSize since it is not vsible for the Process (on windows). + _swapchainPixelSize = 32 + 32; updateSwapchainMemoryCounter(); SetPixelFormat(_hdc, pixelFormat, &pfd); diff --git a/libraries/gl/src/gl/GLHelpers.cpp b/libraries/gl/src/gl/GLHelpers.cpp index e845c402be..02c1f308de 100644 --- a/libraries/gl/src/gl/GLHelpers.cpp +++ b/libraries/gl/src/gl/GLHelpers.cpp @@ -15,9 +15,11 @@ size_t evalGLFormatSwapchainPixelSize(const QSurfaceFormat& format) { size_t pixelSize = format.redBufferSize() + format.greenBufferSize() + format.blueBufferSize() + format.alphaBufferSize(); - if (format.swapBehavior() > 0) { - pixelSize *= format.swapBehavior(); // multiply the color buffer pixel size by the actual swapchain depth - } + // We don't apply the length of the swap chain into this pixelSize since it is not vsible for the Process (on windows). + // Let s keep this here remember that: + // if (format.swapBehavior() > 0) { + // pixelSize *= format.swapBehavior(); // multiply the color buffer pixel size by the actual swapchain depth + // } pixelSize += format.stencilBufferSize() + format.depthBufferSize(); return pixelSize; }