WIP: [pr-feature][rendering][shaders][INTEL] Read barycentrics from a geometry stage on hosts without them #32

Draft
kisekinopureya wants to merge 8 commits from kisekinopureya:kisekinopureya/pr/barycentrics into main
Contributor

Contributor role (optional)

  • Fluxer ID: 1576376229534109696

What it changes

An Intel Arc A-series card reports no native barycentrics, so every pixel program that reads
SV_Barycentrics or GetAttributeAtVertex was refused at pipeline creation. Such programs are now
translated to read the basis and each vertex's value from private inputs, and the vertex-to-pixel
pipeline gets a geometry stage that supplies them (emit/barycentric.rs, ported from the AMD tree).
The device's caps decide. DARNER_BARYCENTRICS=emulate forces the stage on any card. The setting is
in the translation fingerprint and the host settings.

Also:

  • DARNER_BARYCENTRICS=approximate (diagnostics builds): a third each, so no geometry stage; for
    finding what refused pipelines change on screen;
  • a computed-weight pair now adds up to the value once;
  • the shader cache key test's lists name DARNER_INTERNAL (a semantic name) and DARNER_DXC (a
    tool's path).

Known gaps: a vertex-pixel pair whose geometry stage would need more than 32 output elements gets
none (23 pipelines in the title). A pixel program whose read inputs keep different interpolation modes in one register is
refused ("barycentric emulation has conflicting interpolation modes"); two such shaders in the title,
whose draws are dropped.

How it was tested

  • Tested revision: 9fcbab1154 (rebased onto 1a5286a7; the gates re-run there)
  • Commands and results: both clippy gates clean; the shader cache key, menu and panel tests pass;
    darner-shader's barycentric tests pass.
  • Gameplay: base branch on an Arc A770, Series S, 1920x1080. The log said "pixel programs read
    barycentrics from a geometry stage". 23 pipelines still got no geometry stage ("barycentric
    fallback exceeds geometry output elements", the 32-element limit) and were not made; their draws
    are dropped. The user saw mesh objects drawn.
  • Coverage gaps: not on Battlemage or a card with native barycentrics.

Checklist

  • This PR contains one change based on main.
  • The diff follows docs/asset-policy.md.
  • I recorded this PR's dependencies below.
    • Depends on #31 (the Intel host setting in the fingerprint)

