mirror of
https://github.com/w23/xash3d-fwgs
synced 2024-12-15 21:50:59 +01:00
rt: collect stats on dirty light cells
This commit is contained in:
parent
18a7c61505
commit
5da5a1bc94
@ -11,6 +11,9 @@
|
||||
#include "vk_staging.h"
|
||||
#include "vk_commandpool.h"
|
||||
|
||||
#include "vk_light.h" // For stats
|
||||
#include "shaders/ray_interop.h" // stats: struct LightCluster
|
||||
|
||||
#include "profiler.h"
|
||||
|
||||
#include "eiface.h" // ARRAYSIZE
|
||||
@ -182,8 +185,13 @@ static void updateGamma( void ) {
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME move this to r print speeds or something like that
|
||||
// FIXME move this to r_speeds or something like that
|
||||
static void showProfilingData( void ) {
|
||||
{
|
||||
const int dirty = g_lights.stats.dirty_cells;
|
||||
gEngine.Con_NPrintf(4, "Dirty light cells: %d, estimated size = %dKiB\n", dirty, (int)(dirty * sizeof(struct LightCluster) / 1024));
|
||||
}
|
||||
|
||||
gEngine.Con_NPrintf(5, "Perf scopes:");
|
||||
for (int i = 0; i < g_aprof.num_scopes; ++i) {
|
||||
const aprof_scope_t *const scope = g_aprof.scopes + i;
|
||||
|
@ -536,6 +536,7 @@ void RT_LightsNewMapBegin( const struct model_s *map ) {
|
||||
vk_lights_cell_t *const cell = g_lights.cells + i;
|
||||
cell->num_point_lights = cell->num_static.point_lights = 0;
|
||||
cell->num_polygons = cell->num_static.polygons = 0;
|
||||
cell->dirty = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -545,10 +546,16 @@ void RT_LightsFrameBegin( void ) {
|
||||
g_lights_.num_point_lights = g_lights_.num_static.point_lights;
|
||||
g_lights_.num_polygon_vertices = g_lights_.num_static.polygon_vertices;
|
||||
|
||||
g_lights.stats.dirty_cells = 0;
|
||||
|
||||
for (int i = 0; i < g_lights.map.grid_cells; ++i) {
|
||||
vk_lights_cell_t *const cell = g_lights.cells + i;
|
||||
cell->num_polygons = cell->num_static.polygons;
|
||||
cell->num_point_lights = cell->num_static.point_lights;
|
||||
|
||||
if (cell->dirty)
|
||||
++g_lights.stats.dirty_cells;
|
||||
cell->dirty = false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -564,6 +571,7 @@ static qboolean addSurfaceLightToCell( int cell_index, int polygon_light_index )
|
||||
}
|
||||
|
||||
cluster->polygons[cluster->num_polygons++] = polygon_light_index;
|
||||
cluster->dirty = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -578,6 +586,7 @@ static qboolean addLightToCell( int cell_index, int light_index ) {
|
||||
}
|
||||
|
||||
cluster->point_lights[cluster->num_point_lights++] = light_index;
|
||||
cluster->dirty = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -16,6 +16,8 @@ typedef struct {
|
||||
uint8_t point_lights;
|
||||
uint8_t polygons;
|
||||
} num_static;
|
||||
|
||||
qboolean dirty;
|
||||
} vk_lights_cell_t;
|
||||
|
||||
typedef struct {
|
||||
@ -57,6 +59,10 @@ typedef struct {
|
||||
} map;
|
||||
|
||||
vk_lights_cell_t cells[MAX_LIGHT_CLUSTERS];
|
||||
|
||||
struct {
|
||||
int dirty_cells;
|
||||
} stats;
|
||||
} vk_lights_t;
|
||||
|
||||
extern vk_lights_t g_lights;
|
||||
|
Loading…
Reference in New Issue
Block a user