Skip to content

docs(shader): list the samples unnormalized S#s are accepted for - #8403

Merged
adriadam10 merged 2 commits into
boykopovar:mainfrom
thuanquang:docs/debt-unnormalized-sampler-uses
Oct 24, 2026
Merged

adriadam10 merged 2 commits into
boykopovar:mainfrom
thuanquang:docs/debt-unnormalized-sampler-uses

Conversation

@thuanquang

@thuanquang thuanquang commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

What

The "Unnormalized S#s" entry in docs/dev/debt/shader.md says unnormalized S#s are accepted only for explicit-LOD image_sample without derivatives, on a single-level view of mip 0. Two changes since then make that too narrow:

  • feat(agc): sample the base level through unnormalized samplers #1418 (63ed0ffea, "sample the base level through unnormalized samplers") accepts implicit-LOD and gradient samples too: DescriptorBindingBuilder.cpp:206-208 refuses only uses outside explicit LOD, offset and non-zero LOD when SamplesBaseLevelIfUnnormalized (Resources.hpp:146-147) does not hold, and SpirvImageEmitter.cpp then emits them at LOD 0. Comparison (DescriptorBindingBuilder.cpp:210-211) and _a are still refused.
  • ShaderResources.cpp:4656-4662 also accepts a multi-level view when exactAtBase holds. DescriptorBindingBuilder.cpp:244-253 sets it for an image that only accepted unnormalized S#s sample, each with no mip filter or used only for explicit LOD 0 (image_sample_lz) without minimum LOD or bias; a normalized S# on the same image clears it. ShaderMemory.cpp:6347-6350 pins the mip-filter case. @harisibrar1 found that case in review; the first version named only image_sample_lz.

The entry now reads "used only by image_sample without comparison or _a, on a single-layer 1D or 2D view that is one level at mip 0 (even when the image is also sampled through a normalized S#), or that only unnormalized S#s sample, each without a mip filter or only by image_sample_lz without minimum LOD or bias". The rest is unchanged.

Tested

Docs only; nothing was built or run. Checked on main 56b299c3a by reading the lines above; the second commit's lines were read on main 865166414. ShaderMemory.cpp pins the same behaviour: it accepts compute _l, plain, _b, _cl and _d samples through an unnormalized S# and a pixel implicit-LOD sample (around lines 5973-6100).

  • python tools/check_conventions.py --base origin/main with this title and body passes.
  • 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

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:

  • The implicit-LOD and gradient additions are accurate: DescriptorBindingBuilder.cpp:206-209 refuses only uses outside explicit/implicit/gradient/non-zero-LOD/offset, and depth compare is still refused at lines 210-212.
  • The multi-level clause is incomplete. DescriptorBindingBuilder.cpp:251 marks an image exact at its base level when every S# sampling it has mip filter 0 (((words[2] >> 26) & 3) == 0, for any accepted use), or is used only for explicit LOD with no min LOD and no bias. tests/ShaderMemory.cpp:6313-6314 pin the first branch: implicit-LOD and selected-LOD reads through an S# without a mip filter are flagged exact, and a point mip filter is not (:6316). So a multi-level view is also accepted through an S# without a mip filter, not only when read by image_sample_lz.
  • Suggested wording: "on a single-layer 1D or 2D view that is one level at mip 0, is sampled only through S#s without a mip filter, or is read only by image_sample_lz through an S# without minimum LOD or bias". The error text at ShaderResources.cpp:4661 has the same lz-only wording.
  • check_conventions.py --base main --head pr-8403: passes.

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

…el view at its base

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

Copy link
Copy Markdown
Contributor Author

@harisibrar1 thanks, you're right: DescriptorBindingBuilder.cpp:251 also takes an S# without a mip filter, for any accepted use. I pushed b8596dca9 with that case. One change from your wording: a normalized S# on the same image clears exactAtBase (the loop at :246-252 needs every pairing S# to be an accepted unnormalized one), so the new text says "that only unnormalized S#s sample" and keeps "even when the image is also sampled through a normalized S#" for the one-level case only. I left the error text at ShaderResources.cpp:4662 alone, since this PR changes docs only.

@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.

Rechecked b8596dc against main:

  • The new text matches DescriptorBindingBuilder.cpp:251: a multi-level view is taken when every S# sampling it has no mip filter, or uses it only for image_sample_lz without minimum LOD or bias.
  • Your correction to my wording is right: exact also requires proof.samplers[pair.sampler] (line 251), which is set only for accepted unnormalized S#s (line 243), so a normalized S# on the same image clears it. "that only unnormalized S#s sample" and keeping the normalized-S# clause for the one-level case only is accurate.
  • tools/check_conventions.py --base main passes on this head.

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

@adriadam10 adriadam10 self-assigned this Oct 24, 2026
@adriadam10
adriadam10 merged commit 51e17a7 into boykopovar:main Oct 24, 2026
10 of 11 checks passed
@adriadam10

Copy link
Copy Markdown
Collaborator

Checked the new text against DescriptorBindingBuilder.cpp (accepted uses at :206-211, comparison still refused; imagesAtBaseLevel at :244-253 requiring only accepted unnormalized S#s with no mip filter or explicit LOD 0 without min LOD/bias); it matches. Docs only; 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