shader: lower image_sample_b with a buffered bias #1373
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1380"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T09:57:56Z.
Change
Adds
image_sample_b(2D, single channel, explicit bias) totools/sampled_coverage_aot.py. It lowers totex{N}.SampleBias(samp,uv,{bias}).{channel}. The pixel shader this translator emits is a PS, whereSampleBiasis available. The bias must be a buffered float copied withv_mov_b32_e32 vN, sMinto the first address register, like the level ofimage_sample_l. Refs the sampled-coverage translator work (#1350, merged).Register order: the address list is
v[bias:u](bias, s, t), notv[u:bias]. The assembler cannot show this, because both orders print the same range. It was checked against LLVM's own lowering of thellvm.amdgcn.image.sample.b.2dintrinsic withllc-19 -mcpu=gfx1013. With the arguments passed in a different order, the bias argument lands in the first register of the address list. Only the bias-first order is accepted; a bias as the third register is refused.Refused, as for
image_sample_l: tfe, lwe, a16, d16, r128, unorm, glc, slc, dlc, multi-channel dmask, 3D, array,_ooffsets,image_sample_b_cl,image_sample_c_b, a bias that is undefined, defined in another register, defined before the scalar load is waited for, a VOP3 move, an inline constant, a literal, a vector or special register source, or a non-float scalar.AI-assisted. Two files of tooling plus docs:
tools/sampled_coverage_aot.py,tests/sampled_coverage_check.py,docs/experiments.md. The disassembler already decodesimage_sample_b, so it is untouched.Verification
python3 -B tests/sampled_coverage_check.py binary llvm-mc-19 llvm-objcopy-19 /usr/lib/llvm-19/lib/libLLVM.so.19.1: exit 0 on this branch.Unsupported coverage instruction image_sample_b).SampleBiasreplaced bySampleLevel, coordinates read from the first two registers.tests/rdna2_tools_check.py(139 tests OK),tests/docs_links_check.py,tests/bidi_controls_check.py: pass.prpreset:sampled_coverage_warp(needsoffscreen_check).Evidence and follow-up
SampleBiasargument is evaluated against distinct constants by a separate reader for each of four buffered words, and the biased program is told apart from the same registers read as implicit, zero-level and explicit-level samples.Checklist
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T10:01:11Z.
Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit
6963edab65a32b5ddd0f346c9de9f0d14386459b:--preset dev):offscreen_checkbuild3.24s;ctest --preset dev -R '^sampled_coverage_warp$' --no-tests=error --output-on-failure: 1/1 passed (11.55s)/O2(--preset release):offscreen_checkbuild0.77s;ctest --preset release -R '^sampled_coverage_warp$' --no-tests=error --output-on-failure: 1/1 passed (11.11s)Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T10:01:20Z.
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
6963edaℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.