mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 17:50:38 +02:00
Merge pull request #11964 from SamGondelman/memFix
Remove unneeded getDedicatedMemory
This commit is contained in:
commit
e5a4f077c9
3 changed files with 0 additions and 52 deletions
|
@ -40,10 +40,6 @@ static bool disableOpenGL45 = QProcessEnvironment::systemEnvironment().contains(
|
||||||
static GLBackend* INSTANCE{ nullptr };
|
static GLBackend* INSTANCE{ nullptr };
|
||||||
|
|
||||||
BackendPointer GLBackend::createBackend() {
|
BackendPointer GLBackend::createBackend() {
|
||||||
// The ATI memory info extension only exposes 'free memory' so we want to force it to
|
|
||||||
// cache the value as early as possible
|
|
||||||
getDedicatedMemory();
|
|
||||||
|
|
||||||
// FIXME provide a mechanism to override the backend for testing
|
// FIXME provide a mechanism to override the backend for testing
|
||||||
// Where the gpuContext is initialized and where the TRUE Backend is created and assigned
|
// Where the gpuContext is initialized and where the TRUE Backend is created and assigned
|
||||||
auto version = QOpenGLContextWrapper::currentContextVersion();
|
auto version = QOpenGLContextWrapper::currentContextVersion();
|
||||||
|
|
|
@ -88,53 +88,6 @@ gpu::Size getFreeDedicatedMemory() {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
gpu::Size getDedicatedMemory() {
|
|
||||||
static Size dedicatedMemory { 0 };
|
|
||||||
static std::once_flag once;
|
|
||||||
std::call_once(once, [&] {
|
|
||||||
#ifdef Q_OS_WIN
|
|
||||||
if (!dedicatedMemory && wglGetGPUIDsAMD && wglGetGPUInfoAMD) {
|
|
||||||
UINT maxCount = wglGetGPUIDsAMD(0, 0);
|
|
||||||
std::vector<UINT> ids;
|
|
||||||
ids.resize(maxCount);
|
|
||||||
wglGetGPUIDsAMD(maxCount, &ids[0]);
|
|
||||||
GLuint memTotal;
|
|
||||||
wglGetGPUInfoAMD(ids[0], WGL_GPU_RAM_AMD, GL_UNSIGNED_INT, sizeof(GLuint), &memTotal);
|
|
||||||
dedicatedMemory = MB_TO_BYTES(memTotal);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!dedicatedMemory) {
|
|
||||||
GLint atiGpuMemory[4];
|
|
||||||
// not really total memory, but close enough if called early enough in the application lifecycle
|
|
||||||
glGetIntegerv(GL_TEXTURE_FREE_MEMORY_ATI, atiGpuMemory);
|
|
||||||
if (GL_NO_ERROR == glGetError()) {
|
|
||||||
dedicatedMemory = KB_TO_BYTES(atiGpuMemory[0]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!dedicatedMemory) {
|
|
||||||
GLint nvGpuMemory { 0 };
|
|
||||||
glGetIntegerv(GL_GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX, &nvGpuMemory);
|
|
||||||
if (GL_NO_ERROR == glGetError()) {
|
|
||||||
dedicatedMemory = KB_TO_BYTES(nvGpuMemory);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!dedicatedMemory) {
|
|
||||||
auto gpuIdent = GPUIdent::getInstance();
|
|
||||||
if (gpuIdent && gpuIdent->isValid()) {
|
|
||||||
dedicatedMemory = MB_TO_BYTES(gpuIdent->getMemory());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return dedicatedMemory;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ComparisonFunction comparisonFuncFromGL(GLenum func) {
|
ComparisonFunction comparisonFuncFromGL(GLenum func) {
|
||||||
if (func == GL_NEVER) {
|
if (func == GL_NEVER) {
|
||||||
return NEVER;
|
return NEVER;
|
||||||
|
|
|
@ -28,7 +28,6 @@ void serverWait();
|
||||||
// Create a fence and synchronously wait on the fence
|
// Create a fence and synchronously wait on the fence
|
||||||
void clientWait();
|
void clientWait();
|
||||||
|
|
||||||
gpu::Size getDedicatedMemory();
|
|
||||||
gpu::Size getFreeDedicatedMemory();
|
gpu::Size getFreeDedicatedMemory();
|
||||||
ComparisonFunction comparisonFuncFromGL(GLenum func);
|
ComparisonFunction comparisonFuncFromGL(GLenum func);
|
||||||
State::StencilOp stencilOpFromGL(GLenum stencilOp);
|
State::StencilOp stencilOpFromGL(GLenum stencilOp);
|
||||||
|
|
Loading…
Reference in a new issue