vk: make `vk_debug_log` a command, not a cvar
This makes it easily switchable at any point in time. Still not sure how to properly manage log verbosity cvars: - cvars are loaded after initialization and map load, so we can't really depend on saved cvar values. - reloading cvars each frame cancels `-vkverboselogs` arg that is supposed to work around the above limitation
This commit is contained in:
parent
9eff6fa907
commit
266f57e8a5
|
@ -1,3 +1,12 @@
|
|||
# 2023-11-07 E326
|
||||
- [x] list supported arguments for `rt_debug_display_only` cvar
|
||||
- [x] make vk_debug_log a command
|
||||
- [ ] remove stvecs from patches -- not used, inconvenient
|
||||
- [ ] patch texture coordinates by matrices
|
||||
- [ ] add support for matrices to mapents
|
||||
- [ ] convert old direct scale/offset patches to matrices and check that they work
|
||||
- [ ] remove old direct scale/offset patches
|
||||
|
||||
# 2023-11-06 E325
|
||||
- [x] fix material asserts and inherit
|
||||
- [x] fixup -vkverboselogs
|
||||
|
|
|
@ -701,7 +701,6 @@ qboolean R_VkInit( void )
|
|||
vk_core.rtx = false;
|
||||
|
||||
VK_LoadCvars();
|
||||
VK_LogsReadCvar();
|
||||
|
||||
// Force extremely verbose logs at startup.
|
||||
// This is instrumental in some investigations, because the usual "vk_debug_log" cvar is not set
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include "vk_cvar.h"
|
||||
#include "vk_common.h"
|
||||
#include "vk_core.h"
|
||||
#include "vk_logs.h"
|
||||
|
||||
#define NONEXTERN_CVAR(cvar) cvar_t *cvar;
|
||||
DECLARE_CVAR(NONEXTERN_CVAR)
|
||||
|
@ -8,6 +9,13 @@ DECLARE_CVAR(NONEXTERN_CVAR)
|
|||
|
||||
DEFINE_ENGINE_SHARED_CVAR_LIST()
|
||||
|
||||
static void setDebugLog( void ) {
|
||||
const int argc = gEngine.Cmd_Argc();
|
||||
const char *const modules = argc > 1 ? gEngine.Cmd_Argv(1) : "";
|
||||
gEngine.Cvar_Set("vk_debug_log_", modules);
|
||||
R_LogSetVerboseModules( modules );
|
||||
}
|
||||
|
||||
void VK_LoadCvars( void )
|
||||
{
|
||||
#define gEngfuncs gEngine // ...
|
||||
|
@ -20,7 +28,9 @@ void VK_LoadCvars( void )
|
|||
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, "List of modules to enable debug logs for");
|
||||
vk_debug_log = gEngine.Cvar_Get("vk_debug_log_", "", FCVAR_GLCONFIG | FCVAR_READ_ONLY, "");
|
||||
|
||||
gEngine.Cmd_AddCommand("vk_debug_log", setDebugLog, "Set modules to enable debug logs for");
|
||||
}
|
||||
|
||||
void VK_LoadCvarsAfterInit( void )
|
||||
|
|
|
@ -20,9 +20,8 @@ static const struct log_pair_t {
|
|||
{"sprite", LogModule_Sprite},
|
||||
};
|
||||
|
||||
void VK_LogsReadCvar(void) {
|
||||
void R_LogSetVerboseModules( const char *p ) {
|
||||
g_log_debug_bits = 0;
|
||||
const char *p = vk_debug_log->string;
|
||||
while (*p) {
|
||||
const char *next = Q_strchrnul(p, ',');
|
||||
const const_string_view_t name = {p, next - p};
|
||||
|
@ -31,6 +30,7 @@ void VK_LogsReadCvar(void) {
|
|||
for (int i = 0; i < COUNTOF(g_log_module_pairs); ++i) {
|
||||
const struct log_pair_t *const pair = g_log_module_pairs + i;
|
||||
if (stringViewCmp(name, pair->name) == 0) {
|
||||
gEngine.Con_Reportf("Enabling verbose logs for module \"%.*s\"\n", name.len, name.s);
|
||||
bit = pair->bit;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -77,5 +77,4 @@ extern uint32_t g_log_debug_bits;
|
|||
++called; \
|
||||
} while(0)
|
||||
|
||||
// Read debug-enabled modules from cvar
|
||||
void VK_LogsReadCvar(void);
|
||||
void R_LogSetVerboseModules( const char *modules );
|
||||
|
|
Loading…
Reference in New Issue