Submission CPU time, ambient light following the exposure, unattended benchmark #139

Open
github-bot wants to merge 12 commits from github-bot/gh-139 into main AGit
Owner

@⁠Zetsukae on GitHub · 2026-11-25 16:12 UTC · original
Zetsukae:perf/submission-cpu → main · +964 −61 · 10 files · 12 commits · open

What this does

Speeds up the work the submitting thread does around each submission, found with VICTORY_PROFILE and measured with an unattended benchmark (included).

  • in_parallel keeps its helper threads for the run instead of starting and joining five threads on each call. That was about an eighth of the submitting thread's time.
  • Bindless plans keep their lists (reads, writes, bounces, held resources) while no busy slot changes what it adds to them. When a slot does change, the lists are made from counted contributions, kept up to date as slots change, instead of walking every busy slot. bindless plans went from 45–70 ms to about 19 ms a frame in the world. In test builds, every remake also makes the lists the old way and asserts they are equal.
  • The guards' block sets are bit sets instead of trees. The wait at the guard check disappears from the profile, but it moves to the copy-back's use of the same lock: no measurable frame-rate change. It is kept because it is equivalent (a test compares it against a tree) and makes the next step on that lock easier.
  • Diagnostics: the time spent taking snapshots now appears in the sparse-writes line. Scripted keys (VICTORY_KEYS, VICTORY_KEYS_FILE) also press the stand-in pad's buttons on a real pad in slot 0: while a pad is connected, the title reads the pad and ignores the keyboard.
  • scripts/bench.ps1: an unattended benchmark. It presses Enter at the title screen, waits through the opening cinematic, measures 90 s in the world, can take screenshots, and writes a summary. -GpuTiming also sets VICTORY_D3D12_DRED: per-pipeline GPU times are only recorded when it is set (this is not in the README). scripts/profile-run.ps1 is the same run played by hand.

Results

Standing still in the world (frame lines averaged over 90 s): 3.5–4 fps (250–300 ms) before, 4.75 fps (216 ms) after. Walking: 3–4 fps before, about 5 after.

What is left per frame: GPU about 72 ms (spread over about 1,300 pipelines, the slowest 4.5 ms), refresh copies about 42 ms, snapshots about 36–40 ms, copy-back about 31 ms, bindless plans about 19 ms. These still run one after the other.

Lighting: the ambient stand-in follows the title's exposure

The stand-in for the missing ray-traced indirect light was one constant (0.6). The lighting images it goes into are already multiplied by the title's exposure, so in a dark scene where the title raises the exposure (interiors, night: -5.5 EV) the constant came out as strong as at noon (-9.75 EV): flat and too bright at night, pure black in daytime shadows.

PS_CalculateExposure draws a 1×1 RGBA32F holding (multiplier, EV, EV); in the prison interior it read (0.0221, -5.5, -5.5). The program is found by name, the same way as the resolve, its target is noted, and the ambient pass reads it as a shader resource. The level becomes at · 2^(-k·(EV - ev)): by default k = 0.5 and 1.4 at -9.75 EV, which gives about 0.32 at -5.5 EV. Those are the README's hand-tuned noon and dusk levels. VICTORY_AMBIENT_EXPOSURE=k,ev,at tunes it; setting VICTORY_AMBIENT or using the ambient file still forces a fixed level.

Only checked at dusk in the prison so far. Night has not been looked at yet.

Also new in diagnostics: VICTORY_RESOLVE_CONSTANTS=1 logs the resolve's constants (that's how the exposure was ruled out there), and bench.ps1 gains cinematic screenshots, render-target dumps and -ExtraEnv.

Textures written by the GPU through another view

Skin and tattoos on people showed noise (the guard's forearms, inmates' faces), with a new pattern each launch. With VICTORY_TEXTURES=always (every texture looked at on every use) they rendered correctly, so the data in title memory was right and only the upload was stale. The GPU writes those textures' memory through a buffer view. Copying that back into title memory told the guards, but not the textures placed there. watch::writing, which every write of ours into title memory goes through, now marks the textures in that range (and at the other views of its pages) as rewritten, the same way a streamed file does. The tattoos have rendered correctly since. Textures the title's own CPU threads write are still only caught at their next periodic look.

Findings that are not fixed here

  • VICTORY_ASYNC_SUBMIT=1 and lighting bugs. With async on, prewarm refreshes the next submission's copies while the previous submission's GPU work may still be reading them. Only the ranges it writes are skipped, so a constant buffer it reads can change under it. This fits the lighting errors seen with async on; it is not confirmed with a capture.
  • Snapshots retaken within a frame. Measured at about 13% of snapshot bytes (around 4 ms a frame), so keeping them across submissions is not worth the risk.

