shader: lower explicit mip texture loads at startup #1277
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1284"
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 Evan-Lowry on 2026-11-24T06:44:20Z.
The startup gfx1013 graphics translator rejects
image_load_mip. Lower the 2D and 3D forms to HLSLTexture.Loadusing the final address register for the mip level. Preserve mip zero for ordinaryimage_load. Packed data, packed addresses, and fault-status forms remain unsupported.Refs #1149. This is the startup graphics path, separate from the compute translator in #1265.
Validation
python -B tests/startup_image_load_mip_check.py --llvm-mc <llvm-mc>matched the synthetic gfx1013 instruction bytes.python -B tests/startup_image_load_mip_check.py --draw <dxc> <offscreen_check> hardwareand the equivalentwarprun both matched all 64 pixels and 256 channels for mips 2 and 0 with zero error. The deliberate wrong-mip comparison failed at (0, 0).AI-assisted with Codex.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T06:55:11Z.
Review: COMMENTED
Reviewed at
c7afbf0ece7b1a82139ec4918f32aca7fac63560.Verification
Linux (worktree from
origin/main):git diff --check origin/main...HEAD— cleanpython -B tests/docs_links_check.py— passed (16 Markdown files, 284 links)python -B tests/bidi_controls_check.py— passed (1063 tracked files)python -B tests/startup_image_load_mip_check.py --llvm-mc /usr/bin/llvm-mc-19— passed (2D packed,3D NSA,2D implicit, plusd16/a16/tfenegative controls)Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at
c7afbf0ece7b1a82139ec4918f32aca7fac63560:--preset dev):cmake --build --preset dev --target offscreen_check -- -j 6):2.78s(configure1.50s)ctest --preset dev -R 'startup_image_load_mip_controls|startup_image_load_mip_warp' --parallel 4 --no-tests=error --output-on-failure): 2/2 passed (0.40s:startup_image_load_mip_controls0.16s,startup_image_load_mip_warp0.33s)/O2(--preset release):cmake --build --preset release --target offscreen_check -- -j 6):0.34s(configure1.45s)ctest --preset release -R 'startup_image_load_mip_controls|startup_image_load_mip_warp' --parallel 4 --no-tests=error --output-on-failure): 2/2 passed (0.39s:startup_image_load_mip_controls0.16s,startup_image_load_mip_warp0.32s)Findings
tools/startup/gfx2hlsl.pylowersimage_load_mipfor 2D and 3D textures toTexture.Load(int3(x, y, mip))/Texture.Load(int4(x, y, z, mip))(including NSA non-consecutive coordinates), while keepingimage_loadat mip0.decode()rejectstfe(word0 & (1 << 16)) anda16(word1 & (1 << 30)), andimage()validates coordinate count (axes + 1), non-zerodmask, and allowed modifiers (dim:,dmask:,unorm,glc,slc,dlc), rejectingd16and other unsupported modifiers.tests/startup_image_load_mip_check.pyverifiesllvm-mcreassembly, translation outputs, negative controls (d16,a16,tfe), and WARP pixel-exact readbacks for mips 0 and 2 (plus wrong-mip rejection at(0, 0)).unormis currently in the allowed modifier list forimage_load_mip, even thoughTexture.Loadalways interprets coordinates as unnormalized integers; harmless if treated as a no-op, or could be rejected/ignored explicitly ifunormis unexpected onimage_load_mip.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T07:03:34Z.
I resolved the sole conflict locally against main after #1286 and reran the combined candidate. Both Linux checks should stay in
.github/workflows/windows.yml:startup_translator_check.pyfrom main, followed bystartup_image_load_mip_check.pyfrom this PR. LLVM 15 matched the gfx1013 words, the adjacent translator checks passed, and RTX 4060 Laptop and WARP each matched all 64 pixels at both levels. The deliberately wrong mip failed at the first pixel on both.GitHub reports maintainer edits disabled on this branch. Please merge main into the PR branch and keep both workflow lines. The other changed files merged cleanly in the local candidate.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T10:10:55Z.
Review: APPROVED
Approved this head for explicit 2D/3D mip selection and the modifier rejection controls. Keep the upstream translator checks when integrating the CI change. The two-level readback was validated on hardware and WARP in the earlier combined review.
upstream-sync referenced this pull request2026-11-24 18:02:49 +00:00