From b5de603921a779dc0ae3a8b4a0ba0845c4b49c23 Mon Sep 17 00:00:00 2001 From: Brad Hefta-Gaub Date: Tue, 27 Sep 2016 10:32:56 -0700 Subject: [PATCH] runtime disabling of sparse textures on less than 4 core systems --- .../gpu-gl/src/gpu/gl45/GL45BackendTexture.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/libraries/gpu-gl/src/gpu/gl45/GL45BackendTexture.cpp b/libraries/gpu-gl/src/gpu/gl45/GL45BackendTexture.cpp index 6733475c01..61aae87884 100644 --- a/libraries/gpu-gl/src/gpu/gl45/GL45BackendTexture.cpp +++ b/libraries/gpu-gl/src/gpu/gl45/GL45BackendTexture.cpp @@ -16,6 +16,7 @@ #include #include +#include #include #include @@ -26,8 +27,22 @@ using namespace gpu::gl; using namespace gpu::gl45; #ifdef Q_OS_WIN +#define MIN_CORES_FOR_SPARSE_TEXTURES 5 static const QString DEBUG_FLAG("HIFI_DISABLE_SPARSE_TEXTURES"); -static bool enableSparseTextures = !QProcessEnvironment::systemEnvironment().contains(DEBUG_FLAG); +static bool enableSparseTextures = !QProcessEnvironment::systemEnvironment().contains(DEBUG_FLAG) && + QThread::idealThreadCount() >= MIN_CORES_FOR_SPARSE_TEXTURES; + +class SparseTextureDebug { +public: + SparseTextureDebug() { + qDebug() << "[SPARSE TEXTURE SUPPORT]" + << "HIFI_DISABLE_SPARSE_TEXTURES:" << QProcessEnvironment::systemEnvironment().contains(DEBUG_FLAG) + << "idealThreadCount:" << QThread::idealThreadCount() + << "enableSparseTextures:" << enableSparseTextures; + } +}; +SparseTextureDebug sparseTextureDebugInfo; + #else static bool enableSparseTextures = false; #endif