[pr-fix][rendering] A texture that is not there yet gets a stand-in picked by what it is used for (DARNER_EFFECT_CLEAR) #380

Open
mrfuzzypants wants to merge 1 commit from mrfuzzypants/Darner:effect-squares-stand-in into main
First-time contributor

Contributor role (optional)

  • Fluxer ID: 1577770322256461824

What it changes

  • The problem on main: read from the code only, then seen in the game. neutral_for (crates/darner-gpu/src/descriptor/host.rs) gives every 2D slot whose texture is not there yet one texel of gray, 0x80 in all four channels, alpha included. An effect sprite (smoke, dust, blood, sparks) draws that as a solid half-cover square, and an HDR glow the title draws added draws it as a bright one: the "smoke, blood and water show as coloured squares" known issue on #197.

  • This is the stand-in VIctory's fork already uses (VICTORY_EFFECT_CLEAR), ported without a change of Darner's own. The stand-in is picked by what such a texture is used for:

    view stand-in why
    a format with alpha (RGBA, BGRA, BC1-3, BC7, A8) the same gray, alpha 0 a sprite or a decal: drawn, it covers nothing
    BC6H 0 an HDR glow, drawn added: black adds nothing
    SNORM (RGBA16, RGBA8, RG16, RG8, R16, R8, BC4, BC5) 0 a signed normal or an offset: 0 is flat, 0.5 is not
    one channel (R8, R16, BC4) and two channels (RG8, RG16, RG32, BC5) gray; with STRONG a one-channel mask goes black a two-channel normal or distortion map stays gray even with STRONG: black would tilt every normal and shift every distorted pixel
  • DARNER_EFFECT_CLEAR (on unless 0; strong is the variant above) is read once at the start and has a row in F1 under PICTURE, EFFECT SQUARES STAND-IN, next to TEXTURE LOD BIAS. DARNER_EFFECT_CLEAR=0 is byte for byte the stand-in of today: the gray texture is still made once, by the same function, and the slots that took it keep taking that very texture. The clear and black ones live in their own table, made once, at most eight textures.

  • What this does not do: the texture is still missing when it is sampled. It hides the square, it does not make the texture arrive. An effect that lasts long enough can still show nothing where the square was, and the count line says how often the stand-in is used, so a scene where it is used for a long time is measurable rather than guessed at.

How it was tested

  • Tested revision: d4c1232, on main f3840d7.
  • Commands and results:
    • cargo test --locked -p darner-gpu --lib descriptor::host::tests — 95 tests, 94 passed, 0 failed, 1 ignored, including a new a_stand_in_is_picked_by_the_kind_of_texture_it_replaces (BC7 clear, BC6H and BC5 SNORM black, BC4 gray, BC5 gray with STRONG, and gray for every format with the switch off).
    • cargo build --release --locked -p darner — clean, target\release\darner.exe.
    • cargo xtask policy --staged — 0 files (nothing staged at that point); the diff adds one line to README.md and no data files.
    • Gates: gate 3 run for descriptor::host only; gate 1 and gate 2 not run by me.
  • Changes a default: yes, for every card: a 2D slot whose texture is not there yet no longer always shows gray.
  • A/B result: no frame rate claim and no fps measurement. In the game, on the PC below, the squares at sparks, fire, smoke and dust are there with DARNER_EFFECT_CLEAR=0 and gone without it, same scene and settings; that is a rendering result, not a performance one, and it is one PC.
  • Gameplay: NVIDIA GeForce RTX 4050 Laptop GPU 8 GB, driver 32.0.15.8157, i5-13420H, 16 GB RAM, Windows 11 build 26100.
  • Shader wave sizes tested: not relevant (no shader change).
  • Hardware dependence: likely general — the formats and the stand-in are the title's, not the card's — but only one NVIDIA card was run. The reporter of the known issue says "on some PCs", so a card where the square never showed should be unchanged: it never took the stand-in for that effect.
  • Coverage gaps: one PC, one profile, no AMD or Intel run; the in-game check is the reporter's, not a scripted scene; no A/B carried over a long session, so how long a slot stays on the stand-in in a heavy scene is not measured.

Checklist

  • I ran this change in the game, or say below why it can't be (docs, tests only).
  • This PR contains one change based on main.
  • The diff follows docs/asset-policy.md.
  • I recorded this PR's dependencies below.
    • Depends on: none

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches.
  • Related PRs: #335 (co11ector) changes the same function for a different symptom, the CPU occlusion image's stand-in and the one-frame vanishing trees of #263; nothing of it is replaced or needed here.
  • Replaces or overlaps: none found
