mirror of
https://github.com/Cesarus85/ringfall-mjolnir-vr.git
synced 2026-10-21 18:00:31 +02:00
A dedicated server's debug.txt grew 2 GB in 12 hours, almost all of it "maximum light cluster references per map (8192) exceeded", written each time a light could not join a cluster: thousands of times a second on a busy map. A full reference list now says so the first time a map, and the times after are counted and told when the map's lists are let go or made anew. What fits in the lists is as before. The dedicated server draws nothing, and a light's clusters are only used to draw (the lights of an object or the map, and a unit's illumination, which only debug_unit_illumination reads, from the lights drawn that frame). The server (HALO_SERVER) no longer joins lights to clusters, so it does none of that work each tick and never fills the lists. (cherry picked from commit 50cc6274fb5f7697c6f3c25394e15e22f87106f2)
112 lines
2.2 KiB
C
112 lines
2.2 KiB
C
/*
|
|
REFERENCE_LISTS.H
|
|
|
|
file has inline function assertions.
|
|
*/
|
|
|
|
#ifndef __REFERENCE_LISTS_H
|
|
#define __REFERENCE_LISTS_H
|
|
#pragma once
|
|
|
|
/* ---------- headers */
|
|
|
|
#include "game_state.h"
|
|
|
|
/* ---------- constants */
|
|
|
|
/* ---------- macros */
|
|
|
|
/* ---------- structures */
|
|
|
|
struct data_reference
|
|
{
|
|
short identifier;
|
|
word pad;
|
|
long datum_index;
|
|
long next_reference_index;
|
|
};
|
|
|
|
/* ---------- prototypes/EXAMPLE.C */
|
|
|
|
/* ---------- prototypes/CLUSTER_PARTITIONS.C */
|
|
|
|
/* port: a full list's warning, once a map (cluster_partitions.c) */
|
|
void reference_list_port_full(struct data_array *array);
|
|
void reference_list_port_report(struct data_array *array);
|
|
|
|
/* ---------- globals */
|
|
|
|
/* ---------- public code */
|
|
|
|
__inline struct data_array *reference_list_new(
|
|
const char *name,
|
|
short maximum_count)
|
|
{
|
|
char buffer[256];
|
|
|
|
sprintf(buffer, "%s reference", name);
|
|
return game_state_data_new(buffer, maximum_count, sizeof(struct data_reference));
|
|
}
|
|
|
|
__inline long reference_list_get_next_datum_index(
|
|
struct data_array *array,
|
|
long *reference_index)
|
|
{
|
|
long result;
|
|
struct data_reference *reference;
|
|
|
|
if (*reference_index!=NONE)
|
|
{
|
|
reference = (struct data_reference *)datum_get(array, *reference_index);
|
|
*reference_index = reference->next_reference_index;
|
|
result = reference->datum_index;
|
|
}
|
|
else
|
|
{
|
|
result = NONE;
|
|
}
|
|
|
|
return result;
|
|
}
|
|
|
|
__inline void reference_list_add(
|
|
struct data_array *array,
|
|
long *first_reference_index,
|
|
long datum_index)
|
|
{
|
|
long reference_index = datum_new(array);
|
|
|
|
if (reference_index!=NONE)
|
|
{
|
|
struct data_reference *reference = (struct data_reference*)datum_get(array, reference_index);
|
|
reference->datum_index = datum_index;
|
|
reference->next_reference_index = *first_reference_index;
|
|
*first_reference_index = reference_index;
|
|
}
|
|
else
|
|
{
|
|
/* port: once a map, the rest counted (reference_list_port_full) */
|
|
reference_list_port_full(array);
|
|
}
|
|
|
|
return;
|
|
}
|
|
|
|
__inline void reference_list_delete(
|
|
struct data_array *array,
|
|
long first_reference_index)
|
|
{
|
|
long i;
|
|
struct data_reference *reference;
|
|
|
|
for (i = first_reference_index; i!=NONE; i = reference->next_reference_index)
|
|
{
|
|
reference = (struct data_reference*)datum_get(array, i);
|
|
datum_delete(array, i);
|
|
}
|
|
|
|
return;
|
|
}
|
|
|
|
#endif // __REFERENCE_LISTS_H
|