xash3d-fwgs/ref/vk/vk_logs.c

50 lines
1.1 KiB
C
Raw Normal View History

#include "vk_logs.h"
#include "vk_cvar.h"
uint32_t g_log_debug_bits = 0;
static const struct log_pair_t {
const char *name;
uint32_t bit;
} g_log_module_pairs[] = {
2023-08-29 19:12:35 +02:00
{"misc", LogModule_Misc},
{"tex", LogModule_Textures},
{"brush", LogModule_Brush},
{"light", LogModule_Lights},
{"studio", LogModule_Studio},
{"patch", LogModule_Patch},
{"mat", LogModule_Material},
2023-08-29 19:12:35 +02:00
{"meat", LogModule_Meatpipe},
{"rt", LogModule_RT},
{"rmain", LogModule_RMain},
{"sprite", LogModule_Sprite},
};
void R_LogSetVerboseModules( const char *p ) {
g_log_debug_bits = 0;
while (*p) {
const char *next = Q_strchrnul(p, ',');
const const_string_view_t name = {p, next - p};
uint32_t bit = 0;
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;
}
}
if (!bit) {
gEngine.Con_Reportf(S_ERROR "Unknown log module \"%.*s\"\n", name.len, name.s);
}
g_log_debug_bits |= bit;
if (!*next)
break;
p = next + 1;
}
}