Tests

cargo test -p victory-gpu passes, except for the watch::tests failures that already happen on main. Those tests share the guards' global state: run in parallel they fail now and then, with or without this change (3 of 5 runs failed on main), and written_pages_are_reported_to_every_asker fails every time with --test-threads=1, with or without this change. cargo xtask policy reports only the known lower.rs size.

🤖 Generated with Claude Code

**@⁠Zetsukae** on GitHub · 2026-11-25 16:12 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/139) `Zetsukae:perf/submission-cpu` → `main` · +964 −61 · 10 files · 12 commits · open ## What this does Speeds up the work the submitting thread does around each submission, found with `VICTORY_PROFILE` and measured with an unattended benchmark (included). - **`in_parallel` keeps its helper threads** for the run instead of starting and joining five threads on each call. That was about an eighth of the submitting thread's time. - **Bindless plans keep their lists** (reads, writes, bounces, held resources) while no busy slot changes what it adds to them. When a slot does change, the lists are made from counted contributions, kept up to date as slots change, instead of walking every busy slot. `bindless plans` went from 45–70 ms to about 19 ms a frame in the world. In test builds, every remake also makes the lists the old way and asserts they are equal. - **The guards' block sets are bit sets instead of trees.** The wait at the guard check disappears from the profile, but it moves to the copy-back's use of the same lock: no measurable frame-rate change. It is kept because it is equivalent (a test compares it against a tree) and makes the next step on that lock easier. - **Diagnostics:** the time spent taking snapshots now appears in the sparse-writes line. Scripted keys (`VICTORY_KEYS`, `VICTORY_KEYS_FILE`) also press the stand-in pad's buttons on a real pad in slot 0: while a pad is connected, the title reads the pad and ignores the keyboard. - **`scripts/bench.ps1`:** an unattended benchmark. It presses Enter at the title screen, waits through the opening cinematic, measures 90 s in the world, can take screenshots, and writes a summary. `-GpuTiming` also sets `VICTORY_D3D12_DRED`: per-pipeline GPU times are only recorded when it is set (this is not in the README). `scripts/profile-run.ps1` is the same run played by hand. ## Results Standing still in the world (frame lines averaged over 90 s): 3.5–4 fps (250–300 ms) before, **4.75 fps (216 ms)** after. Walking: 3–4 fps before, about 5 after. What is left per frame: GPU about 72 ms (spread over about 1,300 pipelines, the slowest 4.5 ms), refresh copies about 42 ms, snapshots about 36–40 ms, copy-back about 31 ms, bindless plans about 19 ms. These still run one after the other. ## Lighting: the ambient stand-in follows the title's exposure The stand-in for the missing ray-traced indirect light was one constant (0.6). The lighting images it goes into are already multiplied by the title's exposure, so in a dark scene where the title raises the exposure (interiors, night: -5.5 EV) the constant came out as strong as at noon (-9.75 EV): flat and too bright at night, pure black in daytime shadows. `PS_CalculateExposure` draws a 1×1 RGBA32F holding (multiplier, EV, EV); in the prison interior it read (0.0221, -5.5, -5.5). The program is found by name, the same way as the resolve, its target is noted, and the ambient pass reads it as a shader resource. The level becomes `at · 2^(-k·(EV - ev))`: by default k = 0.5 and 1.4 at -9.75 EV, which gives about 0.32 at -5.5 EV. Those are the README's hand-tuned noon and dusk levels. `VICTORY_AMBIENT_EXPOSURE=k,ev,at` tunes it; setting `VICTORY_AMBIENT` or using the ambient file still forces a fixed level. **Only checked at dusk in the prison so far. Night has not been looked at yet.** Also new in diagnostics: `VICTORY_RESOLVE_CONSTANTS=1` logs the resolve's constants (that's how the exposure was ruled out there), and `bench.ps1` gains cinematic screenshots, render-target dumps and `-ExtraEnv`. ## Textures written by the GPU through another view Skin and tattoos on people showed noise (the guard's forearms, inmates' faces), with a new pattern each launch. With `VICTORY_TEXTURES=always` (every texture looked at on every use) they rendered correctly, so the data in title memory was right and only the upload was stale. The GPU writes those textures' memory through a buffer view. Copying that back into title memory told the guards, but not the textures placed there. `watch::writing`, which every write of ours into title memory goes through, now marks the textures in that range (and at the other views of its pages) as rewritten, the same way a streamed file does. The tattoos have rendered correctly since. Textures the title's own CPU threads write are still only caught at their next periodic look. ## Findings that are not fixed here - **`VICTORY_ASYNC_SUBMIT=1` and lighting bugs.** With async on, `prewarm` refreshes the next submission's copies while the previous submission's GPU work may still be reading them. Only the ranges it writes are skipped, so a constant buffer it reads can change under it. This fits the lighting errors seen with async on; it is not confirmed with a capture. - **Snapshots retaken within a frame.** Measured at about 13% of snapshot bytes (around 4 ms a frame), so keeping them across submissions is not worth the risk. ## Tests `cargo test -p victory-gpu` passes, except for the `watch::tests` failures that already happen on `main`. Those tests share the guards' global state: run in parallel they fail now and then, with or without this change (3 of 5 runs failed on `main`), and `written_pages_are_reported_to_every_asker` fails every time with `--test-threads=1`, with or without this change. `cargo xtask policy` reports only the known `lower.rs` size. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Starting and joining five threads per call was an eighth of the submitting
thread's time in the world (CPU profile, ~135 submissions a frame). A pool
of five workers takes one caller at a time; a second caller, or a call from
inside a piece, starts its own threads as before. A panicking piece panics
the caller after every worker is done with the job. Tests: every item once
over many calls, calls from several threads and from inside a piece, a
panic and the pool afterwards.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Once a frame the plan's reads, writes, bounces and held resources were made
again from every busy slot, two tree lookups and reference counts each: a
third of the submitting thread's time standing in the world, a tenth while
walking. Slots made again the same now leave the lists as they are; when one
changes, what each busy slot adds is kept counted as slots change, so the
lists are made from each distinct range once, already in order. Test builds
make them the old way too at every remake and compare. bindless plans went
from 45-70 ms to about 19 ms a frame in the world.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The guards' checks look at every 64 KiB block of a range under the guards'
lock, which every copy's check waits for. A bit set in 256 MiB chunks
answers the same (a test compares it with a tree over 20,000 random
changes and ranges across chunks). The wait at that check is gone from the
profile; it moved to the copy-back's use of the same lock, and the frame
rate did not measurably change.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The sparse copies' snapshots are timed (about 36 ms a frame in the world).
Keys from VICTORY_KEYS / VICTORY_KEYS_FILE also press the stand-in pad's
buttons on a real pad in slot 0: with a pad connected the title reads it,
not the keyboard, and an unattended run's Enter was ignored until the pad
went to sleep.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
bench.ps1 launches the diagnostics build, presses Enter at the title screen
(found in the log), waits through the opening cinematic, measures in the
world with no input, can take screenshots, then ends the title and writes
a summary of the frame lines. With -GpuTiming it sets VICTORY_GPU_TIMING
and VICTORY_D3D12_DRED (the per-pipeline times need the commands noted).
profile-run.ps1 is the same run played by hand. Both key shader cache
entries to a kept copy of the build, so rebuilds that do not touch
translation skip it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The images the constant goes into are pre-exposed, so one level was the
same in a dark scene the title opens the exposure for (indoors, night:
-5.5 EV) as at noon (-9.75 EV): flat and too bright at night, black in the
day's shadows. PS_CalculateExposure draws a 1x1 RGBA32F (multiplier, EV,
EV); the program is found by name like the resolve, its target noted, and
read as a shader resource by the ambient pass: level at * 2^(-k (EV - ev)),
by default k 0.5 at 1.4 for -9.75 EV (about 0.32 at -5.5 EV, the hand-tuned
levels of the README), VICTORY_AMBIENT_EXPOSURE=k,ev,at to tune. A set
VICTORY_AMBIENT or the ambient file keeps a fixed level. Seen at dusk in
the prison only; night not checked yet.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
VICTORY_RESOLVE_CONSTANTS=1 logs the constants the light resolve reads
about once a second (how the exposure was looked for: it is not among
them), and the list of what it reads names each resource. bench.ps1 takes
screenshots through the cinematic (-CinematicShotEvery), dumps a frame's
targets (-DumpTargets, with VICTORY_DUMP_RAW through -ExtraEnv for raw
values and the pass list), and sets other variables (-ExtraEnv).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Conflicts in ambient.rs, draw.rs and pipeline.rs, all from two changes to
the ambient pass: main's (reflections held to a part of the light, an
optional sky follow, the sky image at t1) and this branch's (the level
from the title's exposure). Both are kept: the pass takes depth, sky and
exposure (t0, t1, t2, four views a slot) and 15 constants; from_around()
gives the exposure's level when it does not follow the sky, so the held
reflections follow the exposure too. Tests pass; in the world 7.1 fps
standing (147 ms a frame), the picture as before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Conflicts in descriptor/host.rs and ambient.rs. The plan: main's gating
decides when to build it again (only when a slot needs something it
lacks, or the loose extras are due to go); when it does, the lists come
from this branch's counted contributions (checked against a walk over the
busy slots in test builds), and a plan whose lists no slot changed is
reused, now with main's extra resources field. This branch's Range for
the counted lists is Span, main has a Range of its own. The ambient pass
takes main's reflection floor and this branch's exposure (16 constants).
Tests pass but for watch tests that fail the same on main; in the world
6.75 fps standing, bindless plans 6.8 ms a frame (19 before), the picture
as before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The GPU writes some textures' memory through another view of it (a
buffer): tattoos and skin details on people. Copying that back into title
memory told the guards but not the textures placed there, which kept
their old upload until their turn to be looked at again came, if ever:
skin and tattoos of noise on the guard's forearms and on inmates' faces,
a new pattern each launch, right with every texture looked at at every use
(VICTORY_TEXTURES=always). watch::writing, which every write of ours into
title memory goes through, now marks the textures placed in the range and
at the other views of its pages as rewritten, as a streamed file does.
The guard and the inmates' tattoos are right in a run since; textures the
title's own threads write are still seen only at their next look.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Conflict in ambient.rs: main's light follows the sky dome (a 2D array,
gain, least and power) by default; this branch's level from the title's
exposure stays the fallback where no sky image is drawn (gain 0) instead
of the fixed level. The pass takes depth, sky and exposure (t0, t1, t2,
four views a slot) and 17 constants. Tests pass (victory-gpu 117,
victory-shader 277); in the world 6.6 fps standing with every shader
translated anew, the room lit as before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:36:31 +00:00
Author
Owner