## Contributor role (optional) - Fluxer ID: 1577770322256461824 ## What it changes - The problem on main: read from the code only, then seen in the game. `neutral_for` (`crates/darner-gpu/src/descriptor/host.rs`) gives every 2D slot whose texture is not there yet one texel of gray, 0x80 in all four channels, alpha included. An effect sprite (smoke, dust, blood, sparks) draws that as a solid half-cover square, and an HDR glow the title draws added draws it as a bright one: the "smoke, blood and water show as coloured squares" known issue on #197. - This is the stand-in VIctory's fork already uses (`VICTORY_EFFECT_CLEAR`), ported without a change of Darner's own. The stand-in is picked by what such a texture is used for: | view | stand-in | why | |---|---|---| | a format with alpha (RGBA, BGRA, BC1-3, BC7, A8) | the same gray, alpha 0 | a sprite or a decal: drawn, it covers nothing | | BC6H | 0 | an HDR glow, drawn added: black adds nothing | | SNORM (RGBA16, RGBA8, RG16, RG8, R16, R8, BC4, BC5) | 0 | a signed normal or an offset: 0 is flat, 0.5 is not | | one channel (R8, R16, BC4) and two channels (RG8, RG16, RG32, BC5) | gray; with `STRONG` a one-channel mask goes black | a two-channel normal or distortion map stays gray even with `STRONG`: black would tilt every normal and shift every distorted pixel | - `DARNER_EFFECT_CLEAR` (on unless `0`; `strong` is the variant above) is read once at the start and has a row in F1 under PICTURE, EFFECT SQUARES STAND-IN, next to TEXTURE LOD BIAS. `DARNER_EFFECT_CLEAR=0` is byte for byte the stand-in of today: the gray texture is still made once, by the same function, and the slots that took it keep taking that very texture. The clear and black ones live in their own table, made once, at most eight textures. - What this does not do: the texture is still missing when it is sampled. It hides the square, it does not make the texture arrive. An effect that lasts long enough can still show nothing where the square was, and the count line says how often the stand-in is used, so a scene where it is used for a long time is measurable rather than guessed at. ## How it was tested - Tested revision: d4c1232, on `main` f3840d7. - Commands and results: - `cargo test --locked -p darner-gpu --lib descriptor::host::tests` — 95 tests, 94 passed, 0 failed, 1 ignored, including a new `a_stand_in_is_picked_by_the_kind_of_texture_it_replaces` (BC7 clear, BC6H and BC5 SNORM black, BC4 gray, BC5 gray with STRONG, and gray for every format with the switch off). - `cargo build --release --locked -p darner` — clean, `target\release\darner.exe`. - `cargo xtask policy --staged` — 0 files (nothing staged at that point); the diff adds one line to `README.md` and no data files. - Gates: gate 3 run for `descriptor::host` only; gate 1 and gate 2 not run by me. - Changes a default: yes, for every card: a 2D slot whose texture is not there yet no longer always shows gray. - A/B result: no frame rate claim and no fps measurement. In the game, on the PC below, the squares at sparks, fire, smoke and dust are there with `DARNER_EFFECT_CLEAR=0` and gone without it, same scene and settings; that is a rendering result, not a performance one, and it is one PC. - Gameplay: NVIDIA GeForce RTX 4050 Laptop GPU 8 GB, driver 32.0.15.8157, i5-13420H, 16 GB RAM, Windows 11 build 26100. - Shader wave sizes tested: not relevant (no shader change). - Hardware dependence: likely general — the formats and the stand-in are the title's, not the card's — but only one NVIDIA card was run. The reporter of the known issue says "on some PCs", so a card where the square never showed should be unchanged: it never took the stand-in for that effect. - Coverage gaps: one PC, one profile, no AMD or Intel run; the in-game check is the reporter's, not a scripted scene; no A/B carried over a long session, so how long a slot stays on the stand-in in a heavy scene is not measured. ## Checklist - [x] I ran this change in the game, or say below why it can't be (docs, tests only). - [x] This PR contains one change based on `main`. - [x] The diff follows `docs/asset-policy.md`. - [x] I recorded this PR's dependencies below. - Depends on: none ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. - Related PRs: #335 (co11ector) changes the same function for a different symptom, the CPU occlusion image's stand-in and the one-frame vanishing trees of #263; nothing of it is replaced or needed here. - Replaces or overlaps: none found
A sprite's or a decal's is the same gray with alpha 0, an HDR glow's
(BC6H) and a signed normal's or offset's (SNORM) black, a mask's and a
normal's or distortion map's gray, black for the mask with STRONG. The
gray stand-in of before is unchanged and DARNER_EFFECT_CLEAR=0 takes
every slot back to it. On a 4050 Laptop the squares at sparks, fire,
smoke and dust are gone.
Contributor

