vk: revert -nort commit

`rt_force_disable` is perfectly fine, it just needs to be written into
either `vk.cfg` or `video.cfg` to work. Other configs are read *after*
`R_VkInit()` function get called.
This commit is contained in:
Ivan Avdeev 2024-04-29 18:28:28 -04:00
parent 68c076bce3
commit 8a648619c4
6 changed files with 19 additions and 7 deletions

View File

@ -1,3 +1,9 @@
# cvars
## `rt_force_disable`
On GPUs that support ray tracing forcefully disables it as if it wasn't supported at all. I.e. no RT extensions and modules are initialized. Useful for testing sometimes.
Note: this cvar is read early in `R_VkInit()`, which gets executed before `autoexec.cfg`, `config.cfg`, etc are read. So putting it there will not work.
`video.cfg` and `vk.cfg` are read before Vk initialization, so this cvar should go there.
# Frame structure wrt calls from the engine
- (eng) SCR_UpdateScreen()
- (eng) V_PreRender()

View File

@ -3,7 +3,7 @@
- [ ] performance profiling and comparison
## 2024-04-12 E374
- [x] `-vknort` arg to force-disable RT at init time
- [x] ~~`-vknort` arg to force-disable RT at init time~~ -- reverted on 2024-04-29
## 2024-03-21 E372: agonizig over agenda
### Player-visible essentials and blockers. Big projects.

View File

@ -41,6 +41,8 @@
#include <string.h>
#include <errno.h>
#define LOG_MODULE core
#define NULLINST_FUNCS(X) \
X(vkEnumerateInstanceVersion) \
X(vkCreateInstance) \
@ -495,7 +497,7 @@ static void devicePrintMemoryInfo(const VkPhysicalDeviceMemoryProperties *props,
}
}
static qboolean createDevice( qboolean vk_no_rt ) {
static qboolean createDevice( void ) {
void *head = NULL;
vk_available_device_t *available_devices;
const int num_available_devices = enumerateDevices( &available_devices );
@ -518,8 +520,11 @@ static qboolean createDevice( qboolean vk_no_rt ) {
is_target_device_found = true;
}
if (candidate_device->ray_tracing && !vk_no_rt) {
vk_core.rtx = true;
if (candidate_device->ray_tracing) {
const qboolean force_disabled = CVAR_TO_BOOL(rt_force_disable);
if (force_disabled)
WARN("GPU[%d] supports ray tracing, but rt_force_disable is set, force-disabling ray tracing support", i);
vk_core.rtx = !force_disabled;
}
VkPhysicalDeviceAccelerationStructureFeaturesKHR accel_feature = {
@ -729,8 +734,6 @@ qboolean R_VkInit( void )
vk_core.debug = vk_core.validate || !!(gEngine.Sys_CheckParm("-vkdebug") || gEngine.Sys_CheckParm("-gldebug"));
vk_core.rtx = false;
const qboolean vk_no_rt = gEngine.Sys_CheckParm("-vknort");
VK_LoadCvars();
// Force extremely verbose logs at startup.
@ -785,7 +788,7 @@ qboolean R_VkInit( void )
}
#endif
if (!createDevice(vk_no_rt))
if (!createDevice())
return false;
VK_LoadCvarsAfterInit();

View File

@ -25,6 +25,7 @@ void VK_LoadCvars( void )
cl_lightstyle_lerping = gEngine.pfnGetCvarPointer( "cl_lightstyle_lerping", 0 );
r_lightmap = gEngine.Cvar_Get( "r_lightmap", "0", FCVAR_CHEAT, "lightmap debugging tool" );
r_infotool = gEngine.Cvar_Get( "r_infotool", "0", FCVAR_CHEAT, "DEBUG: print entity info under crosshair" );
rt_force_disable = gEngine.Cvar_Get( "rt_force_disable", "0", FCVAR_GLCONFIG, "Force disable Ray Tracing" );
vk_device_target_id = gEngine.Cvar_Get( "vk_device_target_id", "", FCVAR_GLCONFIG, "Selected video device id" );
vk_debug_log = gEngine.Cvar_Get("vk_debug_log_", "", FCVAR_GLCONFIG | FCVAR_READ_ONLY, "");

View File

@ -23,6 +23,7 @@ void VK_LoadCvarsAfterInit( void );
X(vk_device_target_id) \
X(vk_debug_log) \
X(rt_capable) \
X(rt_force_disable) \
X(rt_enable) \
X(rt_bounces) \

View File

@ -3,6 +3,7 @@
#include "vk_common.h"
#define LIST_LOG_MODULES(X) \
X(core) \
X(misc) \
X(tex) \
X(brush) \