@⁠battledogegames-design on GitHub · 2026-11-25 21:19 UTC · original

WARP reproducer for prewarm overwriting an in-flight upload read

Zetsukae, I tested the overlap you identified in #139 using two D3D12 copy commands and synthetic data. With the first read held on the queue, the next submission's prewarm can update the same upload bytes before the GPU consumes them. The first copy then returns the second submission's value.

Revision Original prewarm Early call omitted as a diagnostic
main, 4f62c2a 20/20 overlap failures 20/20 passes
#139, a208d61 20/20 overlap failures 20/20 passes

Each run used a fresh process. Synchronous overlap and asynchronous disjoint ranges both passed. In every overlap failure, the two reads returned [0xAABBCCDD, 0xAABBCCDD]; the expected values were [0x11223344, 0xAABBCCDD]. A separate fence on the same WARP queue verified completion before readback. No timeouts occurred.

The attached ZIP contains the test patch against main, commands, and results. With the patch applied, run:

cargo test --locked -p victory-gpu --lib host::prewarm_tests::async_prewarm_preserves_an_in_flight_read -- --exact --ignored --nocapture --test-threads=1

The test is opt-in while it demonstrates the open bug. Default CI skips it. The diagnostic comparison leaves the ordinary post-drain refresh in place; its performance cost is unmeasured. These runs establish the buffer overwrite on software WARP. Physical GPU behavior and the proposed connection to lighting still need separate evidence.