Code review only (read the diff at d4c1232), nothing built or run.

  • Cubes and volumes, confirmed by reading: stand_in_of picks by format only, so with DARNER_NEUTRAL_ALL_KINDS on (the default) a BC6H or SNORM cube or 3D slot now gets the black stand-in, where main gives it gray. A streaming HDR reflection or sky probe would read black again. DARNER_NEUTRAL_ALL_KINDS=0 does not avoid this: cubes then get a null view, which also reads 0. Only DARNER_EFFECT_CLEAR=0 gives main's result. Suggested fix: keep StandIn::Gray for every kind except Neutral::Flat.
  • Alpha-tested surfaces (likely, needs a game run): has_alpha includes BC1, BC3, BC7 and RGBA8, which are also cutout foliage, fences and hair. With alpha 0, a clip(alpha - 0.5) discards the whole surface while its texture is missing, where main's 0x80 passes. That may show as leaves or props vanishing for a frame (#135, #263). Worth an A/B at a foliage-heavy spot with DARNER_EFFECT_CLEAR=0 against the default.
  • RGBA SNORM (likely): RGBA8_SNORM and RGBA16_SNORM get (0,0,0,0). A shader that normalizes that gets NaN, which TAA or DLSS can spread. Black seems safe only for the two-channel SNORM formats (BC5, RG8, RG16).
  • 2D BC6H: not only additive glows. Lightmaps and HDR sky textures in BC6H would read black while streaming.
  • Small: the NEUTRAL_KINDS doc and the copystat line still say "gray stand-in" but now count clear and black ones too.
  • Checked and fine: the DXGI format ranges, the =0 path (same gray texture as main), is_neutral covering the new textures, and the R32_FLOAT occlusion image staying gray.
  • Overlaps: conflicts textually with #245 (neutral_of, NEUTRALS, is_neutral), whose retry would also need to cover the new STAND_INS table, and with #335 (neutral_for).

Reviewed with Claude Code (AI-assisted); findings checked by a human before posting.

Code review only (read the diff at `d4c1232`), nothing built or run. - **Cubes and volumes, confirmed by reading:** `stand_in_of` picks by format only, so with `DARNER_NEUTRAL_ALL_KINDS` on (the default) a BC6H or SNORM **cube or 3D** slot now gets the black stand-in, where `main` gives it gray. A streaming HDR reflection or sky probe would read black again. `DARNER_NEUTRAL_ALL_KINDS=0` does not avoid this: cubes then get a null view, which also reads 0. Only `DARNER_EFFECT_CLEAR=0` gives `main`'s result. Suggested fix: keep `StandIn::Gray` for every kind except `Neutral::Flat`. - **Alpha-tested surfaces (likely, needs a game run):** `has_alpha` includes BC1, BC3, BC7 and RGBA8, which are also cutout foliage, fences and hair. With alpha 0, a `clip(alpha - 0.5)` discards the whole surface while its texture is missing, where `main`'s 0x80 passes. That may show as leaves or props vanishing for a frame (#135, #263). Worth an A/B at a foliage-heavy spot with `DARNER_EFFECT_CLEAR=0` against the default. - **RGBA SNORM (likely):** RGBA8_SNORM and RGBA16_SNORM get (0,0,0,0). A shader that normalizes that gets NaN, which TAA or DLSS can spread. Black seems safe only for the two-channel SNORM formats (BC5, RG8, RG16). - **2D BC6H:** not only additive glows. Lightmaps and HDR sky textures in BC6H would read black while streaming. - Small: the `NEUTRAL_KINDS` doc and the copystat line still say "gray stand-in" but now count clear and black ones too. - Checked and fine: the DXGI format ranges, the `=0` path (same gray texture as `main`), `is_neutral` covering the new textures, and the R32_FLOAT occlusion image staying gray. - Overlaps: conflicts textually with #245 (`neutral_of`, `NEUTRALS`, `is_neutral`), whose retry would also need to cover the new `STAND_INS` table, and with #335 (`neutral_for`). Reviewed with Claude Code (AI-assisted); findings checked by a human before posting.
This pull request has changes conflicting with the target branch.
  • crates/darner-gpu/src/host/menu.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u 'effect-squares-stand-in:mrfuzzypants-effect-squares-stand-in'
git switch 'mrfuzzypants-effect-squares-stand-in'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'mrfuzzypants-effect-squares-stand-in'
git switch 'mrfuzzypants-effect-squares-stand-in'
git rebase 'main'
git switch 'main'
git merge --ff-only 'mrfuzzypants-effect-squares-stand-in'
git switch 'mrfuzzypants-effect-squares-stand-in'
git rebase 'main'
git switch 'main'
git merge --no-ff 'mrfuzzypants-effect-squares-stand-in'
git switch 'main'
git merge --squash 'mrfuzzypants-effect-squares-stand-in'
git switch 'main'
git merge --ff-only 'mrfuzzypants-effect-squares-stand-in'
git switch 'main'
git merge 'mrfuzzypants-effect-squares-stand-in'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
TrustNo1/Darner!380
No description provided.