rtx: add vk_lights_dump command

It prints out light clusters debugging info.
This commit is contained in:
Ivan Avdeev 2021-10-13 11:57:59 -07:00 committed by Ivan Avdeev
parent af83e47f41
commit 157af769ff
3 changed files with 29 additions and 3 deletions

View File

@ -14,6 +14,7 @@
#include "vk_studio.h"
#include "vk_rtx.h"
#include "vk_descriptor.h"
#include "vk_light.h"
#include "vk_nv_aftermath.h"
#include "xash3d_types.h"
@ -712,6 +713,8 @@ qboolean R_VkInit( void )
{
if (!VK_RayInit())
return false;
VK_LightsInit();
}
return true;
@ -721,6 +724,7 @@ void R_VkShutdown( void )
{
if (vk_core.rtx)
{
VK_LightsShutdown();
VK_RayShutdown();
}

View File

@ -11,6 +11,28 @@
#include <string.h>
#include <ctype.h> // isalnum...
static struct {
qboolean enabled;
char name_filter[256];
} debug_dump_lights;
static void debugDumpLights( void ) {
debug_dump_lights.enabled = true;
if (gEngine.Cmd_Argc() > 1) {
Q_strncpy(debug_dump_lights.name_filter, gEngine.Cmd_Argv(1), sizeof(debug_dump_lights.name_filter));
} else {
debug_dump_lights.name_filter[0] = '\0';
}
}
void VK_LightsInit( void ) {
gEngine.Cmd_AddCommand("vk_lights_dump", debugDumpLights, "Dump all light sources for next frame");
}
void VK_LightsShutdown( void ) {
gEngine.Cmd_RemoveCommand("vk_lights_dump");
}
vk_lights_t g_lights = {0};
static int lookupTextureF( const char *fmt, ...) {
@ -759,6 +781,8 @@ void VK_LightsFrameFinalize( void )
{
const model_t* const world = gEngine.pfnGetModelByIndex( 1 );
debug_dump_lights.enabled = false;
if (g_lights.num_emissive_surfaces > UINT8_MAX) {
gEngine.Con_Printf(S_ERROR "Too many emissive surfaces found: %d; some areas will be dark\n", g_lights.num_emissive_surfaces);
g_lights.num_emissive_surfaces = UINT8_MAX;
@ -868,6 +892,3 @@ void VK_LightsFrameFinalize( void )
/* exit(0); */
}
}
void VK_LightsShutdown( void ) {
}

View File

@ -54,6 +54,7 @@ typedef struct {
extern vk_lights_t g_lights;
void VK_LightsInit( void );
void VK_LightsShutdown( void );
void VK_LightsNewMap( void );