feat(gpu): pré-drena texturas na fila durante telas de loading (low-draw) e adiciona VICTORY_TEXTURE_PASS_MB #125

Open
github-bot wants to merge 2 commits from github-bot/gh-125 into main AGit
Owner

@⁠ItzMeGamer on GitHub · 2026-11-26 15:31 UTC · original
ItzMeGamer:feat/loading-screen-texture-drain → main · +491 −52 · 3 files · 2 commits · open

Resumo

Acelera o esvaziamento da fila textures picked by index durante as próprias telas de loading e menus 2D (< 150 draws/frame), evitando que milhares de texturas (como pele/rosto de personagens em interiores e LODs) fiquem acumuladas por centenas de quadros após entrar no mundo 3D.

O que foi corrigido e implementado (crates/victory-gpu)

  1. Pré-drenagem automática em telas de loading (draw.rs, descriptor/host.rs, resource.rs):
    • Em quadros com poucos draws (< 150 draws/frame) quando há slots vencidos (due) na fila textures picked by index, State::early_textures eleva automaticamente o orçamento de upload por quadro de 12 ms / 64 MiB para 400 ms / 256 MiB (limitado a 1500 ms abaixo do TDR de 2 s do Windows e respeitando o saldo restante de VICTORY_TEXTURE_BUDGET_MB).
    • Corrige também a marcação prematura de EARLY_FRAME antes de verificar se o draw possui view heap vinculado.
  2. Correção da margem PER_TEXTURE_BUDGET em heap_textures (draw.rs):
    • Escala a margem de segurança (PER_TEXTURE_BUDGET.min(bytes_at_most / 4)) para que passes de <= 64 MiB não interrompam o loop após subir apenas uma única textura.
  3. Variáveis de ambiente (VICTORY_TEXTURE_PASS_MB e VICTORY_LOADING_DRAIN):
    • VICTORY_TEXTURE_PASS_MB: permite definir explicitamente o limite de bytes por quadro nos passes de upload de texturas.
    • VICTORY_LOADING_DRAIN=0: permite desativar o boost automático em telas de loading (ativado por padrão).

Testes e Validação

  • Novos testes unitários em crates/victory-gpu/src/draw.rs (loading_screen_boosts_pass_budget_when_due_and_low_draw e pass_budget_respects_env_overrides_and_tdr_and_texture_budget).
  • cargo test -p victory-gpu -> 207 passed, 0 failed.

(Assistido por IA com Antigravity).
@⁠uiliannn