Would it help to carry this case in the eventual fix PR, or would you prefer a separate test-only PR?

warp-reproducer.zip

**@⁠battledogegames-design** on GitHub · 2026-11-25 21:19 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/139#issuecomment-7174915714) # WARP reproducer for prewarm overwriting an in-flight upload read Zetsukae, I tested the overlap you identified in #139 using two D3D12 copy commands and synthetic data. With the first read held on the queue, the next submission's prewarm can update the same upload bytes before the GPU consumes them. The first copy then returns the second submission's value. | Revision | Original prewarm | Early call omitted as a diagnostic | |---|---|---| | main, 4f62c2a | 20/20 overlap failures | 20/20 passes | | #139, a208d61 | 20/20 overlap failures | 20/20 passes | Each run used a fresh process. Synchronous overlap and asynchronous disjoint ranges both passed. In every overlap failure, the two reads returned [0xAABBCCDD, 0xAABBCCDD]; the expected values were [0x11223344, 0xAABBCCDD]. A separate fence on the same WARP queue verified completion before readback. No timeouts occurred. The attached ZIP contains the test patch against main, commands, and results. With the patch applied, run: cargo test --locked -p victory-gpu --lib host::prewarm_tests::async_prewarm_preserves_an_in_flight_read -- --exact --ignored --nocapture --test-threads=1 The test is opt-in while it demonstrates the open bug. Default CI skips it. The diagnostic comparison leaves the ordinary post-drain refresh in place; its performance cost is unmeasured. These runs establish the buffer overwrite on software WARP. Physical GPU behavior and the proposed connection to lighting still need separate evidence. Would it help to carry this case in the eventual fix PR, or would you prefer a separate test-only PR? [warp-reproducer.zip](https://github.com/user-attachments/files/35434156/warp-reproducer.zip)
Author
Owner

