Render passes: make pass image textures as slots fill

pass_slot_cap() limits a generation to what two generations fit in 256 MiB,
but pass_gen_textures() allocated all 17 slots of each generation at
internal-resolution size as soon as passes ran, whatever the cap: 34
textures, about 167 MB at 4x and 1.5 GB at 12x for at most two used slots.

Slot textures are now made on first use, never past the cap, so the budget
holds at any internal scale; a size change frees the old set, and context
teardown frees every pass texture, backup and journal FBO and forgets their
names (a new context no longer reuses dead ones). render_pass_stats reports
image_textures and image_bytes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Shokunin
2026-09-26 03:57:39 -07:00
parent ea1e67a423
commit 856cbabffe
6 changed files with 100 additions and 16 deletions
+7 -3
View File
@@ -7980,9 +7980,11 @@ static void handle_render_pass_stats(int id, const char *json)
{
(void)json;
RenderPassStats st;
uint64_t gd[8];
uint64_t gd[8], image_bytes = 0;
uint32_t image_textures;
render_pass_get_stats(&st);
gl_renderer_pass_diag(gd);
image_textures = gl_renderer_pass_image_textures(&image_bytes);
send_fmt("{\"id\":%d,\"ok\":true,\"plans\":%llu,\"planned\":%llu,"
"\"wanted\":%llu,\"refused\":%llu,\"passes\":%llu,"
"\"aborted\":%llu,\"discarded\":%llu,\"watchdog\":%llu,\"vram_leaks\":%llu,"
@@ -7997,7 +7999,8 @@ static void handle_render_pass_stats(int id, const char *json)
"\"promotions\":%llu,\"pass_presents\":%llu,"
"\"blended_presents\":%llu,\"expired\":%llu,"
"\"unmatched_flips\":%llu,\"early_presents\":%llu,"
"\"cost_us\":%llu,\"frame_images\":%llu,\"journaled\":%llu}",
"\"cost_us\":%llu,\"frame_images\":%llu,\"journaled\":%llu,"
"\"image_textures\":%u,\"image_bytes\":%llu}",
id, (unsigned long long)st.plans, (unsigned long long)st.planned,
(unsigned long long)st.wanted, (unsigned long long)st.refused,
(unsigned long long)st.passes, (unsigned long long)st.aborted,
@@ -8018,7 +8021,8 @@ static void handle_render_pass_stats(int id, const char *json)
(unsigned long long)gd[2], (unsigned long long)gd[3],
(unsigned long long)gd[4], (unsigned long long)gd[5],
(unsigned long long)gd[6], (unsigned long long)gd[7],
(unsigned long long)gl_renderer_pass_journaled());
(unsigned long long)gl_renderer_pass_journaled(),
(unsigned)image_textures, (unsigned long long)image_bytes);
}
/* render_pass_dump path=<dir> count=<n>: write the images (the game's own