Skip to content

docs(shader): say that the whole packed ancillary word carries the layer field too - #8425

Merged
adriadam10 merged 3 commits into
boykopovar:mainfrom
thuanquang:docs/debt-packed-ancillary-whole-word
Oct 24, 2026
Merged

adriadam10 merged 3 commits into
boykopovar:mainfrom
thuanquang:docs/debt-packed-ancillary-whole-word

Conversation

@thuanquang

@thuanquang thuanquang commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

What

The Packed pixel ancillary word entry in docs/dev/debt/shader.md says a read that gets the whole word gets the primitive class "plus the sample field, with every other bit zero". Since #5097 (7015c0443) the rebuilt word also carries the render target index: ComposePackedAncillary in ConstantFolder.cpp (lines 1391-1396 on main) replaces it with primitive | (sample << 8) | ((Layer * LayerExported) << 16), so on a layered draw bits 16-28 hold the Layer. The clause now reads "plus the two fields", the name the entry already uses for the sample and render target index fields.

The entry's last sentences say "The whole word has the same 0 at bits 16-28. A change that makes draws export a layer must restore the Layer read in both places". That change has happened: the field path (ConstantFolder.cpp:839) and the whole word both read Layer * LayerExported, and draws set LayerExported when they export a layer. The sentence now reads "The whole word has the same render target index at bits 16-28".

With that, the entry's "In the whole word only bits 0-1 and 8-11 have a source" also has to count the render target index, so it now reads "In the whole word only bits 0-1, 8-11 and 16-28 have a source"; the bits it calls assumed zero (2-7, 12-15 and 29-31) are unchanged.

Tested

Docs only; nothing was built or run. Checked on main 11d6efa06c by reading core/shader/recompiler/Optimization/src/ConstantFolder.cpp:1380-1398 (ComposePackedAncillary) and :839 (the field path).

  • python tools/check_conventions.py --base origin/main with this title and body: 0 errors and one debt-length warning, because the entry was already over 1000 characters (3053 before, 2991 after this change).
  • Not tested: behaviour on any machine; this changes text only.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes (Claude Code)

🤖 Generated with Claude Code

thuanquang and others added 2 commits October 20, 2026 19:30
…yer field too

Co-Authored-By: Claude <noreply@anthropic.com>
… index at bits 16-28

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 5021 docs/dev/debt/shader.md
PR 5371 docs/dev/debt/shader.md
PR 6235 docs/dev/debt/shader.md
PR 6280 docs/dev/debt/shader.md
PR 6412 docs/dev/debt/shader.md
PR 6488 docs/dev/debt/shader.md
PR 6924 docs/dev/debt/shader.md
PR 7223 docs/dev/debt/shader.md
PR 7395 docs/dev/debt/shader.md
PR 7410 docs/dev/debt/shader.md
PR 7484 docs/dev/debt/shader.md
PR 7684 docs/dev/debt/shader.md
PR 7942 docs/dev/debt/shader.md
PR 8004 docs/dev/debt/shader.md
PR 8077 docs/dev/debt/shader.md
PR 8639 docs/dev/debt/shader.md
PR 8939 docs/dev/debt/shader.md
PR 9193 docs/dev/debt/shader.md
PR 9457 docs/dev/debt/shader.md
PR 9633 docs/dev/debt/shader.md
PR 9748 docs/dev/debt/shader.md
PR 9749 docs/dev/debt/shader.md
PR 9790 docs/dev/debt/shader.md
PR 9889 docs/dev/debt/shader.md
PR 9969 docs/dev/debt/shader.md

@github-actions github-actions Bot added the docs label Oct 20, 2026

@harisibrar1 harisibrar1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked against main:

  • ConstantFolder.cpp:1388-1393 (ComposePackedAncillary) builds the whole word as primitive | (sample << 8) | ((Layer * LayerExported) << 16). "Plus the two fields" is accurate, and the layer is 0 when LayerExported is 0.
  • The field extract path uses the same Layer * LayerExported product (ConstantFolder.cpp:835), so "the whole word has the same render target index at bits 16-28" is accurate, and the old "restore the Layer read in both places" caveat no longer applies.
  • check_conventions.py --base main: 0 errors. The one debt-length warning is for an entry that was already over 1000 characters, and this change makes it shorter.

Reviewed with AI assistance (Claude Code); the checks above were run locally on my machine.

…e a source

Co-Authored-By: Claude <noreply@anthropic.com>
@adriadam10 adriadam10 self-assigned this Oct 24, 2026
@adriadam10
adriadam10 merged commit feffbca into boykopovar:main Oct 24, 2026
10 of 11 checks passed
@adriadam10

Copy link
Copy Markdown
Collaborator

Checked the three edited clauses against ComposePackedAncillary (ConstantFolder.cpp:1391-1396, primitive | (sample << 8) | ((Layer * LayerExported) << 16)) and the field path (:839, same Layer * LayerExported): "the two fields", "bits 0-1, 8-11 and 16-28" and "same render target index at bits 16-28" are accurate; the assumed-zero bits are unchanged. Docs only, Conventions green; merged.

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.

3 participants