startup: publish single-element 2D and 3D textures by address in device slot 70 #2149
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2157"
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-25T01:49:51Z.
Change
Device slot 70 (the memory SRV call) now publishes a 1×1 2D or 1×1×1 3D texture by address, without a resource object. Until now such views were refused with
unsupported_description, and the destination descriptor kept stale bytes. The only texel is read from offset 0 of guest memory, so no detiling is needed.Accepted:
0x100), plus the GFX10 swizzle modes AMD addrlib defines without pipe/bank XOR (0x101,0x102,0x105,0x106,0x109,0x10A).Still refused:
0x103,0x104,0x107,0x108,0x10B) and XOR layouts (0x110and up);A view over a live render-target, depth or UAV resource that covers the address (its base, or inside its known allocation size) is refused with a new reason,
gpu_written_resource. It is listed intools/startup/triage_run.py.The translated draw uploads the texel through the existing footprint path. It rehashes the texel (at most 16 bytes) on every bind, so a write between two draws in the same frame is seen.
Code touched:
src/startup_stubs/single_element_srv.h(acceptance and element size).src/startup_stubs/d3d12_memory_srv.inl: acceptance, size and an early publish block.src/startup_stubs/d3d12_draw.inl,upload_textureonly: thesingleflag in theuploadablecheck, three!singleguards, and the recheck line.Verification
Code under test:
acdc50e8:bf652854merged withmainat442d289e, plus one test-only commit.main(94337881) is clean and has not been re-tested.a289585b), which changes the same file.Environment: Windows 11 build 26300, debug layer off. Hardware is NVIDIA GeForce RTX 5090 (driver 32.0.16.2135); WARP is 10.0.26100.10068. Adapter names come from the consumer's output.
Result at
bf652854: 20 passed, 0 failed, 0 skipped.startup_single_element_srv(50 descriptions),startup_single_element_srv_xor_control(WILL_FAIL), 5startup_memory_srv*,startup_image_3d_controls,startup_triage_run,startup_tools_lint.startup_address_single_element,startup_address_srv,startup_address_buffer_srv,startup_address_bc_view,startup_image_3d.Result at
acdc50e8:ctest --preset release --no-tests=error -R '^startup_address_single_element_(warp|hardware)$'gives 2 passed, 0 failed, 0 skipped.Read-back pixels.
startup_address_single_element_{warp,hardware}draws 8 columns per dimension (2D and 3D) and reads back the target. All 32 RGBA pixels per dimension match on both adapters. The columns are:0x105;Descriptor unchanged on refusal. The same test makes fifteen refused calls before column 3:
0x115, layout0x10B, 4 MiB alignment;After each refused call the consumer compares the destination descriptor's 32 bytes and exits with 60 plus the call's position if they changed. Column 3 must then still read the previously published texel. Each refused call names memory holding a different texel, so any call wrongly accepted changes the image.
Negative controls, each rebuilt and run on WARP, each failing:
00000000;0x115: column 3 readsdeadbeef;5aa53cff, the previous texel;deadbeef.Evidence and follow-up
Fixtures. All inputs are source-built: literal texel bytes in
tests/startup_address_srv.cpp. The device-free check istests/startup_single_element_srv_check.cpp. The reproduction command is indocs/experiments.md, section "Single-element 2D and 3D textures published by address".Assumptions.
0x100, offset 0 is exact.5c142e46), not run: a single mip sits at offset 0 (Gfx10Lib::ComputeSurfaceInfoMacroTiled), and the coordinate pattern of a non-XOR mode is zero at the origin.Local run of a console executable (a run of the title's executable, not a fixture; counts only):
Limits.
upload_textureandd3d12_memory_srv.inl. That PR handles 2D tiled textures and does not cover this slice.Checklist
AI-assisted (Claude Code).
🤖 Generated with Claude Code
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T02:08:40Z.
Review: COMMENTED
Review of head
acdc50e84a8428eaabd2bd06b301a616f4b7e249(comment only, no approval).Result: no P1, no P2. Two nits.
What I checked
git diff --stat origin/main...HEAD: 12 files, +451/-7. Title and body are neutral. Mergeable, not draft.python3 tests/docs_links_check.py: self-test passed, 18 files, 391 links.python3 tests/bidi_controls_check.py: self-test passed, 1407 files, no bidi controls.git diff --check origin/main...HEAD: clean (rc=0).single_element_srv.h, thed3d12_memory_srv.inlhunks (gpu_written_at,publish_tiled_texture, the slot 70 branch) and theupload_texturehunks ind3d12_draw.inl.Logic
!singleguards inupload_texturekeep the BC/tiled plan checks and the surface size unchanged for existing paths.single_element_bytesreturns 0 for BC, so the old paths are not affected.recheck = single || ...rehashes at most 16 bytes per bind. The cost is fine and the "write between two draws" case is covered by column 3 of the consumer test.Not run locally
d3d12.h. I relied on the Windows CI job for them. I did not run a Win2025 job or a mutation of the new logic.Nits (not blocking)
d3d12_memory_srv.inl,gpu_written_at: a GPU-written texture whose allocation size is unknown (info.bytes == 0) is only matched at its exact base. An address inside it is not caught. The PR body already says so. A one-line comment next to thebytesfallback would help the next reader.single_element_srv.h, format switch: it duplicates a part of theFETCH_FORMATSandFETCH_DXGIknowledge. A short comment saying why these formats were chosen (same bytes on desktop) would keep the sibling tables easier to keep in step.AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T02:39:20Z.
Review: COMMENTED
Review of head
84c66897860d9aef3b2d879e89b773099905577b(comment only, no approval).Result: no P1, no P2.
What I checked
git diff --stat origin/main...HEAD: 12 files, +453/-7. Title and body are neutral, mergeable, not draft.python3 tests/docs_links_check.py: self-test passed, 18 files, 391 links.python3 tests/bidi_controls_check.py: self-test passed, 1407 files, no bidirectional controls.git diff --check origin/main...HEAD: clean.python3 tests/startup_triage_run_check.py: 0 failed.tests/startup_single_element_srv_check.cppbuilt with mingw and run under wine:50 cases, 12 accepted, 38 refused, 0 mismatches. The--mutate xornegative control returns 1 as intended..pydraw test needs the Windows consumer and a D3D12 device, so I did not run it. I did not run a Windows WARP job either.Mutations (reverted with
git checkout -- .)0x115(XOR layout) to the accepted layouts insingle_element_srv.h: killed ("4 KiB S with XOR 0x115", 1 mismatch).r.MipLevels != 1check withfalse: killed ("zero mips" and one more case, 2 mismatches).Code read
single_element_bytesandsupports_single_element_srv: the accepted layout set, flags, formats and whole-texture view checks match the description. The only texel is at offset 0 in every accepted layout.gpu_written_overlap: both overlap branches (address at or below the base, address inside the known size) are right. A resource of unknown size only counts at its base, as the comment says.upload_texture: thesinglepath skips the tiled plan and size checks and reuses the footprint upload. The rehash on every bind is fine for at most 16 bytes.Nit
d3d12_draw.inlsingleis derived fromtiled_address_srvplussingle_element_bytes(desc). A comment saying that a 1x1 BC or R8 texture can never take this branch would help the next reader. No change needed for merge.AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-25T02:36:17Z.
I tightened the publication-time check to test the full texel range against live GPU-written backing, even if the texel starts before the resource. In the new control two bytes lie on each side of a UAV buffer base. The descriptor stays unchanged. All six Windows Release tests passed on the candidate, including the existing address SRV and single-element WARP and RTX 4060 Laptop draws and the XOR refusal.