mirror of
https://github.com/Armored-Dragon/overte.git
synced 2025-03-11 16:13:16 +01:00
Review fixes
This commit is contained in:
parent
482211d6eb
commit
0d4987878e
3 changed files with 17 additions and 14 deletions
|
@ -52,7 +52,7 @@ namespace gl {
|
|||
void initModuleGl();
|
||||
int getSwapInterval();
|
||||
void setSwapInterval(int swapInterval);
|
||||
bool queryCurrentRendererIntegerMESA(int attr, unsigned int *value);
|
||||
bool queryCurrentRendererIntegerMESA(int attr, unsigned int *value);
|
||||
}
|
||||
|
||||
#endif // hifi_gpu_GPUConfig_h
|
||||
|
|
|
@ -160,7 +160,6 @@ void GLBackend::init() {
|
|||
qCDebug(gpugllogging) << "GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX: " << GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX;
|
||||
qCDebug(gpugllogging) << "GPU_MEMORY_INFO_TOTAL_AVAILABLE_MEMORY_NVX: " << GPU_MEMORY_INFO_TOTAL_AVAILABLE_MEMORY_NVX;
|
||||
qCDebug(gpugllogging) << "GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX: " << GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX;
|
||||
qCDebug(gpugllogging) << "sz: " << sizeof(_totalMemory);
|
||||
|
||||
_totalMemory = GPU_MEMORY_INFO_TOTAL_AVAILABLE_MEMORY_NVX * BYTES_PER_KIB;
|
||||
_dedicatedMemory = GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX * BYTES_PER_KIB;
|
||||
|
@ -237,10 +236,14 @@ size_t GLBackend::getAvailableMemory() {
|
|||
|
||||
bool GLBackend::availableMemoryKnown() {
|
||||
switch( _videoCard ) {
|
||||
case NVIDIA: return true;
|
||||
case ATI: return true;
|
||||
case MESA: return false;
|
||||
case Unknown: return false;
|
||||
case NVIDIA:
|
||||
return true;
|
||||
case ATI:
|
||||
return true;
|
||||
case MESA:
|
||||
return false;
|
||||
case Unknown:
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
@ -191,7 +191,7 @@ void GLTextureTransferEngineDefault::updateMemoryPressure() {
|
|||
if (0 == allowedMemoryAllocation) {
|
||||
// Automatic allocation
|
||||
|
||||
if ( GLBackend::availableMemoryKnown() ) {
|
||||
if (GLBackend::availableMemoryKnown()) {
|
||||
// If we know how much is free, then we use that
|
||||
useAvailableGlMemory = true;
|
||||
} else {
|
||||
|
@ -199,7 +199,7 @@ void GLTextureTransferEngineDefault::updateMemoryPressure() {
|
|||
// and hope it works.
|
||||
allowedMemoryAllocation = GLBackend::getTotalMemory() * MAX_AUTO_FRACTION_OF_TOTAL_MEMORY;
|
||||
|
||||
if ( 0 == allowedMemoryAllocation ) {
|
||||
if (0 == allowedMemoryAllocation) {
|
||||
// Last resort, if we failed to detect
|
||||
allowedMemoryAllocation = DEFAULT_ALLOWED_TEXTURE_MEMORY;
|
||||
}
|
||||
|
@ -238,14 +238,14 @@ void GLTextureTransferEngineDefault::updateMemoryPressure() {
|
|||
size_t unallocated = idealMemoryAllocation - totalVariableMemoryAllocation;
|
||||
float pressure = 0;
|
||||
|
||||
if ( useAvailableGlMemory ) {
|
||||
float total_mem = GLBackend::getTotalMemory();
|
||||
float avail_mem = GLBackend::getAvailableMemory() - AUTO_RESERVE_TEXTURE_MEMORY;
|
||||
if ( avail_mem < 0 ) {
|
||||
avail_mem = 0;
|
||||
if (useAvailableGlMemory) {
|
||||
float totalMem = GLBackend::getTotalMemory();
|
||||
float availMem = GLBackend::getAvailableMemory() - AUTO_RESERVE_TEXTURE_MEMORY;
|
||||
if (availMem < 0) {
|
||||
availMem = 0;
|
||||
}
|
||||
|
||||
pressure = (total_mem - avail_mem) / total_mem;
|
||||
pressure = (totalMem - availMem) / totalMem;
|
||||
} else {
|
||||
pressure = (float)totalVariableMemoryAllocation / (float)allowedMemoryAllocation;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue