add vk_rtx_extension cvar for rtx options, more smart vk_rtx cvar

This commit is contained in:
NightFox 2021-12-02 02:37:23 +03:00 committed by Ivan Avdeev
parent e3cbb785e2
commit 8e0be3c372
3 changed files with 9 additions and 1 deletions

View File

@ -1,5 +1,6 @@
#include "vk_cvar.h"
#include "vk_common.h"
#include "vk_render.h"
#define NONEXTERN_CVAR(cvar) cvar_t *cvar;
DECLARE_CVAR(NONEXTERN_CVAR)
@ -19,5 +20,10 @@ void VK_LoadCvars( void )
vk_rtx_light_end = gEngine.Cvar_Get( "vk_rtx_light_end", "0", 0, "DEBUG: disable lights with index higher than this ");
r_lightmap = gEngine.Cvar_Get( "r_lightmap", "0", FCVAR_CHEAT, "lightmap debugging tool" );
ui_infotool = gEngine.Cvar_Get( "ui_infotool", "0", FCVAR_CHEAT, "DEBUG: print entity info under crosshair" );
vk_rtx = gEngine.Cvar_Get( "vk_rtx", "1", FCVAR_ARCHIVE, "Enable or disable ray tracing mode" );
vk_rtx_extension = gEngine.Cvar_Get( "vk_rtx_extension", vk_core.rtx ? "1" : "0", FCVAR_READ_ONLY, "" );
if (vk_core.rtx) {
vk_rtx = gEngine.Cvar_Get( "vk_rtx", "1", FCVAR_GLCONFIG, "Enable or disable Ray Tracing mode" );
} else {
vk_rtx = gEngine.Cvar_Get( "vk_rtx", "0", FCVAR_READ_ONLY, "DISABLED: not supported without -rtx" );
}
}

View File

@ -19,6 +19,7 @@ void VK_LoadCvars( void );
X(r_lightmap) \
X(ui_infotool) \
X(vk_rtx) \
X(vk_rtx_extension) \
#define EXTERN_CVAR(cvar) extern cvar_t *cvar;
DECLARE_CVAR(EXTERN_CVAR)

View File

@ -512,6 +512,7 @@ void R_EndFrame( void )
static void toggleRaytracing( void ) {
ASSERT(vk_core.rtx);
g_frame.rtx_enabled = !g_frame.rtx_enabled;
gEngine.Cvar_Set("vk_rtx", g_frame.rtx_enabled ? "1" : "0");
gEngine.Con_Printf(S_WARN "Switching ray tracing to %d\n", g_frame.rtx_enabled);
}