textures: honor the Scarlett copy-out signature for BC mip chains #2249
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2257"
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 RavenCurseBurg on 2026-11-25T08:20:36Z.
Microsoft's Scarlett detile call passes a zero-valued
UINTafter the subresource index. The existing 64 KiB BC5/BC7 texture computer uses the six-argument copy-in prototype for slot 9 as well. A caller following that example getsE_INVALIDARGbecause the zero occupies the position where the stand-in expects its source pointer. The copy-in call already matches slot 8.Give slot 9 its own entry point and pass its arguments to the existing detiler. The extra option's nonzero values have no established meaning here, so they return
E_NOTIMPLbefore touching the destination. Both native Python fixtures now call the published Scarlett signature. The single-slice case supplies a zero slice pitch and the array case supplies an explicit pitch.On Windows,
ctest -V -R '^startup_xg_(bc7_layout|bc_(chain|array)_warp)$'passed all three tests one640e28a. For each of BC5 and BC7, the six-mip case checked 87,360 block addresses and 12,288 WARP pixels. At both array heights, each format checked 18 subresources and 12,288 pixels against the slice reference. Restoring only the old slot-9 registration made the valid copy-out call fail in the same WARP test. Build and positive/negative test logsRefs #1140.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T08:25:57Z.
Review: COMMENTED
Review of head
e640e28a83ecd1e4f067e3348c2e5287bd761cf1.Summary: The change is small and coherent. Slot 9 of the BC-chain stand-in now takes the extra
UINTbetween the subresource and the tiled source. It rejects any non-zero value withE_NOTIMPLand forwards zero to the existing copy-out path. The tests and docs follow the new signature.Checked
bc64_copy_fromis the only slot-9 user inxg_xs.cpp. Slot 8 (copy in) is unchanged. The otherslots[9]hit is the unrelated GameInput table.startup_xg_bc_chain_check.pyguards this.len(linear). This covers both branches of theslice_pitch &&guard inbc64_copy.Findings
tests/startup_xg_bc_chain_check.py(new sentinel block, after thefor levelloop): it reuses the loop variableslevel,row_pitchandresultfrom the last iteration. This works, but it breaks if the loop is ever reordered or emptied. Binding explicit locals would be sturdier.src/startup_stubs/xg_bc64.inl:76: an unsupported option givesE_NOTIMPLeven when the other arguments are invalid. That is fine, but a one-line comment on the ordering would help.Commands executed locally (in a worktree at the head SHA)
git diff --stat origin/main...HEADgit diff --check origin/main...HEAD-> cleanpython3 tests/docs_links_check.py-> self-test passed, 18 Markdown files and 428 links OKpython3 tests/bidi_controls_check.py-> 1538 files, no bidi controlspython3 -m py_compile tests/startup_xg_bc*_check.py-> OKgh pr checks 2257Not run: the touched tests use
ctypes.WINFUNCTYPEagainst the Windows stub, so they can't run on Linux. That means I did not do a local mutation run. I relied on the green Windows CI job. A useful mutation for the author or the Windows stage: flipscarlett_option != 0to== 0, or callbc64_copy<true>inbc64_copy_from. Both should fail the chain and array checks. I did not run a Win2025 pass because this change has no shader or HLSL part.AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T08:35:30Z.
Review: COMMENTED
Re-review of head
af63f0dcf208f2cdaaa1d0e4c547ceebbd428d1a(delta sincee640e28:xg_bc64.inl+1 comment,startup_xg_bc_chain_check.py+8/-4).Delta checked
xg_bc64.inl: comment only. Thescarlett_option != 0 -> E_NOTIMPLguard still runs beforebc64_copy, so neither buffer is touched on refusal. No behavior change.startup_xg_bc_chain_check.py: the refusal control now uses its own destination buffer. It is exact-sized for mip 5 (blocks = 256 >> 5 = 8,pitch = 128, from the 1024x1024 BC base, i.e. 256 blocks at mip 0). It no longer reusesresultor the per-mip paddedrow_pitch, so the sentinel check cannot be masked by the copy-out loop above. Sizes agree with the mip-5 layout (OFFSETS[5]). Good isolation.0xadsentinel, so the assert would fail. I confirmed this by reading the code. I did not run it, because the test needsctypes.WINFUNCTYPE.Commands run locally (Linux)
gh pr checks 2257: Linux Python checks, Windows build+test and gfx1013 fixtures all pass. The /O2 job and the chart publish were skipped.python3 tests/docs_links_check.py: 18 files, 428 links OK.python3 tests/bidi_controls_check.py: 1538 files, no bidi controls.git diff --check origin/main...HEAD: clean.python3 tests/startup_xg_bc_chain_check.py: not runnable on Linux (ctypes.WINFUNCTYPEis missing). The Windows CI job covers it. I did not queue Win2025, since the delta is a comment plus a test-only change and CI is green on this head.Findings: P1=0, P2=0.
Title is neutral and the PR is mergeable. Nothing blocks this.
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by RavenCurseBurg on 2026-11-25T08:26:30Z.
I also reran both updated fixtures on an independent Windows machine with Microsoft FXC. All six native CPU byte/guard checks passed, and the local WARP run passed both formats at both array heights as well as both six-mip chains. On the physical adapter, the first BC5 draw reached the queue signal and the consumer process exited with 0xC0000005 before returning a pixel buffer. I have no physical-adapter pixel result for that run. The native slot-9 checks had already completed successfully. The Windows CI and the separate hosted WARP run are green.
Imported from R0Y00/Xbox2Windows. Originally posted by RavenCurseBurg on 2026-11-25T08:34:03Z.
Addressed both review notes in
af63f0dc. The nonzero-option test now owns its mip, pitch and sentinel buffer. The entry point documents why option validation happens before interpreting the other arguments.On this exact commit all three positive Windows CTests passed. Restoring the old registration broke the documented zero-option call. Inverting
scarlett_option != 0to== 0also made both the chain and array fixtures fail at their first valid copy-out call. Windows results, including both controls