Updated com_showfps to show additional stats.

This commit is contained in:
Justin Marshall
2026-05-21 22:41:49 -07:00
parent 7b60a99f96
commit e8ea0567b0
5 changed files with 94 additions and 6 deletions
+1 -1
View File
@@ -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 );
+2 -2
View File
@@ -15,9 +15,9 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LocalDebuggerCommand>D:\projects\Doom3\Doom3.exe</LocalDebuggerCommand>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
<LocalDebuggerCommandArguments>+set r_fullscreen 0 +set r_mode 11 +set sv_pure 0 </LocalDebuggerCommandArguments>
<LocalDebuggerCommandArguments>+set r_fullscreen 0 +set r_mode 9 +set sv_pure 0 </LocalDebuggerCommandArguments>
<LocalDebuggerWorkingDirectory>D:\projects\Doom3</LocalDebuggerWorkingDirectory>
<LocalDebuggerCommandArgumentsHistory>+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 |</LocalDebuggerCommandArgumentsHistory>
<LocalDebuggerCommandArgumentsHistory>+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 |</LocalDebuggerCommandArgumentsHistory>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Q4 Debug|x64'">
<LocalDebuggerCommand>D:\projects\Doom3\Quake4.exe</LocalDebuggerCommand>
+35 -3
View File
@@ -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;
+54
View File
@@ -1670,8 +1670,11 @@ struct GLState
UINT nextSrvIndex = 1;
ComPtr<IDXGIFactory4> factory;
ComPtr<IDXGIAdapter3> adapter;
ComPtr<ID3D12Device> device;
ComPtr<ID3D12CommandQueue> queue;
std::string adapterName;
UINT64 dedicatedVideoMemory = 0;
ComPtr<ID3D12DescriptorHeap> 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<IDXGIAdapter1> 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;
+2
View File
@@ -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);