Merge pull request #8901 from samcake/blue

Adding more detailed counters for texture memory consumption
This commit is contained in:
Brad Hefta-Gaub 2016-10-25 16:19:56 -07:00 committed by GitHub
commit 001cfc7e15
15 changed files with 138 additions and 6 deletions

View file

@ -215,6 +215,9 @@ Item {
StatText { StatText {
text: " Commited Memory: " + root.gpuTextureMemory + " MB"; text: " Commited Memory: " + root.gpuTextureMemory + " MB";
} }
StatText {
text: " Framebuffer Memory: " + root.gpuTextureFramebufferMemory + " MB";
}
StatText { StatText {
text: " Sparse Memory: " + root.gpuTextureSparseMemory + " MB"; text: " Sparse Memory: " + root.gpuTextureSparseMemory + " MB";
visible: 0 != root.gpuSparseTextureEnabled; visible: 0 != root.gpuSparseTextureEnabled;
@ -225,6 +228,9 @@ Item {
StatText { StatText {
text: " Count: " + root.gpuTextures; text: " Count: " + root.gpuTextures;
} }
StatText {
text: "GL Swapchain Memory: " + root.glContextSwapchainMemory + " MB";
}
StatText { StatText {
text: "QML Texture Memory: " + root.qmlTextureMemory + " MB"; text: "QML Texture Memory: " + root.qmlTextureMemory + " MB";
} }

View file

@ -25,6 +25,8 @@
#include <PerfStat.h> #include <PerfStat.h>
#include <plugins/DisplayPlugin.h> #include <plugins/DisplayPlugin.h>
#include <gl/Context.h>
#include "BandwidthRecorder.h" #include "BandwidthRecorder.h"
#include "Menu.h" #include "Menu.h"
#include "Util.h" #include "Util.h"
@ -289,9 +291,13 @@ void Stats::updateStats(bool force) {
STAT_UPDATE(gpuBuffers, (int)gpu::Context::getBufferGPUCount()); STAT_UPDATE(gpuBuffers, (int)gpu::Context::getBufferGPUCount());
STAT_UPDATE(gpuTextures, (int)gpu::Context::getTextureGPUCount()); STAT_UPDATE(gpuTextures, (int)gpu::Context::getTextureGPUCount());
STAT_UPDATE(gpuTexturesSparse, (int)gpu::Context::getTextureGPUSparseCount()); STAT_UPDATE(gpuTexturesSparse, (int)gpu::Context::getTextureGPUSparseCount());
STAT_UPDATE(glContextSwapchainMemory, (int)BYTES_TO_MB(gl::Context::getSwapchainMemoryUsage()));
STAT_UPDATE(qmlTextureMemory, (int)BYTES_TO_MB(OffscreenQmlSurface::getUsedTextureMemory())); STAT_UPDATE(qmlTextureMemory, (int)BYTES_TO_MB(OffscreenQmlSurface::getUsedTextureMemory()));
STAT_UPDATE(gpuTextureMemory, (int)BYTES_TO_MB(gpu::Texture::getTextureGPUMemoryUsage())); STAT_UPDATE(gpuTextureMemory, (int)BYTES_TO_MB(gpu::Texture::getTextureGPUMemoryUsage()));
STAT_UPDATE(gpuTextureVirtualMemory, (int)BYTES_TO_MB(gpu::Texture::getTextureGPUVirtualMemoryUsage())); STAT_UPDATE(gpuTextureVirtualMemory, (int)BYTES_TO_MB(gpu::Texture::getTextureGPUVirtualMemoryUsage()));
STAT_UPDATE(gpuTextureFramebufferMemory, (int)BYTES_TO_MB(gpu::Texture::getTextureGPUFramebufferMemoryUsage()));
STAT_UPDATE(gpuTextureSparseMemory, (int)BYTES_TO_MB(gpu::Texture::getTextureGPUSparseMemoryUsage())); STAT_UPDATE(gpuTextureSparseMemory, (int)BYTES_TO_MB(gpu::Texture::getTextureGPUSparseMemoryUsage()));
STAT_UPDATE(gpuSparseTextureEnabled, gpu::Texture::getEnableSparseTextures() ? 1 : 0); STAT_UPDATE(gpuSparseTextureEnabled, gpu::Texture::getEnableSparseTextures() ? 1 : 0);
STAT_UPDATE(gpuFreeMemory, (int)BYTES_TO_MB(gpu::Context::getFreeGPUMemory())); STAT_UPDATE(gpuFreeMemory, (int)BYTES_TO_MB(gpu::Context::getFreeGPUMemory()));

View file

@ -90,9 +90,11 @@ class Stats : public QQuickItem {
STATS_PROPERTY(int, gpuBuffers, 0) STATS_PROPERTY(int, gpuBuffers, 0)
STATS_PROPERTY(int, gpuTextures, 0) STATS_PROPERTY(int, gpuTextures, 0)
STATS_PROPERTY(int, gpuTexturesSparse, 0) STATS_PROPERTY(int, gpuTexturesSparse, 0)
STATS_PROPERTY(int, glContextSwapchainMemory, 0)
STATS_PROPERTY(int, qmlTextureMemory, 0) STATS_PROPERTY(int, qmlTextureMemory, 0)
STATS_PROPERTY(int, gpuTextureMemory, 0) STATS_PROPERTY(int, gpuTextureMemory, 0)
STATS_PROPERTY(int, gpuTextureVirtualMemory, 0) STATS_PROPERTY(int, gpuTextureVirtualMemory, 0)
STATS_PROPERTY(int, gpuTextureFramebufferMemory, 0)
STATS_PROPERTY(int, gpuTextureSparseMemory, 0) STATS_PROPERTY(int, gpuTextureSparseMemory, 0)
STATS_PROPERTY(int, gpuSparseTextureEnabled, 0) STATS_PROPERTY(int, gpuSparseTextureEnabled, 0)
STATS_PROPERTY(int, gpuFreeMemory, 0) STATS_PROPERTY(int, gpuFreeMemory, 0)
@ -181,12 +183,14 @@ signals:
void localInternalChanged(); void localInternalChanged();
void localLeavesChanged(); void localLeavesChanged();
void timingStatsChanged(); void timingStatsChanged();
void glContextSwapchainMemoryChanged();
void qmlTextureMemoryChanged(); void qmlTextureMemoryChanged();
void gpuBuffersChanged(); void gpuBuffersChanged();
void gpuTexturesChanged(); void gpuTexturesChanged();
void gpuTexturesSparseChanged(); void gpuTexturesSparseChanged();
void gpuTextureMemoryChanged(); void gpuTextureMemoryChanged();
void gpuTextureVirtualMemoryChanged(); void gpuTextureVirtualMemoryChanged();
void gpuTextureFramebufferMemoryChanged();
void gpuTextureSparseMemoryChanged(); void gpuTextureSparseMemoryChanged();
void gpuSparseTextureEnabledChanged(); void gpuSparseTextureEnabledChanged();
void gpuFreeMemoryChanged(); void gpuFreeMemoryChanged();

View file

@ -40,6 +40,27 @@ static bool enableDebugLogger = QProcessEnvironment::systemEnvironment().contain
using namespace gl; using namespace gl;
std::atomic<size_t> Context::_totalSwapchainMemoryUsage { 0 };
size_t Context::getSwapchainMemoryUsage() { return _totalSwapchainMemoryUsage.load(); }
size_t Context::evalSurfaceMemoryUsage(uint32_t width, uint32_t height, uint32_t pixelSize) {
return width * height * pixelSize;
}
void Context::updateSwapchainMemoryUsage(size_t prevSize, size_t newSize) {
if (prevSize == newSize) {
return;
}
if (newSize > prevSize) {
_totalSwapchainMemoryUsage.fetch_add(newSize - prevSize);
} else {
_totalSwapchainMemoryUsage.fetch_sub(prevSize - newSize);
}
}
Context* Context::PRIMARY = nullptr; Context* Context::PRIMARY = nullptr;
Context::Context() {} Context::Context() {}
@ -78,18 +99,35 @@ void Context::release() {
if (PRIMARY == this) { if (PRIMARY == this) {
PRIMARY = nullptr; PRIMARY = nullptr;
} }
} updateSwapchainMemoryCounter();
}
Context::~Context() { Context::~Context() {
release(); release();
} }
void Context::updateSwapchainMemoryCounter() {
if (_window) {
auto newSize = _window->size();
auto newMemSize = gl::Context::evalSurfaceMemoryUsage(newSize.width(), newSize.height(), (uint32_t) _swapchainPixelSize);
gl::Context::updateSwapchainMemoryUsage(_swapchainMemoryUsage, newMemSize);
_swapchainMemoryUsage = newMemSize;
} else {
// No window ? no more swapchain
gl::Context::updateSwapchainMemoryUsage(_swapchainMemoryUsage, 0);
_swapchainMemoryUsage = 0;
}
}
void Context::setWindow(QWindow* window) { void Context::setWindow(QWindow* window) {
release(); release();
_window = window; _window = window;
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
_hwnd = (HWND)window->winId(); _hwnd = (HWND)window->winId();
#endif #endif
updateSwapchainMemoryCounter();
} }
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
@ -98,6 +136,8 @@ static const char* PRIMARY_CONTEXT_PROPERTY_NAME = "com.highfidelity.gl.primaryC
bool Context::makeCurrent() { bool Context::makeCurrent() {
BOOL result = wglMakeCurrent(_hdc, _hglrc); BOOL result = wglMakeCurrent(_hdc, _hglrc);
assert(result); assert(result);
updateSwapchainMemoryCounter();
return result; return result;
} }
@ -217,6 +257,11 @@ void Context::create() {
wglChoosePixelFormatARB(_hdc, &formatAttribs[0], NULL, 1, &pixelFormat, &numFormats); wglChoosePixelFormatARB(_hdc, &formatAttribs[0], NULL, 1, &pixelFormat, &numFormats);
DescribePixelFormat(_hdc, pixelFormat, sizeof(pfd), &pfd); DescribePixelFormat(_hdc, pixelFormat, sizeof(pfd), &pfd);
} }
// 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); SetPixelFormat(_hdc, pixelFormat, &pfd);
{ {
std::vector<int> contextAttribs; std::vector<int> contextAttribs;
@ -277,6 +322,8 @@ void OffscreenContext::create() {
_window->setSurfaceType(QSurface::OpenGLSurface); _window->setSurfaceType(QSurface::OpenGLSurface);
_window->create(); _window->create();
setWindow(_window); setWindow(_window);
QSize windowSize = _window->size() * _window->devicePixelRatio();
qCDebug(glLogging) << "New Offscreen GLContext, window size = " << windowSize.width() << " , " << windowSize.height();
QGuiApplication::processEvents(); QGuiApplication::processEvents();
} }
Parent::create(); Parent::create();

View file

@ -11,6 +11,7 @@
#include <stdint.h> #include <stdint.h>
#include <QtGlobal> #include <QtGlobal>
#include <atomic>
#if defined(Q_OS_WIN) #if defined(Q_OS_WIN)
#include <Windows.h> #include <Windows.h>
@ -23,7 +24,7 @@ class QThread;
namespace gl { namespace gl {
class Context { class Context {
protected: protected:
QWindow* _window { nullptr }; QWindow* _window { nullptr };
static Context* PRIMARY; static Context* PRIMARY;
@ -57,6 +58,17 @@ class Context {
virtual void create(); virtual void create();
QOpenGLContext* qglContext(); QOpenGLContext* qglContext();
void moveToThread(QThread* thread); void moveToThread(QThread* thread);
static size_t evalSurfaceMemoryUsage(uint32_t width, uint32_t height, uint32_t pixelSize);
static size_t getSwapchainMemoryUsage();
static void updateSwapchainMemoryUsage(size_t prevSize, size_t newSize);
private:
static std::atomic<size_t> _totalSwapchainMemoryUsage;
size_t _swapchainMemoryUsage { 0 };
size_t _swapchainPixelSize { 0 };
void updateSwapchainMemoryCounter();
}; };
class OffscreenContext : public Context { class OffscreenContext : public Context {
@ -67,6 +79,7 @@ class Context {
virtual ~OffscreenContext(); virtual ~OffscreenContext();
void create() override; void create() override;
}; };
} }
#endif // hifi_gpu_GPUConfig_h #endif // hifi_gpu_GPUConfig_h

View file

@ -15,6 +15,8 @@
#include <QtPlatformHeaders/QWGLNativeContext> #include <QtPlatformHeaders/QWGLNativeContext>
#endif #endif
#include "GLHelpers.h"
using namespace gl; using namespace gl;
void Context::destroyContext(QOpenGLContext* context) { void Context::destroyContext(QOpenGLContext* context) {
@ -45,6 +47,7 @@ void Context::moveToThread(QThread* thread) {
#ifndef Q_OS_WIN #ifndef Q_OS_WIN
bool Context::makeCurrent() { bool Context::makeCurrent() {
updateSwapchainMemoryCounter();
return _context->makeCurrent(_window); return _context->makeCurrent(_window);
} }
@ -70,6 +73,9 @@ void Context::create() {
} }
_context->setFormat(getDefaultOpenGLSurfaceFormat()); _context->setFormat(getDefaultOpenGLSurfaceFormat());
_context->create(); _context->create();
_swapchainPixelSize = evalGLFormatSwapchainPixelSize(_context->format());
updateSwapchainMemoryCounter();
} }
#endif #endif

View file

@ -13,6 +13,17 @@
#include <QtOpenGL/QGL> #include <QtOpenGL/QGL>
size_t evalGLFormatSwapchainPixelSize(const QSurfaceFormat& format) {
size_t pixelSize = format.redBufferSize() + format.greenBufferSize() + format.blueBufferSize() + format.alphaBufferSize();
// 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;
}
const QSurfaceFormat& getDefaultOpenGLSurfaceFormat() { const QSurfaceFormat& getDefaultOpenGLSurfaceFormat() {
static QSurfaceFormat format; static QSurfaceFormat format;
static std::once_flag once; static std::once_flag once;

View file

@ -26,6 +26,8 @@ class QGLFormat;
template<class F> template<class F>
void setGLFormatVersion(F& format, int major = 4, int minor = 5) { format.setVersion(major, minor); } void setGLFormatVersion(F& format, int major = 4, int minor = 5) { format.setVersion(major, minor); }
size_t evalGLFormatSwapchainPixelSize(const QSurfaceFormat& format);
const QSurfaceFormat& getDefaultOpenGLSurfaceFormat(); const QSurfaceFormat& getDefaultOpenGLSurfaceFormat();
QJsonObject getGLContextData(); QJsonObject getGLContextData();
int glVersionToInteger(QString glVersion); int glVersionToInteger(QString glVersion);

View file

@ -17,11 +17,15 @@
#include <QtGui/QOffscreenSurface> #include <QtGui/QOffscreenSurface>
#include <QtGui/QOpenGLContext> #include <QtGui/QOpenGLContext>
#include "Context.h"
#include "GLHelpers.h" #include "GLHelpers.h"
#include "GLLogging.h" #include "GLLogging.h"
OffscreenGLCanvas::OffscreenGLCanvas() : _context(new QOpenGLContext), _offscreenSurface(new QOffscreenSurface){ OffscreenGLCanvas::OffscreenGLCanvas() :
_context(new QOpenGLContext),
_offscreenSurface(new QOffscreenSurface)
{
} }
OffscreenGLCanvas::~OffscreenGLCanvas() { OffscreenGLCanvas::~OffscreenGLCanvas() {
@ -56,7 +60,6 @@ bool OffscreenGLCanvas::create(QOpenGLContext* sharedContext) {
bool OffscreenGLCanvas::makeCurrent() { bool OffscreenGLCanvas::makeCurrent() {
bool result = _context->makeCurrent(_offscreenSurface); bool result = _context->makeCurrent(_offscreenSurface);
Q_ASSERT(result); Q_ASSERT(result);
std::call_once(_reportOnce, [this]{ std::call_once(_reportOnce, [this]{
qCDebug(glLogging) << "GL Version: " << QString((const char*) glGetString(GL_VERSION)); qCDebug(glLogging) << "GL Version: " << QString((const char*) glGetString(GL_VERSION));
qCDebug(glLogging) << "GL Shader Language Version: " << QString((const char*) glGetString(GL_SHADING_LANGUAGE_VERSION)); qCDebug(glLogging) << "GL Shader Language Version: " << QString((const char*) glGetString(GL_SHADING_LANGUAGE_VERSION));

View file

@ -13,7 +13,7 @@ using namespace gpu;
using namespace gpu::gl; using namespace gpu::gl;
GLFramebuffer::~GLFramebuffer() { GLFramebuffer::~GLFramebuffer() {
if (_id) { if (_id) {
auto backend = _backend.lock(); auto backend = _backend.lock();
if (backend) { if (backend) {
backend->releaseFramebuffer(_id); backend->releaseFramebuffer(_id);

View file

@ -181,6 +181,10 @@ GLTexture::~GLTexture() {
// the GL45Texture destructor for doing any required work tracking GPU stats // the GL45Texture destructor for doing any required work tracking GPU stats
backend->releaseTexture(_id, _size); backend->releaseTexture(_id, _size);
} }
if (!_external && !_transferrable) {
Backend::updateTextureGPUFramebufferMemoryUsage(_size, 0);
}
} }
Backend::updateTextureGPUVirtualMemoryUsage(_virtualSize, 0); Backend::updateTextureGPUVirtualMemoryUsage(_virtualSize, 0);
} }
@ -217,6 +221,9 @@ void GLTexture::withPreservedTexture(std::function<void()> f) const {
} }
void GLTexture::setSize(GLuint size) const { void GLTexture::setSize(GLuint size) const {
if (!_external && !_transferrable) {
Backend::updateTextureGPUFramebufferMemoryUsage(_size, size);
}
Backend::updateTextureGPUMemoryUsage(_size, size); Backend::updateTextureGPUMemoryUsage(_size, size);
const_cast<GLuint&>(_size) = size; const_cast<GLuint&>(_size) = size;
} }

View file

@ -170,7 +170,8 @@ std::atomic<Buffer::Size> Context::_bufferGPUMemoryUsage { 0 };
std::atomic<uint32_t> Context::_textureGPUCount{ 0 }; std::atomic<uint32_t> Context::_textureGPUCount{ 0 };
std::atomic<uint32_t> Context::_textureGPUSparseCount { 0 }; std::atomic<uint32_t> Context::_textureGPUSparseCount { 0 };
std::atomic<Texture::Size> Context::_textureGPUMemoryUsage { 0 }; std::atomic<Texture::Size> Context::_textureGPUMemoryUsage { 0 };
std::atomic<Texture::Size> Context::_textureGPUVirtualMemoryUsage{ 0 }; std::atomic<Texture::Size> Context::_textureGPUVirtualMemoryUsage { 0 };
std::atomic<Texture::Size> Context::_textureGPUFramebufferMemoryUsage { 0 };
std::atomic<Texture::Size> Context::_textureGPUSparseMemoryUsage { 0 }; std::atomic<Texture::Size> Context::_textureGPUSparseMemoryUsage { 0 };
std::atomic<uint32_t> Context::_textureGPUTransferCount { 0 }; std::atomic<uint32_t> Context::_textureGPUTransferCount { 0 };
@ -262,6 +263,17 @@ void Context::updateTextureGPUVirtualMemoryUsage(Size prevObjectSize, Size newOb
} }
} }
void Context::updateTextureGPUFramebufferMemoryUsage(Size prevObjectSize, Size newObjectSize) {
if (prevObjectSize == newObjectSize) {
return;
}
if (newObjectSize > prevObjectSize) {
_textureGPUFramebufferMemoryUsage.fetch_add(newObjectSize - prevObjectSize);
} else {
_textureGPUFramebufferMemoryUsage.fetch_sub(prevObjectSize - newObjectSize);
}
}
void Context::updateTextureGPUSparseMemoryUsage(Size prevObjectSize, Size newObjectSize) { void Context::updateTextureGPUSparseMemoryUsage(Size prevObjectSize, Size newObjectSize) {
if (prevObjectSize == newObjectSize) { if (prevObjectSize == newObjectSize) {
return; return;
@ -310,6 +322,10 @@ Context::Size Context::getTextureGPUVirtualMemoryUsage() {
return _textureGPUVirtualMemoryUsage.load(); return _textureGPUVirtualMemoryUsage.load();
} }
Context::Size Context::getTextureGPUFramebufferMemoryUsage() {
return _textureGPUFramebufferMemoryUsage.load();
}
Context::Size Context::getTextureGPUSparseMemoryUsage() { Context::Size Context::getTextureGPUSparseMemoryUsage() {
return _textureGPUSparseMemoryUsage.load(); return _textureGPUSparseMemoryUsage.load();
} }
@ -329,6 +345,7 @@ void Backend::incrementTextureGPUSparseCount() { Context::incrementTextureGPUSpa
void Backend::decrementTextureGPUSparseCount() { Context::decrementTextureGPUSparseCount(); } void Backend::decrementTextureGPUSparseCount() { Context::decrementTextureGPUSparseCount(); }
void Backend::updateTextureGPUMemoryUsage(Resource::Size prevObjectSize, Resource::Size newObjectSize) { Context::updateTextureGPUMemoryUsage(prevObjectSize, newObjectSize); } void Backend::updateTextureGPUMemoryUsage(Resource::Size prevObjectSize, Resource::Size newObjectSize) { Context::updateTextureGPUMemoryUsage(prevObjectSize, newObjectSize); }
void Backend::updateTextureGPUVirtualMemoryUsage(Resource::Size prevObjectSize, Resource::Size newObjectSize) { Context::updateTextureGPUVirtualMemoryUsage(prevObjectSize, newObjectSize); } void Backend::updateTextureGPUVirtualMemoryUsage(Resource::Size prevObjectSize, Resource::Size newObjectSize) { Context::updateTextureGPUVirtualMemoryUsage(prevObjectSize, newObjectSize); }
void Backend::updateTextureGPUFramebufferMemoryUsage(Resource::Size prevObjectSize, Resource::Size newObjectSize) { Context::updateTextureGPUFramebufferMemoryUsage(prevObjectSize, newObjectSize); }
void Backend::updateTextureGPUSparseMemoryUsage(Resource::Size prevObjectSize, Resource::Size newObjectSize) { Context::updateTextureGPUSparseMemoryUsage(prevObjectSize, newObjectSize); } void Backend::updateTextureGPUSparseMemoryUsage(Resource::Size prevObjectSize, Resource::Size newObjectSize) { Context::updateTextureGPUSparseMemoryUsage(prevObjectSize, newObjectSize); }
void Backend::incrementTextureGPUTransferCount() { Context::incrementTextureGPUTransferCount(); } void Backend::incrementTextureGPUTransferCount() { Context::incrementTextureGPUTransferCount(); }
void Backend::decrementTextureGPUTransferCount() { Context::decrementTextureGPUTransferCount(); } void Backend::decrementTextureGPUTransferCount() { Context::decrementTextureGPUTransferCount(); }

View file

@ -101,6 +101,7 @@ public:
static void updateTextureGPUMemoryUsage(Resource::Size prevObjectSize, Resource::Size newObjectSize); static void updateTextureGPUMemoryUsage(Resource::Size prevObjectSize, Resource::Size newObjectSize);
static void updateTextureGPUSparseMemoryUsage(Resource::Size prevObjectSize, Resource::Size newObjectSize); static void updateTextureGPUSparseMemoryUsage(Resource::Size prevObjectSize, Resource::Size newObjectSize);
static void updateTextureGPUVirtualMemoryUsage(Resource::Size prevObjectSize, Resource::Size newObjectSize); static void updateTextureGPUVirtualMemoryUsage(Resource::Size prevObjectSize, Resource::Size newObjectSize);
static void updateTextureGPUFramebufferMemoryUsage(Resource::Size prevObjectSize, Resource::Size newObjectSize);
static void incrementTextureGPUTransferCount(); static void incrementTextureGPUTransferCount();
static void decrementTextureGPUTransferCount(); static void decrementTextureGPUTransferCount();
@ -210,6 +211,7 @@ public:
static Size getFreeGPUMemory(); static Size getFreeGPUMemory();
static Size getTextureGPUMemoryUsage(); static Size getTextureGPUMemoryUsage();
static Size getTextureGPUVirtualMemoryUsage(); static Size getTextureGPUVirtualMemoryUsage();
static Size getTextureGPUFramebufferMemoryUsage();
static Size getTextureGPUSparseMemoryUsage(); static Size getTextureGPUSparseMemoryUsage();
static uint32_t getTextureGPUTransferCount(); static uint32_t getTextureGPUTransferCount();
@ -249,6 +251,7 @@ protected:
static void updateTextureGPUMemoryUsage(Size prevObjectSize, Size newObjectSize); static void updateTextureGPUMemoryUsage(Size prevObjectSize, Size newObjectSize);
static void updateTextureGPUSparseMemoryUsage(Size prevObjectSize, Size newObjectSize); static void updateTextureGPUSparseMemoryUsage(Size prevObjectSize, Size newObjectSize);
static void updateTextureGPUVirtualMemoryUsage(Size prevObjectSize, Size newObjectSize); static void updateTextureGPUVirtualMemoryUsage(Size prevObjectSize, Size newObjectSize);
static void updateTextureGPUFramebufferMemoryUsage(Size prevObjectSize, Size newObjectSize);
static void incrementTextureGPUTransferCount(); static void incrementTextureGPUTransferCount();
static void decrementTextureGPUTransferCount(); static void decrementTextureGPUTransferCount();
@ -264,6 +267,7 @@ protected:
static std::atomic<Size> _textureGPUMemoryUsage; static std::atomic<Size> _textureGPUMemoryUsage;
static std::atomic<Size> _textureGPUSparseMemoryUsage; static std::atomic<Size> _textureGPUSparseMemoryUsage;
static std::atomic<Size> _textureGPUVirtualMemoryUsage; static std::atomic<Size> _textureGPUVirtualMemoryUsage;
static std::atomic<Size> _textureGPUFramebufferMemoryUsage;
static std::atomic<uint32_t> _textureGPUTransferCount; static std::atomic<uint32_t> _textureGPUTransferCount;

View file

@ -102,6 +102,11 @@ Texture::Size Texture::getTextureGPUVirtualMemoryUsage() {
return Context::getTextureGPUVirtualMemoryUsage(); return Context::getTextureGPUVirtualMemoryUsage();
} }
Texture::Size Texture::getTextureGPUFramebufferMemoryUsage() {
return Context::getTextureGPUFramebufferMemoryUsage();
}
Texture::Size Texture::getTextureGPUSparseMemoryUsage() { Texture::Size Texture::getTextureGPUSparseMemoryUsage() {
return Context::getTextureGPUSparseMemoryUsage(); return Context::getTextureGPUSparseMemoryUsage();
} }

View file

@ -154,6 +154,7 @@ public:
static uint32_t getTextureGPUSparseCount(); static uint32_t getTextureGPUSparseCount();
static Size getTextureGPUMemoryUsage(); static Size getTextureGPUMemoryUsage();
static Size getTextureGPUVirtualMemoryUsage(); static Size getTextureGPUVirtualMemoryUsage();
static Size getTextureGPUFramebufferMemoryUsage();
static Size getTextureGPUSparseMemoryUsage(); static Size getTextureGPUSparseMemoryUsage();
static uint32_t getTextureGPUTransferCount(); static uint32_t getTextureGPUTransferCount();
static Size getAllowedGPUMemoryUsage(); static Size getAllowedGPUMemoryUsage();