diff --git a/neo/doom3/game/Game_local.cpp b/neo/doom3/game/Game_local.cpp index 86637081..1a75e1fa 100644 --- a/neo/doom3/game/Game_local.cpp +++ b/neo/doom3/game/Game_local.cpp @@ -2631,7 +2631,7 @@ void idGameLocal::CallObjectFrameCommand( idEntity *ent, const char *frameComman func = ent->scriptObject.GetFunction( frameCommand ); if ( !func ) { if ( !ent->IsType( idTestModel::Type ) ) { - Error( "Unknown function '%s' called for frame command on entity '%s'", frameCommand, ent->name.c_str() ); + Warning( "Unknown function '%s' called for frame command on entity '%s'", frameCommand, ent->name.c_str() ); } } else { frameCommandThread->CallFunction( ent, func, true ); diff --git a/neo/engine/doomdll.vcxproj.user b/neo/engine/doomdll.vcxproj.user index 4a1fa688..d353b370 100644 --- a/neo/engine/doomdll.vcxproj.user +++ b/neo/engine/doomdll.vcxproj.user @@ -15,9 +15,9 @@ D:\projects\Doom3\Doom3.exe WindowsLocalDebugger - +set r_fullscreen 0 +set r_mode 11 +set sv_pure 0 + +set r_fullscreen 0 +set r_mode 9 +set sv_pure 0 D:\projects\Doom3 - +set r_fullscreen 0 +set r_mode 9 +set sv_pure 0|+set r_fullscreen 0 +set r_mode 9 +set sv_pure 0 +set fs_game e3|+set r_fullscreen 0 +set r_mode 9 +set sv_pure 0 |+set r_fullscreen 0 +set r_mode 11 +set sv_pure 0 +set fs_game e3|+set r_fullscreen 0 +set r_mode 11 +set sv_pure 0 | + +set r_fullscreen 0 +set r_mode 9 +set sv_pure 0 +set fs_game e3|+set r_fullscreen 0 +set r_mode 11 +set sv_pure 0 +set fs_game e3|+set r_fullscreen 0 +set r_mode 11 +set sv_pure 0 +set fs_game e3|+set r_fullscreen 0 +set r_mode 11 +set sv_pure 0 |+set r_fullscreen 0 +set r_mode 9 +set sv_pure 0 | D:\projects\Doom3\Quake4.exe diff --git a/neo/engine/framework/Console.cpp b/neo/engine/framework/Console.cpp index c14dd8b4..af32da6e 100644 --- a/neo/engine/framework/Console.cpp +++ b/neo/engine/framework/Console.cpp @@ -32,6 +32,9 @@ If you have questions concerning this license or the applicable additional terms void SCR_DrawTextLeftAlign( float &y, const char *text, ... ) id_attribute((format(printf,2,3))); void SCR_DrawTextRightAlign( float &y, const char *text, ... ) id_attribute((format(printf,2,3))); extern int QD3D12_GetActiveFrameGenerationMultiplier( void ); +extern const char *QD3D12_GetAdapterName( void ); +extern int QD3D12_GetVideoMemoryInfo( uint64_t *usageBytes, uint64_t *budgetBytes, uint64_t *dedicatedBytes ); +extern glconfig_t glConfig; #define LINE_WIDTH 78 #define NUM_CON_TIMES 4 @@ -189,6 +192,15 @@ static const idVec4 &SCR_FrameTimeColor( int msec ) { return colorRed; } +static void SCR_DrawSmallStringRightAlign( float y, const idVec4 &color, const char *text ) { + const int w = strlen( text ) * SMALLCHAR_WIDTH; + renderSystem->DrawSmallStringExt( ( SCREEN_WIDTH - 5.0f ) - w, idMath::FtoiFast( y ) + 2, text, color, true, localConsole.charSetShader ); +} + +static uint64_t SCR_BytesToMiB( uint64_t bytes ) { + return ( bytes + ( 1024 * 1024 / 2 ) ) / ( 1024 * 1024 ); +} + float SCR_DrawFPS( float y ) { char *s; int w; @@ -237,9 +249,29 @@ float SCR_DrawFPS( float y ) { y += BIGCHAR_HEIGHT + 4; s = va( "game cpu:%4.1fms render cpu:%4.1fms pt gpu:%4.1fms", com_lastGameFrameMsec, com_lastRenderFrameMsec, com_pathTracingGpuMsec ); - w = strlen( s ) * SMALLCHAR_WIDTH; - renderSystem->DrawSmallStringExt( (SCREEN_WIDTH - 5.0f) - w, idMath::FtoiFast(y) + 2, s, frameColor, true, localConsole.charSetShader); - return y + SMALLCHAR_HEIGHT + 4; + SCR_DrawSmallStringRightAlign( y, frameColor, s ); + y += SMALLCHAR_HEIGHT + 4; + + uint64_t vramUsage = 0; + uint64_t vramBudget = 0; + uint64_t vramDedicated = 0; + if ( QD3D12_GetVideoMemoryInfo( &vramUsage, &vramBudget, &vramDedicated ) && vramBudget > 0 ) { + s = va( "VRAM: %llu/%llu MB GPU VRAM: %llu MB", (unsigned long long)SCR_BytesToMiB( vramUsage ), (unsigned long long)SCR_BytesToMiB( vramBudget ), (unsigned long long)SCR_BytesToMiB( vramDedicated ) ); + SCR_DrawSmallStringRightAlign( y, frameColor, s ); + y += SMALLCHAR_HEIGHT + 4; + } + + const char *gpuName = QD3D12_GetAdapterName(); + if ( !gpuName || !gpuName[0] ) { + gpuName = glConfig.renderer_string; + } + if ( gpuName && gpuName[0] ) { + s = va( "GPU: %s", gpuName ); + SCR_DrawSmallStringRightAlign( y, frameColor, s ); + y += SMALLCHAR_HEIGHT + 4; + } + + return y; } return y + BIGCHAR_HEIGHT + 4; diff --git a/neo/engine/opengl/gl_d3d12shim.cpp b/neo/engine/opengl/gl_d3d12shim.cpp index 8368c806..0db73866 100644 --- a/neo/engine/opengl/gl_d3d12shim.cpp +++ b/neo/engine/opengl/gl_d3d12shim.cpp @@ -1670,8 +1670,11 @@ struct GLState UINT nextSrvIndex = 1; ComPtr factory; + ComPtr adapter; ComPtr device; ComPtr queue; + std::string adapterName; + UINT64 dedicatedVideoMemory = 0; ComPtr srvHeap; UINT srvStride = 0; @@ -8438,6 +8441,29 @@ static void QD3D12_CreateDevice() QD3D12_CHECK(QD3D12_CreateDXGIFactory1ForStreamline(IID_PPV_ARGS(&g_gl.factory))); QD3D12_CHECK(QD3D12_D3D12CreateDeviceForStreamline(nullptr, D3D_FEATURE_LEVEL_11_0, IID_PPV_ARGS(&g_gl.device))); + + g_gl.adapter.Reset(); + g_gl.adapterName.clear(); + g_gl.dedicatedVideoMemory = 0; + if (g_gl.factory && g_gl.device) + { + ComPtr adapter1; + if (SUCCEEDED(g_gl.factory->EnumAdapterByLuid(g_gl.device->GetAdapterLuid(), IID_PPV_ARGS(&adapter1))) && adapter1) + { + DXGI_ADAPTER_DESC1 desc{}; + if (SUCCEEDED(adapter1->GetDesc1(&desc))) + { + g_gl.dedicatedVideoMemory = desc.DedicatedVideoMemory; + + char name[256] = {}; + const int chars = WideCharToMultiByte(CP_UTF8, 0, desc.Description, -1, name, sizeof(name), nullptr, nullptr); + if (chars > 0) + g_gl.adapterName = name; + } + adapter1.As(&g_gl.adapter); + } + } + QD3D12_StreamlineOnDeviceCreated(); QD3D12_SelectGBufferSampleCount(); @@ -17274,6 +17300,34 @@ int QD3D12_GetActiveFrameGenerationMultiplier(void) return 1; } +const char* QD3D12_GetAdapterName(void) +{ + return g_gl.adapterName.empty() ? nullptr : g_gl.adapterName.c_str(); +} + +int QD3D12_GetVideoMemoryInfo(uint64_t* usageBytes, uint64_t* budgetBytes, uint64_t* dedicatedBytes) +{ + if (usageBytes) + *usageBytes = 0; + if (budgetBytes) + *budgetBytes = 0; + if (dedicatedBytes) + *dedicatedBytes = g_gl.dedicatedVideoMemory; + + if (!g_gl.adapter) + return 0; + + DXGI_QUERY_VIDEO_MEMORY_INFO info{}; + if (FAILED(g_gl.adapter->QueryVideoMemoryInfo(0, DXGI_MEMORY_SEGMENT_GROUP_LOCAL, &info))) + return 0; + + if (usageBytes) + *usageBytes = info.CurrentUsage; + if (budgetBytes) + *budgetBytes = info.Budget; + return 1; +} + void QD3D12_EnableDLAA(int enabled) { const QD3D12UpscalerBackend oldBackend = g_gl.upscalerBackend; diff --git a/neo/engine/opengl/opengl.h b/neo/engine/opengl/opengl.h index 854d274f..d55277e3 100644 --- a/neo/engine/opengl/opengl.h +++ b/neo/engine/opengl/opengl.h @@ -2333,6 +2333,8 @@ void QD3D12_SetToneMapBrightness(float brightness); void QD3D12_SetFrameGenerationMultiplier(int multiplier); int QD3D12_GetFrameGenerationMultiplier(void); int QD3D12_GetActiveFrameGenerationMultiplier(void); +const char* QD3D12_GetAdapterName(void); +int QD3D12_GetVideoMemoryInfo(uint64_t* usageBytes, uint64_t* budgetBytes, uint64_t* dedicatedBytes); void QD3D12_SetCurrentWindowDLSSAllowed(int allowed); void QD3D12_EnableTAA(int enabled);