shader: accept partial channel masks on uncompressed pixel_aot exports #423
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/429"
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 abilliontokens on 2026-11-22T01:45:05Z.
Change
Refs #361 — stage 3 (non-compressed 32-bit exports with per-channel
offmasks), per the issue's proposed split. Depends on #398 (shader/exp-enable-mask, stage 1), which itself depends on #363; this branch stacks on #398's head and must land after both. Until they merge, the diff againstmainincludes their commits; the incremental change is the single commit on top.lower()now acceptsoffin any operand of the uncompressed exportexp mrt0 vA, vB, vC, vD done vm. Each enabled operand must be a distinct sample/alu register; the four enable bits form the channel mask reported byreturn_write_mask(so masks 0x1..0xE become reachable for this form, in addition to 0xF). Disabled channels return0.0fbehind the same immaterial-values comment as stage 1, since the harness blocks those writes with the PSO'sRenderTargetWriteMask[0]. An all-off export (mask 0) is rejected, and a partial mask combined withinteger_exportis rejected (out of scope); the full-mask integer path is byte-identical to before.offinside a compressed export and half-pair text such asv16, off, off, off done compr vmremain rejected. LLVM 15 normalizes compressed half-pair enables to whole pairs, so they are unexpressible in disassembly text (stage 2 stays dropped).write_case(write_mask=...)accepts any nonzero nibble 0x1..0xF, and the renderer accepts any nonzero trailer nibble (0 keeps the all-channel default), clearing to the sentinel (-1, 2, -3, 4) for every partial mask. Cases written without a trailer keep the original 1280-byte format byte-identically.uncompressed_export(body, mask)builds the per-channel-off text; masks 0x1, 0x8, 0x5, 0xA joined the LLVM 15 assembler round-trip list incheck_binary.check_exp_mask_uncompressed_drawdraws masks 0x1, 0x8, 0x5, 0xA, 0xF with distinct per-channel constant words throughv_sub_f32: enabled channels compare bit-exactly against the reference on the R32G32B32A32 target, disabled channels keep the sentinel. Two negative controls must reportpixel_mismatchon every backend: the EN=0x5 shader drawn under an all-channel PSO write mask against the sentinel-expecting reference (receives the immaterial zeros), and a corrupted enabled-channel reference. Rejection controls coveroffin a compressed export, compressed half-pair text, the all-off uncompressed export, a duplicated enabled register, and partial mask +integer_export.Verification
Windows 11 x64 build via
tools/dev.ps1(MSVC),cmake --preset dev -B out/build/dev-361s3 -DINTAKE_PYTHON=out/pe-env/Scripts/python.exe, then:cmake --build out/build/dev-361s3out/pe-env/Scripts/python.exe -B tests/pixel_aot_check.py binary <llvm-mc.exe> <llvm15/bin/llvm-objcopy.exe> <llvm15/bin/LLVM-C.dll>ctest --test-dir out/build/dev-361s3 --no-tests=error -R "^pixel_aot_"pixel_aot_warp,pixel_aot_hardware)$env:XBOX2WINDOWS_ADAPTER="RX 9060 XT"; ctest ... -R "^pixel_aot_hardware$"$env:XBOX2WINDOWS_ADAPTER="RTX 5060 Ti"; ctest ... -R "^pixel_aot_hardware$"out/pe-env/Scripts/python.exe -B tests/form_coverage_check.pyform coverage checks passedctest --test-dir out/build/dev-361s3 --no-tests=errorbvh_wave64_hardware,bvh_wave64_warp,wave_shuffle_warp)pixel_mismatch; rejection controls raise before any program is recorded for coverage. Sentinels: enabled channels bit-exact, disabled channels hold (-1, 2, -3, 4).Environment
bin/10.0.26100.0/x64/dxc.exe(dxcompiler 1.8.2502.11),-denorm preserveatps_6_2.Evidence / follow-up
exp mrt0 v12, off, off, off done vmand the mixed forms reassemble bit-identically, so per-channelofftext is authoritative for the uncompressed form (round-trip fixtures pin this).mrt1+,mrtz,null), exports withoutdone vm, multiple exports, partial mask + integer export.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T07:06:29Z.
I pushed
b639001after #434 merged. Partial uncompressed exports require the explicit floating-point RT0 mask, with the ordinary API and integer export both refusing them. LLVM 15 and the WARP and hardware Release draws passed for both compressed and uncompressed fixtures. The uncompressed references retain bits below binary16 precision and detect both a wrong PSO mask and a wrong enabled-channel value. Waiting for the final CI.