From e3f0afc1176da61c15d446684d3d87c352f4f222 Mon Sep 17 00:00:00 2001 From: myT <> Date: Sat, 11 Nov 2023 21:38:02 +0100 Subject: [PATCH] implemented gfxinfo --- code/renderer/rhi_d3d12.cpp | 12 ++++++++++++ code/renderer/tr_init.cpp | 15 ++++++++------- code/renderer/tr_local.h | 15 +++++++++++++-- 3 files changed, 33 insertions(+), 9 deletions(-) diff --git a/code/renderer/rhi_d3d12.cpp b/code/renderer/rhi_d3d12.cpp index 0227310..bb29515 100644 --- a/code/renderer/rhi_d3d12.cpp +++ b/code/renderer/rhi_d3d12.cpp @@ -180,6 +180,7 @@ extern "C" { __declspec(dllexport) extern const char* D3D12SDKPath = u8".\\cnq3\ RHIExport rhie; +RHIInfo rhiInfo; namespace RHI @@ -2722,6 +2723,17 @@ namespace RHI glInfo.maxAnisotropy = 16; glInfo.depthFadeSupport = qtrue; + Q_strncpyz(glConfig.vendor_string, rhi.adapterName, sizeof(glConfig.vendor_string)); + Q_strncpyz(glConfig.renderer_string, "Direct3D 12", sizeof(glConfig.renderer_string)); + + Q_strncpyz(rhiInfo.name, "Direct3D 12", sizeof(rhiInfo.name)); + Q_strncpyz(rhiInfo.adapter, rhi.adapterName, sizeof(rhiInfo.adapter)); + rhiInfo.hasTearing = rhi.isTearingSupported; + rhiInfo.hasBaseVRS = rhi.baseVRSSupport; + rhiInfo.hasExtendedVRS = rhi.extendedVRSSupport; + rhiInfo.isUMA = rhi.allocator->IsUMA(); + rhiInfo.isCacheCoherentUMA = rhi.allocator->IsCacheCoherentUMA(); + rhi.initialized = true; return true; diff --git a/code/renderer/tr_init.cpp b/code/renderer/tr_init.cpp index 77cad15..a11435b 100644 --- a/code/renderer/tr_init.cpp +++ b/code/renderer/tr_init.cpp @@ -298,13 +298,15 @@ const byte *RB_TakeVideoFrameCmd( const videoFrameCommand_t *cmd ) /////////////////////////////////////////////////////////////// -void GfxInfo_f( void ) +static void GfxInfo_f() { - if ( glConfig.vendor_string[0] != '\0' ) - ri.Printf( PRINT_ALL, "Vendor: %s\n", glConfig.vendor_string ); - if ( glConfig.renderer_string[0] != '\0' ) - ri.Printf( PRINT_ALL, "Renderer: %s\n", glConfig.renderer_string ); - //@TODO: RHI::PrintInfo(); + ri.Printf(PRINT_ALL, "RHI: %s\n", rhiInfo.name); + ri.Printf(PRINT_ALL, "Adapter: %s\n", rhiInfo.adapter); + ri.Printf(PRINT_ALL, " Tearing support: %s\n", rhiInfo.hasTearing ? "YES" : "NO"); + ri.Printf(PRINT_ALL, " Base VRS support: %s\n", rhiInfo.hasBaseVRS ? "YES" : "NO"); + ri.Printf(PRINT_ALL, " Extended VRS support: %s\n", rhiInfo.hasExtendedVRS ? "YES" : "NO"); + ri.Printf(PRINT_ALL, " UMA: %s\n", rhiInfo.isUMA ? "YES" : "NO"); + ri.Printf(PRINT_ALL, " Cache coherent UMA: %s\n", rhiInfo.isCacheCoherentUMA ? "YES" : "NO"); } @@ -758,7 +760,6 @@ void R_Init() R_InitMipFilter(); renderPipeline->Init(); - GfxInfo_f(); R_InitImages(); diff --git a/code/renderer/tr_local.h b/code/renderer/tr_local.h index 3237fe2..d19c906 100644 --- a/code/renderer/tr_local.h +++ b/code/renderer/tr_local.h @@ -1563,8 +1563,6 @@ extern int max_polyverts; extern backEndData_t* backEndData; -void GfxInfo_f( void ); - const byte* RB_TakeScreenshotCmd( const screenshotCommand_t* cmd ); const byte* RB_TakeVideoFrameCmd( const videoFrameCommand_t* cmd ); @@ -1692,5 +1690,18 @@ struct RHIExport extern RHIExport rhie; +struct RHIInfo +{ + char name[MAX_QPATH]; + char adapter[MAX_QPATH]; + qbool hasTearing; + qbool hasBaseVRS; + qbool hasExtendedVRS; + qbool isUMA; + qbool isCacheCoherentUMA; +}; + +extern RHIInfo rhiInfo; + #endif //TR_LOCAL_H