**@⁠ItzMeGamer** on GitHub · 2026-11-26 15:31 UTC · [original](https://github.com/uiliannn/VItoriaBr/pull/125) `ItzMeGamer:feat/loading-screen-texture-drain` → `main` · +491 −52 · 3 files · 2 commits · open ## Resumo Acelera o esvaziamento da fila `textures picked by index` **durante as próprias telas de loading e menus 2D** (`< 150` draws/frame), evitando que milhares de texturas (como pele/rosto de personagens em interiores e LODs) fiquem acumuladas por centenas de quadros após entrar no mundo 3D. ### O que foi corrigido e implementado (`crates/victory-gpu`) 1. **Pré-drenagem automática em telas de loading (`draw.rs`, `descriptor/host.rs`, `resource.rs`)**: - Em quadros com poucos draws (`< 150` draws/frame) quando há slots vencidos (`due`) na fila `textures picked by index`, `State::early_textures` eleva automaticamente o orçamento de upload por quadro de `12 ms / 64 MiB` para **`400 ms / 256 MiB`** (limitado a `1500 ms` abaixo do TDR de 2 s do Windows e respeitando o saldo restante de `VICTORY_TEXTURE_BUDGET_MB`). - Corrige também a marcação prematura de `EARLY_FRAME` antes de verificar se o draw possui view heap vinculado. 2. **Correção da margem `PER_TEXTURE_BUDGET` em `heap_textures` (`draw.rs`)**: - Escala a margem de segurança (`PER_TEXTURE_BUDGET.min(bytes_at_most / 4)`) para que passes de `<= 64 MiB` não interrompam o loop após subir apenas uma única textura. 3. **Variáveis de ambiente (`VICTORY_TEXTURE_PASS_MB` e `VICTORY_LOADING_DRAIN`)**: - `VICTORY_TEXTURE_PASS_MB`: permite definir explicitamente o limite de bytes por quadro nos passes de upload de texturas. - `VICTORY_LOADING_DRAIN=0`: permite desativar o boost automático em telas de loading (ativado por padrão). ### Testes e Validação - Novos testes unitários em `crates/victory-gpu/src/draw.rs` (`loading_screen_boosts_pass_budget_when_due_and_low_draw` e `pass_budget_respects_env_overrides_and_tdr_and_texture_budget`). - `cargo test -p victory-gpu` -> **207 passed, 0 failed**. *(Assistido por IA com Antigravity).* @⁠uiliannn
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 15:34:46 +00:00
Author
Owner

@⁠ItzMeGamer on GitHub · 2026-11-26 16:02 UTC · original

Nota sobre uso de RAM em sistemas de 16 GB + HDD: Como a pré-drenagem em telas de loading envia mais texturas simultaneamente (256 MiB / 400 ms), nos testes em sistema com 16 GB de RAM + HDD o uso total de RAM chegou a 95–98% durante a carga (sem crash quando combinado com #107 + #111 e pagefile manual no SSD). Em máquinas com pouca RAM livre, pode-se reduzir o teto via VICTORY_TEXTURE_PASS_MB (ex.: 64 ou 128) ou desativar o boost com VICTORY_LOADING_DRAIN=0.
@⁠uiliannn

**@⁠ItzMeGamer** on GitHub · 2026-11-26 16:02 UTC · [original](https://github.com/uiliannn/VItoriaBr/pull/125#issuecomment-7197101602) **Nota sobre uso de RAM em sistemas de 16 GB + HDD:** Como a pré-drenagem em telas de loading envia mais texturas simultaneamente (`256 MiB / 400 ms`), nos testes em sistema com **16 GB de RAM + HDD** o uso total de RAM chegou a **95–98%** durante a carga (sem crash quando combinado com **#107** + **#111** e pagefile manual no SSD). Em máquinas com pouca RAM livre, pode-se reduzir o teto via `VICTORY_TEXTURE_PASS_MB` (ex.: `64` ou `128`) ou desativar o boost com `VICTORY_LOADING_DRAIN=0`. @⁠uiliannn
Author
Owner

@⁠fladit123 on GitHub · 2026-11-26 19:54 UTC · original · requested changes

Reviewed HEAD 4bfbf98e139643ab93996f79c069efe996e013a5 against the current main.

The loading-screen texture pre-drain is an interesting approach, especially for 8 GB GPUs. However, I found three points worth addressing before enabling this behavior by default.

1. Existing early-pass disable semantics

compute_early_pass_budget() can select the 400 ms loading-drain path even when VICTORY_EARLY_TEXTURES_MS=0 and VICTORY_BAKE_TEXTURES_MS=0.

Previously, these settings disabled early texture passes. Please preserve the existing opt-out behavior, or explicitly document the changed semantics and add a regression test for this configuration.

2. Active-world texture starvation

The active-3D cap reduces the regular texture upload budget from 192 MiB to 32 MiB, and a catch-up pass can fall from 576 MiB to 32 MiB.

This may improve frame times while extending the time needed to drain a large texture backlog. It would be useful to measure queue depth, texture readiness, time to drain, visual correctness and frame-time percentiles together.

3. TDR and memory pressure

A CPU preparation-time budget below 2 seconds does not guarantee that GPU execution remains below the TDR threshold.

The reported 95–98% RAM utilization on a 16 GB machine also suggests that memory-pressure-aware admission may be safer than relying exclusively on draw counts and fixed upload budgets.

I would recommend retaining the previous defaults until the loading-drain behavior has been independently qualified, or keeping the new policy opt-in initially.

Static source review only. No local build or gameplay validation performed.

AI-assisted review using OpenAI ChatGPT.

**@⁠fladit123** on GitHub · 2026-11-26 19:54 UTC · [original](https://github.com/uiliannn/VItoriaBr/pull/125#pullrequestreview-6079831076) · **requested changes** Reviewed HEAD `4bfbf98e139643ab93996f79c069efe996e013a5` against the current main. The loading-screen texture pre-drain is an interesting approach, especially for 8 GB GPUs. However, I found three points worth addressing before enabling this behavior by default. **1. Existing early-pass disable semantics** `compute_early_pass_budget()` can select the 400 ms loading-drain path even when `VICTORY_EARLY_TEXTURES_MS=0` and `VICTORY_BAKE_TEXTURES_MS=0`. Previously, these settings disabled early texture passes. Please preserve the existing opt-out behavior, or explicitly document the changed semantics and add a regression test for this configuration. **2. Active-world texture starvation** The active-3D cap reduces the regular texture upload budget from 192 MiB to 32 MiB, and a catch-up pass can fall from 576 MiB to 32 MiB. This may improve frame times while extending the time needed to drain a large texture backlog. It would be useful to measure queue depth, texture readiness, time to drain, visual correctness and frame-time percentiles together. **3. TDR and memory pressure** A CPU preparation-time budget below 2 seconds does not guarantee that GPU execution remains below the TDR threshold. The reported 95–98% RAM utilization on a 16 GB machine also suggests that memory-pressure-aware admission may be safer than relying exclusively on draw counts and fixed upload budgets. I would recommend retaining the previous defaults until the loading-drain behavior has been independently qualified, or keeping the new policy opt-in initially. Static source review only. No local build or gameplay validation performed. AI-assisted review using OpenAI ChatGPT.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/125/head:github-bot/gh-125'
git switch 'github-bot/gh-125'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-125'
git switch 'github-bot/gh-125'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-125'
git switch 'github-bot/gh-125'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-125'
git switch 'main'
git merge --squash 'github-bot/gh-125'
git switch 'main'
git merge --ff-only 'github-bot/gh-125'
git switch 'main'
git merge 'github-bot/gh-125'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.