startup: publish BC3/BC7 memory SRVs whose last tile row or column is partial #2098
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2105"
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 NiiRoZz on 2026-11-25T00:25:15Z.
Change
Device slot 70 publishes an address-only BC3_UNORM or BC7_UNORM view at layout 0x105 (4 KiB standard,
non-XOR) only when width and height are multiples of 64 texels. Any other size is refused as
unsupported_description, the destination descriptor keeps its previous bytes, and translated draws thatsample it bind a null texture.
A single-mip 4 KiB standard surface pads its pitch and height to whole tiles. In AMD addrlib (Mesa
5c142e46f3f6e752ed745fd48912ebb8fad67145,src/amd/addrlib/src/gfx10/gfx10addrlib.cpp),ComputeSurfaceInfoMacroTiledaligns pitch and height to the block size, with no mip tail for one mip.ComputeSurfaceAddrFromCoordMacroTiledtakes a block's tile index as block row × tiles per padded pitch,plus block column.
Bc16Surfaceand the existing detile path already do the same.What changes:
tiled_bc_srvnow accepts any non-zero width and height in whole 4x4 blocks, which the desktop texturerequires. Other sizes stay refused. One mip, one slice, the alignment, the flags and the view checks are
unchanged.
partial_tile_xg_rows: the XG stand-in announced a copy to the address before the first publicationthere. That copy wrote desktop-footprint rows, and the upload would read them as tiles. A copy from the
opt-in BC7 4 KiB layout writes tiles and does not hold the view.
partial_tile_beyond_xg_size: the padded tiles are larger than the size the stand-in reports for thedescription (the footprint rounded to 64 KiB). Those bytes may belong to something else, and the
readability probe cannot tell. Example: 1028x1028 pads to 1,183,744 bytes against a reported 1,179,648.
a log bound only: at most 64 lines for published views and 8 for refused ones, and nothing depends on
reaching it.
It gives the size, format, layout and tiled byte count, plus how many of the first and last 4 KiB are
non-zero, with a hash. A refused view logs its reason instead.
No change to
draw_translatedorupload_texture.Refs #1140 (layout queries: this does not change the XG answers). Open PR #1469 adds a general tiler and
rewrites the same
publish_tiled_texture/ slot 70 statement ind3d12_memory_srv.inl, so a textualconflict is expected whichever lands second. It does not widen the slot 70 check.
Verification
Head
681a22a2, which merges current main at32595645. Measured at the commits named below; Release build, Windows 11 build 26300, debug layer off.Full filter at
ae287201(merged with main at06cdc47d): 23 tests selected, 23 passed, 0 failed, 0 skipped.startup_bc7_4k_sand its control,startup_stream_fetch_translate.startup_stream_*_warp,startup_address_*_warp), withstartup_address_bc_view_warptaking 28.8 s.*_hardware), withstartup_address_bc_view_hardwaretaking 19.9 s.b52f56afadds two cases to the fixture and the opt-in-copy distinction. At that commitstartup_address_bc_view_warpandstartup_address_bc_view_hardwarepassed (21.0 s and 32.1 s).The later merge of main at
32595645(681a22a2) was clean and was not re-tested.docs_links_check.py: 18 files, 391 links, pass.startup_address_bc_viewran on NVIDIA GeForce RTX 5090 (32.0.16.2135) and on WARP (10.0.26100.10068).texels outside the texture must load as zero, and the log must report 16,384 tiled bytes.
Controls inside the test:
1,600 pixels for BC3 and 1,500 for BC7.
view over memory announced as an XG copy.
64 KiB), and a 100x68 view over memory announced by the opt-in BC7 4 KiB copy, which writes real tiles.
Each of these source changes makes the test fail:
partial_tile_xg_rowsrefusal&&)>=)partial_tile_beyond_xg_sizepartial_tile_xg_rowsBc16Surfacetile rows downstartup_bc7_4k_salso fails (its rows expect 4096)The check now translates the pipeline (gfx2hlsl and FXC) once per run and draws every case from that cache.
Before, it translated once per case, and translation dominated the run time. So the four cases run in
about the time the two cases took on
main, measured on the same loaded machine:main, two casesThe 90 s limit is unchanged.
Evidence and follow-up
The fixture is source-built. It uses the existing literal BC3 encoder and the BC7 block builder of
bc7_draw_check.py, placed with the repository's 4 KiB standard block order (bc7_tiles_check.py).Assumptions:
The padding rule is addrlib's GFX10 rule. That the console uses the same padding is the assumption the
existing 64-texel path already makes. The optional addrlib oracle test was not run.
A partial last column changes block addresses, which the wrong-pitch control covers. A partial last row
changes only how many bytes are read, which the byte-count assertion and
startup_bc7_4k_scover.Both readability probes (at publish and at upload) check that the padded range is mapped, not that the
texture owns it. The reported-size refusal covers the case where padding runs past what the title was
told; within the reported size, ownership is assumed.
Limit: the record of an XG copy is never cleared. An address that was once written with desktop rows
keeps its partial-tile views refused, even if tiled data is later placed there.
mainrefused all ofthese views.
In a local run of a console executable:
Follow-ups, not in this PR:
upload_texture.docs/experiments.md, "Sample address-only BC3/BC7 textures in translated draws", is updated.Checklist
AI-assisted (Claude Code); the commands listed were run locally.
🤖 Generated with Claude Code
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-25T00:37:27Z.
Can you add a negative case for a partial-tile address after its first valid publication, followed by a desktop-row XG copy at that address and a second slot 70 request? The present refusal is gated on !tiled_srv_addresses.count(address). The current tests cover the XG row copy before the first publication. Please either show which update path preserves the tiled backing for later copies or make the refusal track the latest write provenance, and check the second request preserves its destination descriptor on refusal.
Imported from R0Y00/Xbox2Windows. Originally posted by NiiRoZz on 2026-11-25T01:01:20Z.
Thanks, the gap was real: the refusal only covered a row copy before the first publication, and no update path keeps the backing tiled.
As of
fc958fb5, the write record stores whether the last XG copy wrote desktop rows or the opt-in tiles, and the refusal follows the latest writer.startup_address_bc_viewnow publishes a partial-tile view, copies rows over the address, and checks that a second slot 70 request is refused with its destination descriptor unchanged. That case fails on the previous head (the descriptor was overwritten).startup_address_bc_viewpasses on WARP and on the RTX 5090.Limit, noted in the docs: a view published before the row copy still reads the address as tiles; only new requests are refused.
AI-assisted (Claude Code).
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-25T01:18:14Z.
The new republication case preserves the destination descriptor. An already-bound token could still reach the tiled uploader after the last write changed to desktop rows. I added the same provenance check at sampling time, keeping descriptor bytes intact and binding a null texture while rows are current. Windows Release passed 6/6 (partial/full BC view, address buffer and XG BC-chain on WARP and RTX 4060 Laptop). Disabling only the sampling check changed panel 4 at local pixel (4,0) from zero to 0000ff07 in WARP, while the republication guard stayed active.