mirror of
https://github.com/w23/xash3d-fwgs
synced 2025-01-18 14:50:05 +01:00
cvar improvements №2
added vk_only for old -rtx behavior (full disable rtx pipeline) remove -vkskipdev and skip_first_device as unused and obsolete remove obsolete check ("missing ray tracing extensions") addedv VK_LoadCvarsRTX for rtx commands remove vk_rtx_prev_frame_blend_factor as an outdated command added vk_deviceid as a stub for video device selection vk_rtx_reload_materials no longer shown when vk_core.rtx = 0
This commit is contained in:
parent
b0e3ebfc32
commit
ea1767f2c2
@ -398,7 +398,7 @@ static int enumerateDevices( vk_available_device_t **available_devices ) {
|
||||
this_device->ray_tracing = deviceSupportsRtx(extensions, num_device_extensions);
|
||||
gEngine.Con_Printf("\t\tRay tracing supported: %d\n", this_device->ray_tracing);
|
||||
|
||||
if (!vk_core.rtx && this_device->ray_tracing) {
|
||||
if (!vk_core.rtx && this_device->ray_tracing && !CVAR_TO_BOOL(vk_only)) {
|
||||
vk_core.rtx = true;
|
||||
}
|
||||
|
||||
@ -417,7 +417,7 @@ static int enumerateDevices( vk_available_device_t **available_devices ) {
|
||||
return this_device - *available_devices;
|
||||
}
|
||||
|
||||
static qboolean createDevice( qboolean skip_first_device ) {
|
||||
static qboolean createDevice( void ) {
|
||||
void *head = NULL;
|
||||
vk_available_device_t *available_devices;
|
||||
const int num_available_devices = enumerateDevices( &available_devices );
|
||||
@ -489,11 +489,6 @@ static qboolean createDevice( qboolean skip_first_device ) {
|
||||
.ppEnabledExtensionNames = device_extensions,
|
||||
};
|
||||
|
||||
if (vk_core.rtx && !candidate_device->ray_tracing) {
|
||||
gEngine.Con_Printf(S_WARN "Skipping device %d due to missing ray tracing extensions\n", i);
|
||||
continue;
|
||||
}
|
||||
|
||||
// FIXME do only once
|
||||
vkGetPhysicalDeviceMemoryProperties(candidate_device->device, &vk_core.physical_device.memory_properties);
|
||||
|
||||
@ -608,12 +603,9 @@ qboolean R_VkInit( void )
|
||||
{
|
||||
// FIXME !!!! handle initialization errors properly: destroy what has already been created
|
||||
|
||||
// FIXME need to be able to pick up devices by indexes, but xash doesn't let us read arguments :(
|
||||
// So for now we will just skip the first available device
|
||||
const qboolean skip_first_device = !!(gEngine.Sys_CheckParm("-vkskipdev"));
|
||||
|
||||
vk_core.debug = !!(gEngine.Sys_CheckParm("-vkdebug") || gEngine.Sys_CheckParm("-gldebug"));
|
||||
vk_core.rtx = false;
|
||||
VK_LoadCvars();
|
||||
|
||||
if( !gEngine.R_Init_Video( REF_VULKAN )) // request Vulkan surface
|
||||
{
|
||||
@ -659,9 +651,11 @@ qboolean R_VkInit( void )
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!createDevice( skip_first_device ))
|
||||
if (!createDevice())
|
||||
return false;
|
||||
|
||||
VK_LoadCvarsRTX();
|
||||
|
||||
if (!initSurface())
|
||||
return false;
|
||||
|
||||
@ -697,8 +691,6 @@ qboolean R_VkInit( void )
|
||||
if (!VK_DescriptorInit())
|
||||
return false;
|
||||
|
||||
VK_LoadCvars();
|
||||
|
||||
if (!VK_FrameCtlInit())
|
||||
return false;
|
||||
|
||||
|
@ -13,17 +13,20 @@ void VK_LoadCvars( void )
|
||||
r_lighting_modulate = gEngine.Cvar_Get( "r_lighting_modulate", "0.6", FCVAR_ARCHIVE, "lightstyles modulate scale" );
|
||||
cl_lightstyle_lerping = gEngine.pfnGetCvarPointer( "cl_lightstyle_lerping", 0 );
|
||||
r_drawentities = gEngine.pfnGetCvarPointer( "r_drawentities", 0 );
|
||||
vk_rtx_bounces = gEngine.Cvar_Get( "vk_rtx_bounces", "2", FCVAR_ARCHIVE, "RTX path tracing ray bounces" );
|
||||
vk_rtx_prev_frame_blend_factor = gEngine.Cvar_Get("vk_rtx_prev_frame_blend_factor", "0.1", FCVAR_ARCHIVE, "RTX path tracer ghetto temporal denoiser strength");
|
||||
|
||||
vk_rtx_light_begin = gEngine.Cvar_Get( "vk_rtx_light_begin", "0", 0, "DEBUG: disable lights with index lower than this");
|
||||
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_only = gEngine.Cvar_Get( "vk_only", "0", FCVAR_GLCONFIG, "Full disable Ray Tracing pipeline" );
|
||||
vk_deviceid = gEngine.Cvar_Get( "vk_deviceid", "0", FCVAR_GLCONFIG, "Selected video device id" );
|
||||
}
|
||||
void VK_LoadCvarsRTX( void )
|
||||
{
|
||||
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" );
|
||||
vk_rtx_bounces = gEngine.Cvar_Get( "vk_rtx_bounces", "3", FCVAR_GLCONFIG, "RTX path tracing ray bounces" );
|
||||
vk_rtx_light_begin = gEngine.Cvar_Get( "vk_rtx_light_begin", "0", FCVAR_CHEAT, "DEBUG: disable lights with index lower than this");
|
||||
vk_rtx_light_end = gEngine.Cvar_Get( "vk_rtx_light_end", "0", FCVAR_CHEAT, "DEBUG: disable lights with index higher than this ");
|
||||
} else {
|
||||
vk_rtx = gEngine.Cvar_Get( "vk_rtx", "0", FCVAR_READ_ONLY, "DISABLED: not supported by your hardware/software" );
|
||||
}
|
||||
}
|
||||
}
|
@ -8,18 +8,20 @@
|
||||
#define CVAR_TO_BOOL( x ) ((x) && ((x)->value != 0.0f) ? true : false )
|
||||
|
||||
void VK_LoadCvars( void );
|
||||
void VK_LoadCvarsRTX( void );
|
||||
|
||||
#define DECLARE_CVAR(X) \
|
||||
X(r_lighting_modulate) \
|
||||
X(cl_lightstyle_lerping) \
|
||||
X(vk_rtx_bounces) \
|
||||
X(vk_rtx_prev_frame_blend_factor) \
|
||||
X(vk_rtx_light_begin) \
|
||||
X(vk_rtx_light_end) \
|
||||
X(r_lightmap) \
|
||||
X(ui_infotool) \
|
||||
X(vk_rtx) \
|
||||
X(vk_rtx_extension) \
|
||||
X(vk_only) \
|
||||
X(vk_deviceid) \
|
||||
|
||||
#define EXTERN_CVAR(cvar) extern cvar_t *cvar;
|
||||
DECLARE_CVAR(EXTERN_CVAR)
|
||||
|
@ -755,7 +755,6 @@ LIST_GBUFFER_IMAGES(GBUFFER_WRITE_BARRIER)
|
||||
.time = gpGlobals->time,
|
||||
.random_seed = (uint32_t)gEngine.COM_RandomLong(0, INT32_MAX),
|
||||
.bounces = vk_rtx_bounces->value,
|
||||
.prev_frame_blend_factor = vk_rtx_prev_frame_blend_factor->value,
|
||||
.pixel_cone_spread_angle = atanf((2.0f*tanf(DEG2RAD(fov_angle_y) * 0.5f)) / (float)FRAME_HEIGHT),
|
||||
.debug_light_index_begin = (uint32_t)(vk_rtx_light_begin->value),
|
||||
.debug_light_index_end = (uint32_t)(vk_rtx_light_end->value),
|
||||
|
@ -49,8 +49,9 @@ void VK_SceneInit( void )
|
||||
{
|
||||
g_lists.draw_list = g_lists.draw_stack;
|
||||
g_lists.draw_stack_pos = 0;
|
||||
|
||||
gEngine.Cmd_AddCommand("vk_rtx_reload_materials", XVK_ReloadMaterials, "Reload PBR materials");
|
||||
if (vk_core.rtx) {
|
||||
gEngine.Cmd_AddCommand("vk_rtx_reload_materials", XVK_ReloadMaterials, "Reload PBR materials");
|
||||
}
|
||||
}
|
||||
|
||||
#define R_ModelOpaque( rm ) ( rm == kRenderNormal )
|
||||
|
Loading…
x
Reference in New Issue
Block a user