@⁠Zetsukae on GitHub · 2026-11-25 21:38 UTC · original

Thanks, this is a great reproducer, and it matches what I saw: the early refresh rewrites memory the in-flight submission still reads. Since prewarm is on main and not something #139 adds, a separate test-only PR against main seems cleanest, so the maintainer can take it on its own and a fix can land against it. One data point from here: on an RX 9060 XT, async submission measured within noise of async off (7.85 vs 7.56 fps standing), so skipping the early refresh might cost little; it would be worth measuring alongside the fix.

**@⁠Zetsukae** on GitHub · 2026-11-25 21:38 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/139#issuecomment-7175350127) Thanks, this is a great reproducer, and it matches what I saw: the early refresh rewrites memory the in-flight submission still reads. Since `prewarm` is on `main` and not something #139 adds, a separate test-only PR against `main` seems cleanest, so the maintainer can take it on its own and a fix can land against it. One data point from here: on an RX 9060 XT, async submission measured within noise of async off (7.85 vs 7.56 fps standing), so skipping the early refresh might cost little; it would be worth measuring alongside the fix.
Author
Owner

@⁠MamaLeVrai on GitHub · 2026-11-26 05:10 UTC · original

One side effect of the change to watch::writing (watch.rs, the new stale loop that calls crate::resource::textures_rewritten). It comes from reading the code; I have not run it.

writing is also called where nothing is written. Twice in shadow.rs on this branch, just before title memory is opened in place: crate::watch::writing(start, len) "Read-only guards would refuse the GPU's writes", followed by OpenExistingHeapFromAddress1. With this PR those calls now mark every placed texture in the window as rewritten. texture::rewritten then removes it from HOST_WRITTEN: these are the textures whose contents a host copy or resolve made, while their title memory stayed as it was. At its next use such a texture would be uploaded again from the stale title memory, over what the copy wrote.

That only matters for host-written textures that lie in a window opened in place, so it may be rare. Keeping the textures_rewritten part out of the guard-opening calls (for example a flag, or a separate function for the write-back path) would avoid it.

AI-assisted (Claude Code); no game data.