Note: this branch and the paired-lanes PR (#43) edit the same place in emit/lower.rs
(run(), after the phis are filled); whichever merges second needs a rebase there.

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches.
  • Related PRs: #5 (also changes crates/darner-hle/src/modules/gameinput.rs); #6 (also changes crates/darner-hle/src/modules/gameinput.rs); #10 (also changes crates/darner-shader/src/emit/lower.rs); #24 (also changes crates/darner-hle/src/modules/gameinput.rs); #25 (also changes crates/darner-gpu/src/host.rs).

🤖 Generated with Claude Code

## Contributor role (optional) - Fluxer ID: 1576376229534109696 ## What it changes An Intel Arc A-series card reports no native barycentrics, so every pixel program that reads SV_Barycentrics or GetAttributeAtVertex was refused at pipeline creation. Such programs are now translated to read the basis and each vertex's value from private inputs, and the vertex-to-pixel pipeline gets a geometry stage that supplies them (`emit/barycentric.rs`, ported from the AMD tree). The device's caps decide. `DARNER_BARYCENTRICS=emulate` forces the stage on any card. The setting is in the translation fingerprint and the host settings. Also: - `DARNER_BARYCENTRICS=approximate` (diagnostics builds): a third each, so no geometry stage; for finding what refused pipelines change on screen; - a computed-weight pair now adds up to the value once; - the shader cache key test's lists name `DARNER_INTERNAL` (a semantic name) and `DARNER_DXC` (a tool's path). Known gaps: a vertex-pixel pair whose geometry stage would need more than 32 output elements gets none (23 pipelines in the title). A pixel program whose read inputs keep different interpolation modes in one register is refused ("barycentric emulation has conflicting interpolation modes"); two such shaders in the title, whose draws are dropped. ## How it was tested - Tested revision: 9fcbab1154 (rebased onto `1a5286a7`; the gates re-run there) - Commands and results: both clippy gates clean; the shader cache key, menu and panel tests pass; `darner-shader`'s barycentric tests pass. - Gameplay: base branch on an Arc A770, Series S, 1920x1080. The log said "pixel programs read barycentrics from a geometry stage". 23 pipelines still got no geometry stage ("barycentric fallback exceeds geometry output elements", the 32-element limit) and were not made; their draws are dropped. The user saw mesh objects drawn. - Coverage gaps: not on Battlemage or a card with native barycentrics. ## Checklist - [ ] 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 #31 (the Intel host setting in the fingerprint) Note: this branch and the paired-lanes PR (#43) edit the same place in `emit/lower.rs` (`run()`, after the phis are filled); whichever merges second needs a rebase there. ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. - Related PRs: #5 (also changes `crates/darner-hle/src/modules/gameinput.rs`); #6 (also changes `crates/darner-hle/src/modules/gameinput.rs`); #10 (also changes `crates/darner-shader/src/emit/lower.rs`); #24 (also changes `crates/darner-hle/src/modules/gameinput.rs`); #25 (also changes `crates/darner-gpu/src/host.rs`). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
The vendor is part of the host settings and the translation fingerprint
(lower::host_intel, set when the device is made), for the Intel-only forms
that follow.

In VIctory-NVIDIA this came with leaving the particle light atlas
unfolded on Intel cards (the folded CS_lightAtlas programs hung an Arc
A770's device in the prison cell in three runs of three). Darner already
leaves it unfolded on every card (UNFOLDED_BY_DEFAULT), so only the vendor
detection is ported.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit 18e8c457d1c80244e9da74b094dc70311e397428)
An Intel Arc A-series card reports no native barycentrics, so every pixel
program that reads SV_Barycentrics or GetAttributeAtVertex was refused at
pipeline creation. Such programs are now translated to read the basis and
each vertex's value from private inputs, and the vertex-to-pixel pipeline
gets a geometry stage that supplies them (ported from the AMD tree). The
device's caps decide; DARNER_BARYCENTRICS=emulate forces the stage on any
card. The setting is part of the translation fingerprint and host settings.

Also: SFI0/PSV0 readers, LShift/RShift/Space for DARNER_KEYS, and the FP64
test skipped on hosts without double-precision shader operations.

Darner: the fixture's geometry-stage HostShader gets ray_queries (a field added on Darner).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit 8000ddfd8d8641a4f3fe115eaa3c1f8992f705c1)
DARNER_BARYCENTRICS=approximate (diagnostics builds, on a host without
native barycentrics): barycentrics are a third each and values at
computed weights are the input interpolated as usual, so no geometry
stage is needed and mesh pipelines are not refused for them. Wrong in
detail; for finding what the refused pipelines change on screen.

pixel_wave_lanes_on_the_card (ignored; needs dxc and a card) reports the
host's pixel wave width: 8 lanes on an Arc A770.

docs/arc-a770.md records the checkerboard causes ruled out since.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit f6e75b4e6c463611d20baf1b51f0d9583ceaa262)
With barycentrics of a third each, the one consistent model is three
vertices holding the interpolated value: P0 is that value, P10 and P20
are 0. eval_channel returned the value for every weighted read, so the
second half of a computed-weight pair (old + j P20) gave twice it, and
P10/P20 reads gave it instead of 0. A GPU test draws 4 (8 before).

`replay --retranslate` now honours DARNER_BARYCENTRICS (emulate,
approximate) as the host does; without a device it always translated
with native barycentrics.

Not the cause of the Arc's coloured triangles: mesh pixel program
573d1857e903fab5 interpolates plainly, which the approximate path
already gets exactly; docs/arc-a770.md corrects the earlier note.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit 27246ca9525dc74eb7625fb4618df5047b0cea3f)
computed_weight_pixel_without_barycentrics came with the geometry-stage
fallback and was never used (a dead-code warning, an error with the
gates' -D warnings).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit 021cc0b0538421c979987089d0461c77ee96982a)
A range for the basis modes and ok_or for a constant error: the
workspace's clippy gate (-D warnings) refused the two.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit 6307286ee744a28145bc47f2a9b197fff2c326ff)
The geometry-stage barycentrics name their hidden inputs DARNER_INTERNAL;
the translator's switch list picks the name up.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit 07d060d40a5c3e5225dab9a8bbda1f5532b164e6)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit 6279be59e941d7f8cf7b8b722680f180db5f397a)
This pull request is broken due to missing fork information.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u 'kisekinopureya/pr/barycentrics:kisekinopureya-kisekinopureya/pr/barycentrics'
git switch 'kisekinopureya-kisekinopureya/pr/barycentrics'

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 'kisekinopureya-kisekinopureya/pr/barycentrics'
git switch 'kisekinopureya-kisekinopureya/pr/barycentrics'
git rebase 'main'
git switch 'main'
git merge --ff-only 'kisekinopureya-kisekinopureya/pr/barycentrics'
git switch 'kisekinopureya-kisekinopureya/pr/barycentrics'
git rebase 'main'
git switch 'main'
git merge --no-ff 'kisekinopureya-kisekinopureya/pr/barycentrics'
git switch 'main'
git merge --squash 'kisekinopureya-kisekinopureya/pr/barycentrics'
git switch 'main'
git merge --ff-only 'kisekinopureya-kisekinopureya/pr/barycentrics'
git switch 'main'
git merge 'kisekinopureya-kisekinopureya/pr/barycentrics'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
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!32
No description provided.