WIP: [pr-fix][rendering][shaders][INTEL] Fix the Arc shadow checkerboard; draw mesh objects on Intel cards #39

Draft
kisekinopureya wants to merge 10 commits from kisekinopureya/Darner:kisekinopureya/pr/arc-checkerboard into main
Contributor

Contributor role (optional)

  • Fluxer ID: 1576376229534109696

What it changes

The checkerboard. The interior checkerboard on Intel Arc (A770, and reported on a B580) came from
CS_GenerateShadowMasks_Checkerboard_NoHair. One lane hands each 4x8 group's atlas slot to the others
through LDS with no s_barrier, as one console wave may. In D3D12 that is a race, and Intel's compiler
reorders it, so lanes wrote their mask pixels into other tiles' slots. A shared-memory fence (barrier
mode 8, no wait) now goes before each LDS access of a compute program whose console wave is not split.
It is on by default on Intel; DARNER_LDS_WAVE_FENCE sets it, and it is in the shader cache key.

Mesh objects. A mesh pipeline's pixel program that needs the barycentric fallback gets approximate
barycentrics, since no geometry stage can follow a mesh stage. Such pipelines are no longer refused,
and this works with Darner's link fallback.

How it was tested

  • Tested revision: be1dacf557 (rebased onto 1a5286a7; the gates re-run there)
  • Commands and results: both clippy gates clean; the shader cache key, menu and panel tests pass;
    emit::lower::tests pass.
  • Gameplay: base branch on an Arc A770, Series S, 1920x1080, prison cell. The user saw no shadow
    checkerboard and the mesh objects drawn. The log showed the LDS fence on.
  • Coverage gaps: B580 not tested.

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 #32 (the barycentric fallback), which depends on #31

Checked for overlap

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

🤖 Generated with Claude Code

## Contributor role (optional) - Fluxer ID: 1576376229534109696 ## What it changes **The checkerboard.** The interior checkerboard on Intel Arc (A770, and reported on a B580) came from `CS_GenerateShadowMasks_Checkerboard_NoHair`. One lane hands each 4x8 group's atlas slot to the others through LDS with no s_barrier, as one console wave may. In D3D12 that is a race, and Intel's compiler reorders it, so lanes wrote their mask pixels into other tiles' slots. A shared-memory fence (barrier mode 8, no wait) now goes before each LDS access of a compute program whose console wave is not split. It is on by default on Intel; `DARNER_LDS_WAVE_FENCE` sets it, and it is in the shader cache key. **Mesh objects.** A mesh pipeline's pixel program that needs the barycentric fallback gets approximate barycentrics, since no geometry stage can follow a mesh stage. Such pipelines are no longer refused, and this works with Darner's link fallback. ## How it was tested - Tested revision: be1dacf557 (rebased onto `1a5286a7`; the gates re-run there) - Commands and results: both clippy gates clean; the shader cache key, menu and panel tests pass; `emit::lower::tests` pass. - Gameplay: base branch on an Arc A770, Series S, 1920x1080, prison cell. The user saw no shadow checkerboard and the mesh objects drawn. The log showed the LDS fence on. - Coverage gaps: B580 not tested. ## 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 #32 (the barycentric fallback), which depends on #31 ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. - Related PRs: #10 (also changes `crates/darner-shader/src/emit/lower.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)
The interior checkerboard on Intel Arc (A770, and reported on a B580)
came from CS_GenerateShadowMasks_Checkerboard_NoHair: one lane hands
each 4x8 group's atlas slot to the others through LDS with no
s_barrier, as one console wave may. In D3D12 that is a race, and
Intel's compiler reorders it, so lanes wrote their mask pixels into
other tiles' slots and whole 8x8 tiles were lit or dark at random. A
shared-memory fence (barrier mode 8, no wait) now goes before each LDS
access of a compute program whose console wave is not split: on by
default on Intel, DARNER_LDS_WAVE_FENCE=0/1 off/on on any card, and in
the shader cache's key. In replay the frame becomes repeatable (69.9 dB
between runs, against 25.6) and the checkerboard is gone, in gameplay
too, with no frame-time cost measured.

Barycentrics on Intel:
- the geometry-stage fallback is used by default on an Intel card even
  where it reports native barycentrics (DARNER_BARYCENTRICS=native
  opts out);
- a mesh pipeline whose pixel program needs that fallback (a geometry
  stage cannot follow a mesh stage) gets a second translation of the
  pixel program with approximate barycentrics, cached apart, instead
  of being refused: 327 refusals to 0, and the prison's windows,
  posters and table objects are drawn;
- a pixel program whose exact fallback exceeds the host's pixel input
  registers is translated with approximate barycentrics instead of
  failing (44 failures to 0).
Vertex pipelines that fit keep the exact fallback.

an_unsplit_wave_fences_its_lds_accesses covers the fence.

Darner: a mesh pair that does not link is still made as translated (#4672); the approximate pixel program is the one linked, when the mesh needs it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit 77b349ea28e616a1a1748da84c284d32921ce02c)
Docs that stay in VIctory-NVIDIA (the Arc tracker, the XeSS notes) are
named as its; the product is Darner.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit 679dac648a1999f8492b25519e158fd62be78160)
kisekinopureya force-pushed kisekinopureya/pr/arc-checkerboard from 41e5d35f1e to be1dacf557 2026-12-03 21:13:12 +00:00 Compare
This pull request is marked as a work in progress.
This branch is out-of-date with the base branch
View command line instructions

Checkout

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

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/arc-checkerboard'
git switch 'kisekinopureya-kisekinopureya/pr/arc-checkerboard'
git rebase 'main'
git switch 'main'
git merge --ff-only 'kisekinopureya-kisekinopureya/pr/arc-checkerboard'
git switch 'kisekinopureya-kisekinopureya/pr/arc-checkerboard'
git rebase 'main'
git switch 'main'
git merge --no-ff 'kisekinopureya-kisekinopureya/pr/arc-checkerboard'
git switch 'main'
git merge --squash 'kisekinopureya-kisekinopureya/pr/arc-checkerboard'
git switch 'main'
git merge --ff-only 'kisekinopureya-kisekinopureya/pr/arc-checkerboard'
git switch 'main'
git merge 'kisekinopureya-kisekinopureya/pr/arc-checkerboard'
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!39
No description provided.