Skip to content

xshader: accept the sampler heap base in rooted pixel shaders - #157

Merged
brcly merged 1 commit into
brcly:mainfrom
NathansDomainSolutions:fix/rooted-pixel-sampler-heap
Nov 25, 2026
Merged

brcly merged 1 commit into
brcly:mainfrom
NathansDomainSolutions:fix/rooted-pixel-sampler-heap

Conversation

@NathansDomainSolutions

Copy link
Copy Markdown
Contributor

Summary

A pixel shader that indexes the descriptor heaps receives the sampler heap base in the user SGPR named by FSSM user-data class 6 (the resource heap is class 5). pixel_heap_base refused class 6 whenever a root signature was present. Fixed-offset reads from the sampler heap (e.g. s16 + 0x430) then fell through to the root-table lookup, stayed unmapped, and the rooted translation was refused with unmapped descriptor at sN + 0x_ in a heap-indexing pixel shader.

In ProjectScarlett this mostly hits pixel stages of mesh pipelines. When the rooted translation is refused, slot 86 falls back to the root-less pixel translation, whose private space1 bindings (e.g. b21 space1) the mesh pipeline's root doesn't provide. vkd3d-proton rejects the pipeline with vkd3d result -3, and the draw is lost.

This PR accepts class 6 when the root sets SAMPLER_HEAP_DIRECTLY_INDEXED (0x800), as class 5 already requires CBV_SRV_UAV_HEAP_DIRECTLY_INDEXED (0x400). An example root that triggers it: flags 0xc00, FSSM user records [5, 0, 1, 0, 0xf] (resource heap in s15) and [6, 0, 1, 0, 0x10] (sampler heap in s16).

Checks

  • Over 5,942 recorded rooted pixel requests (pixel stages carrying the pipeline RTS0): 2,786 newly translated, 0 regressions, 13 existing outputs changed. Before this change, 2,363 of the remaining refusals in that set were this message.
  • DXC: a sample of 55 new outputs all compile (-O0 above 128 KiB).
  • cargo test for tools/shader-compiler (x86_64-unknown-linux-gnu): all pass.
  • Not yet run in game on its own: an in-game run with this on top of current main is in progress. In run 35 (main + xshader, d3d12: link mesh programs to their pixel consumer #150), mesh slot 86 pipelines failing with -3 numbered about 10,400. The pixel shaders I sampled from those failures were root-less fallbacks of exactly this kind.

AI-assisted: written with Claude Code and reviewed by me.

🤖 Generated with Claude Code

A pixel shader that indexes the descriptor heaps gets the sampler heap base
in the user SGPR of FSSM class 6. pixel_heap_base refused class 6 whenever a
root signature was present, so fixed-offset reads from that heap were left
as unmapped table descriptors and the rooted translation was refused. The
runtime then fell back to the root-less translation, whose private bindings
the mesh pipeline root does not provide.

Accept class 6 when the root sets SAMPLER_HEAP_DIRECTLY_INDEXED (0x800), as
class 5 already requires 0x400.

Over 5,942 recorded rooted pixel requests: 2,786 newly translated, 0
regressions, 13 outputs changed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@brcly
brcly merged commit aad0ecd into brcly:main Nov 25, 2026
2 checks passed
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.

2 participants