**@⁠MamaLeVrai** on GitHub · 2026-11-26 05:10 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/139#issuecomment-7183252664) One side effect of the change to `watch::writing` (`watch.rs`, the new `stale` loop that calls `crate::resource::textures_rewritten`). It comes from reading the code; I have not run it. `writing` is also called where nothing is written. Twice in `shadow.rs` on this branch, just before title memory is opened in place: `crate::watch::writing(start, len)` "Read-only guards would refuse the GPU's writes", followed by `OpenExistingHeapFromAddress1`. With this PR those calls now mark every placed texture in the window as rewritten. `texture::rewritten` then removes it from `HOST_WRITTEN`: these are the textures whose contents a host copy or resolve made, while their title memory stayed as it was. At its next use such a texture would be uploaded again from the stale title memory, over what the copy wrote. That only matters for host-written textures that lie in a window opened in place, so it may be rare. Keeping the `textures_rewritten` part out of the guard-opening calls (for example a flag, or a separate function for the write-back path) would avoid it. AI-assisted (Claude Code); no game data.
watch::writing also runs where nothing is written: before title memory
is opened in place for the GPU (OpenExistingHeapFromAddress1, twice in
shadow.rs). Since a208d61 that marked every placed texture in the window
rewritten, and a texture a host copy or resolve made (HOST_WRITTEN) would
then be uploaded over from its stale title memory (MamaLeVrai, review of
#139). writing opens guards as before a208d61; written_back does that and
tells the textures, at the copy-backs (three in shadow.rs), the read-backs
and the title's copies (host.rs).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Owner

@⁠Zetsukae on GitHub · 2026-11-26 12:21 UTC · original

Good catch, thanks. Confirmed: the two writing calls before OpenExistingHeapFromAddress1 only open guards, and with a208d61 they also marked the window's textures rewritten. Fixed in faac6de: watch::writing is back to opening guards only, and a new watch::written_back does that and marks the textures. It's used only where we actually write title memory (the copy-backs in shadow.rs, the read-backs and title copies in host.rs). Tests pass; the tattoo fix goes through written_back unchanged.

**@⁠Zetsukae** on GitHub · 2026-11-26 12:21 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/139#issuecomment-7191895828) Good catch, thanks. Confirmed: the two `writing` calls before `OpenExistingHeapFromAddress1` only open guards, and with a208d61 they also marked the window's textures rewritten. Fixed in faac6de: `watch::writing` is back to opening guards only, and a new `watch::written_back` does that and marks the textures. It's used only where we actually write title memory (the copy-backs in `shadow.rs`, the read-backs and title copies in `host.rs`). Tests pass; the tattoo fix goes through `written_back` unchanged.
Author
Owner

@⁠gut0to on GitHub · 2026-11-27 15:11 UTC · original · reviewed

AI-assisted static review; I traced the new exposure-curve override parser and its shader use. I did not run the test suite.

**@⁠gut0to** on GitHub · 2026-11-27 15:11 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/139#pullrequestreview-6090169627) · **reviewed** AI-assisted static review; I traced the new exposure-curve override parser and its shader use. I did not run the test suite.
@ -31,0 +65,4 @@
let mut curve = [0.5, -9.75, 1.4];
let set = std::env::var("VICTORY_AMBIENT_EXPOSURE").unwrap_or_default();
for (to, v) in curve.iter_mut().zip(set.split(',')) {
if let Ok(v) = v.trim().parse() {
Author
Owner

@⁠gut0to on GitHub · 2026-11-27 15:11 UTC · original

AI-assisted review: f32::parse accepts NaN and infinities, so if let Ok treats them as valid and passes them into the shader constants. For example, k=NaN satisfies the later k != 0.0 check and makes the exposure exponent NaN instead of falling back to the constant level. Could the parser require is_finite() and add a non-finite override case?

**@⁠gut0to** on GitHub · 2026-11-27 15:11 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/139#discussion_r4721005191) AI-assisted review: `f32::parse` accepts `NaN` and infinities, so `if let Ok` treats them as valid and passes them into the shader constants. For example, `k=NaN` satisfies the later `k != 0.0` check and makes the exposure exponent NaN instead of falling back to the constant level. Could the parser require `is_finite()` and add a non-finite override case?
Author
Owner

@⁠gut0to on GitHub · 2026-11-27 15:17 UTC · original · reviewed

AI-assisted static review; I checked the new exposure formula and its documented defaults. I did not run the GPU tests.

**@⁠gut0to** on GitHub · 2026-11-27 15:17 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/139#pullrequestreview-6090242861) · **reviewed** AI-assisted static review; I checked the new exposure formula and its documented defaults. I did not run the GPU tests.
@ -280,0 +328,4 @@
if (has_exposure > 0.0 && k != 0.0) {
float e = exposure.Load(int3(0, 0, 0)).y;
// A plausible EV only; else the constant.
if (e > -20.0 && e < 10.0) return clamp(at_ev * exp2(-k * (e - ev)), 0.01, 4.0);
Author
Owner

@⁠gut0to on GitHub · 2026-11-27 15:17 UTC · original

AI-assisted review: the default ambient level now depends on this EV curve, whose direction and constants were tuned by hand. Could a deterministic test cover the default point (EV = -9.75 gives 1.4), a darker point (EV = -5.5 gives about 0.3), and the fallback for an out-of-range EV? That would lock the intended behavior and catch a future sign or clamp regression.

**@⁠gut0to** on GitHub · 2026-11-27 15:17 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/139#discussion_r4721066705) AI-assisted review: the default ambient level now depends on this EV curve, whose direction and constants were tuned by hand. Could a deterministic test cover the default point (`EV = -9.75` gives `1.4`), a darker point (`EV = -5.5` gives about `0.3`), and the fallback for an out-of-range EV? That would lock the intended behavior and catch a future sign or clamp regression.
This pull request can be merged automatically.
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/139/head:github-bot/gh-139'
git switch 'github-bot/gh-139'

Merge

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