xshader: write the cube helpers only into programs that call them #645
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/645"
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 brcly/TuxBox. Originally posted by NickStallman on 2026-12-01T23:39:33Z.
Every translation carried
tb_cubema,tb_cubesc,tb_cubetc,tb_cubeidandtb_cube_dir, used or not. They are now a block of their own, written only when the program calls one:v_cube*_f32or a cube image's coordinates. The other small ALU helpers that shared the block (tb_perm,tb_cmp_class,tb_mull,tb_log2and the rest) stay in every translation, now asALU_HELPERS. Gating on the body followstb_omod.As #641 discussed, every program's HLSL changes, so the DXIL store recompiles each one once. #643 and brcly's latest translator commits already change every program, so landing this before users next prepare shaders costs no extra recompile. DXC already dropped the unused helpers, so the DXIL itself doesn't change.
On a seeded sample (measured on
89546024, before the rebase; the helper text is unchanged) of 300 recorded ProjectScarlett requests, 290 translate. 256 of them lose 1,171 bytes of HLSL each, and the other 34 call the helpers, so their HLSL is unchanged. The other 10 are refused by one build or both; I did not compare those refusals.Tests
cube_helpers_come_only_with_cube_instructions(src/tests/hlsl/rdna2_alu_gaps.rs): a program without a cube instruction has notb_cubein its HLSL, and one withv_cubeid_f32still has the helpers. It fails on main. The existing cube image andv_cubeid_f32tests pass.host_profiles.txtre-recorded withTUXBOX_BLESS_PROFILES=1(all 58 lines).python tuxbox.py check --no-gpu:Evidence: TuxBox check of bf87edd73984, no uncommitted changes, no GPU checks: 13 passed, 0 failed, 0 not runRefs #641, #643, #533.
🤖 Generated with Claude Code