Skip to content

fix: on ES, pow of a negative base is NaN through strobe_pow, because Direct3D folds exp2(log2) back (D700) - #155

Open
lnorton89 wants to merge 1 commit into
masterfrom
fix/d301-angle-pow
Open

lnorton89 wants to merge 1 commit into
masterfrom
fix/d301-angle-pow

Conversation

@lnorton89

Copy link
Copy Markdown
Owner

D301 spelled pow(x, y) as exp2(log2(x) * (y)) on ES, so a negative base would give NaN under ANGLE as on the native drivers. Measured on LIGHTNING's RX 580 (AMD.md Task A15, R24), it had no effect. Direct3D folds the rewrite back and takes log2(|x|), so sprinkles and PLUS still rendered almost black on ANGLE.

The ES rewrite now emits strobe_pow(x, y). The ES preamble defines it for float and vec2 to vec4, as a NaN built from its bits where the base is negative, and exp2(log2(x) * y) elsewhere. I tried two spellings in a probe scene on native and ANGLE first; only this one matched on both.

Result (RX 580, 640x360, mean RGB):

Scene Native ANGLE before ANGLE now
sprinkles (600 frames) 48.2, 13.7, 32.7 4.3, 1.2, 2.4 48.2, 13.7, 32.7
PLUS (60 frames) 66.4 2.6 26.4

PLUS now draws native's grid. What's left is how each driver carries the NaN afterwards: native's NaN regions end white, Direct3D's black. D700 records why that isn't chased.

Tests: the strobe-scene unit and property tests are updated for the new spelling (226 + 4 pass). Clippy and fmt are clean, and the conventions tests pass. CI's Linux render lane compiles every scene in both dialects.

Not measured: Intel, and ANGLE's Vulkan backend.

@github-actions

github-actions Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @lnorton89's task in 28s —— View job


Review of PR #155

The code change looks correct to me. strobe_pow is only emitted in the ES dialect. The vector overloads use mix with a bvec selector, which GLSL ES 3.00 allows. Nested calls, macro bodies and line mapping are preserved. The tests were updated for the new spelling. I did not build or run anything, so this is from reading the diff.

Findings:

  • Docs are stale. docs/ROADMAP.md (lines 162-170) still says D301 doesn't fix the bug and that the redo is parked. That redo is this PR, so the entry needs rewriting. Q28 in OPEN_QUESTIONS.md and STATUS_AUDIT.md (~882) still describe the old spelling.
  • Nit: a comment in crates/strobe-gfx/tests/render.rs:619 still describes the old rewrite.

I found no problems with unsafe, panics, wildcard arms, per-frame paths or CHANGELOG.md. I did not check the D700 number. It is higher than the existing D680, and I didn't confirm it is the intended next number.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant