Skip to content

allightmapblur_gl_test compares the dispatch with the fragment passes in single precision, past AMD's 8-bit export rounding - #554

Merged
RyeMutt merged 1 commit into
developfrom
zanibar/amdfix-allightmapblur_gl_test
Oct 23, 2026
Merged

RyeMutt merged 1 commit into
developfrom
zanibar/amdfix-allightmapblur_gl_test

Conversation

@taylnos

@taylnos taylnos commented Oct 23, 2026

Copy link
Copy Markdown
Collaborator

Problem

allightmapblur_gl_test's "texel for texel through a single-precision scratch" case fails on an AMD RX 6800 (Windows, driver 26.8.1). It fails at every blur size and both depth conventions: about 4,200 of 94,357 pixels (4.4%) have the dispatch's occlusion exactly one 8-bit step above the fragment passes'.

Cause

The driver doesn't round a fragment shader's colour straight to an RGBA8 target. It first hands it over at half precision, rounded toward zero, which drops a value just above a rounding midpoint below it. The dispatch's rg8 store rounds the single-precision value to the nearest 8 bits.

I checked both with a temporary diagnostic:

  • The light map held exactly unorm8(fp16_rtz(f)) of the passes' single-precision value at all 84,337 drawn texels.
  • The dispatch held the nearest 8 bits to the same values at all but one texel. That texel was a tie at 165.50002 steps, where GL lets either neighbour be the result.

The two blurs agree; only the targets' rounding of them differed. The viewer is unaffected beyond that rounding.

Change

  • Float copy: in the exact case, blurFragment's second pass draws into a new single-precision copy of the light map, mFloatLight. It is seeded with the light map's texels so the sky keeps them.
  • Comparison: the test checks that the dispatch's store holds the 8 bits nearest the fragment passes' value, allowing either neighbour within 1e-4 of a step of a tie.

The comparison stays as sensitive to a difference in the blur's arithmetic as before: one shows wherever it moves the rounding. The other cases and alcompute_gl_bench keep the 8-bit targets.

Testing

On the RX 6800:

  • allightmapblur_gl_test passes, three runs in random order.
  • All 9 alrender_gl_tests pass.
  • Not run: NVIDIA, and Mesa (CI will run llvmpipe).

🤖 Generated with Claude Code

…nt passes' single precision, which AMD's 8-bit targets do not round as the store does

On the RX 6800 (driver 26.8.1) the texel for texel case failed at every blur
size and convention: about 4,200 of 94,357 pixels, 4.4%, where the dispatch's
occlusion was exactly one 8-bit step above the fragment passes'. The driver
hands a fragment shader's colour to an RGBA8 target at half precision, rounded
toward zero, before rounding it to 8 bits: the light map held exactly that of
the passes' single precision at all 84,337 drawn texels. The dispatch's rg8
store rounds the single precision itself to the nearest 8 bits. The two blurs
agree; only the targets' rounding of them differed.

The exact case's second pass now draws into a single-precision copy of the
light map, seeded with its texels so the sky keeps them, and the dispatch's
store must hold the 8 bits nearest it, or at a tie either of the two. One texel
lay at 165.50002 steps, which the store rounded down.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added the c/cpp label Oct 23, 2026
@coderabbitai

coderabbitai Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 8bb693b2-335c-4d04-b20d-5a0b756d354b
📥 Commits

Reviewing files that changed from the base of the PR and between 5c867a3 and 996d100.

📒 Files selected for processing: 2
  • indra/alrender/tests/allightmapblur_gl_scene.h
  • indra/alrender/tests/allightmapblur_gl_test.cpp

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

📝 Summary

Summary by CodeRabbit

  • Tests
    • Updated light-map blur comparisons to account for small per-channel precision differences while continuing to detect mismatched pixels.

The fragment blur path now uses a float light-map target in float mode. The comparison test reads that target and checks dispatch output against it with a per-channel tolerance.

Changes: Float Light-Map Fragment Comparison

Layer / File(s) Summary
Float light-map target allocation
indra/alrender/tests/allightmapblur_gl_scene.h
Scene allocates an RGBA32F target for mFloatLight and releases it with the other render targets.
Float fragment output and comparison
indra/alrender/tests/allightmapblur_gl_scene.h, indra/alrender/tests/allightmapblur_gl_test.cpp
In float mode, blurFragment copies the current light-map contents into mFloatLight and directs the second fragment pass to the selected target. The test compares dispatch output with mFloatLight using a per-channel tolerance and still requires zero mismatching pixels.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Possibly related PRs

  • AlchemyViewer/Alchemy#545: Adds the single-precision fragment path and the compute-versus-fragment comparison that this change updates.

Suggested labels: c/cpp, llrender

Suggested reviewers: ryemutt

Merge Risk: ⚪ Minimal · up to 996d1

The changed float comparison path is internally consistent and presents no established merge-blocking risk.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly identifies the test and the main change: comparing single-precision fragment passes with the dispatch while accounting for AMD 8-bit export rounding. It is somewhat long but remains …
Description check Passed The description gives clear problem, cause, change, and testing details. It is mostly complete and directly supports the pull request objectives, although it does not include the template's Related Is…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title clearly identifies the test and the main change: comparing single-precision fragment passes with the dispatch while accounting for AMD 8-bit export rounding. It is somewhat long but remains specific and relevant.

Full details: Description check

Explanation

The description gives clear problem, cause, change, and testing details. It is mostly complete and directly supports the pull request objectives, although it does not include the template's Related Issues section, completed checklist, or Additional Notes section.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

A rabbit checks the light-map glow
Float targets catch the colors’ flow
The fragment pass writes true
The test checks each channel, too
Then hops away through pixels bright

Comment @coderabbitai help to get the list of available commands.

@RyeMutt
RyeMutt merged commit 2ef26ff into develop Oct 23, 2026
39 of 40 checks passed
@RyeMutt
RyeMutt deleted the zanibar/amdfix-allightmapblur_gl_test branch October 23, 2026 11:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants