Add vk_rtx command

For enable or disable ray tracing mode
This commit is contained in:
NightFox 2021-11-30 20:50:14 +03:00 committed by Ivan Avdeev
parent 564359ffe2
commit 1bf72f6a1a
3 changed files with 12 additions and 1 deletions

View File

@ -19,4 +19,5 @@ 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" );
}

View File

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

View File

@ -4,6 +4,7 @@
#include "vk_scene.h"
#include "vk_render.h"
#include "vk_rtx.h"
#include "vk_cvar.h"
#include "profiler.h"
@ -311,6 +312,13 @@ static qboolean createSwapchain( void )
void R_BeginFrame( qboolean clearScene )
{
if (vk_core.rtx && FBitSet( vk_rtx->flags, FCVAR_CHANGED )) {
if( CVAR_TO_BOOL( vk_rtx )) {
g_frame.rtx_enabled = 1;
} else {
g_frame.rtx_enabled = 0;
}
}
{
gEngine.Con_NPrintf(5, "Perf scopes:");
for (int i = 0; i < g_aprof.num_scopes; ++i) {
@ -527,8 +535,9 @@ qboolean VK_FrameCtlInit( void )
g_frame.rtx_enabled = vk_core.rtx;
if (vk_core.rtx)
if (vk_core.rtx) {
gEngine.Cmd_AddCommand("vk_rtx_toggle", toggleRaytracing, "Toggle between rasterization and ray tracing");
}
return true;
}