Retail game shows its first menus: depth views, buffers outside unified memory, rect lists #195
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!195
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/195/head"
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?
@theaustinayers on GitHub · 2026-11-23 20:16 UTC · original
theaustinayers:retail-first-screens→main· +760 −19 · 4 files · 3 commits · closed without mergingWhat this does
With these changes the newer retail game from the README table ("the image is still black") shows its first menu screens on an NVIDIA GPU: after about 45 s of black frames the account prompt appears full screen, and the next menus (legal terms) can be stepped through with a gamepad. A 4-minute run through those menus ends without a device removal. Nothing past the menus has been seen.
Tested on one machine only: Ryzen 9 9950X3D, RTX 5090, Windows 11, on top of
956a476.cargo check --release -p xclpasses on this branch; I did not run the test suite (no samples here).It includes three open PRs
This branch does not work without #163, #170 (Sr-0w) and #168 (ShyVortex), and since the review it also needs #192 (gbuyssens) for
XGTextureAddressComputer#10, which is no longer in this diff, so their changes toreal.rs/device_x.rsare in the diff as they are. That is their work, not mine. If you merge those first I will rebase and this shrinks to the parts below. If you would rather have this split into smaller PRs, say so.What is new here
Each item was found with
XCL_D3D12_DEBUG=1; the debug-layer message is named where there was one.Device removals (0x887a0001)
CreateDepthStencilViewhad no hook, so a view in the console's D16S8 format (118) reached the PC as it was (messages 47 / 276). Hooked, format mapped withpc_format.R32_FLOATof anR32G8X24buffer (message 28) and the like.pc_depth_view_formatgives the family's name; a stencil view (X24_TYPELESS_G8_UINT,X32_TYPELESS_G8X24_UINT) reads plane 1 (message 29), also in the SRV twin thatdev_create_uav_xmakes.ALLOW_UNORDERED_ACCESS(a console depth buffer that is also a UAV) is a null UAV instead of an illegal call (message 340), with plane 0 (message 344). Workaround: compute writes to those buffers are lost until they get a UAV twin.pc_format; 86 / 115 → R8G8B8A8, 116 / 117 → R16G16B16A16_FLOAT.Device hang (0x887a0006)
IASetIndexBuffer: message 725).pc_vapassed the address through and the GPU stopped responding. Now a 64 KiB-aligned range of that memory gets one mirror in unified memory, and each draw copies the part it reads (the index range, and the vertices those indices name) –list_x::gpu_va,mirror_of,sync_title_buffers. The title binds one ring buffer at many offsets, so views inside a mirrored range share the mirror. Limits: mirrors are never freed (capped at 2 GiB);ExecuteIndirectdraws are not synced; the copy is made when the draw is recorded, so what the title writes between recording andExecuteCommandListsis missed; this is a copy, not the real fix (that memory being GPU-visible).Rect lists
DrawInstancedwith topology 17 is expanded on the CPU to two triangles a rectangle (bind::draw_rects). The title's full-screen passes give (−1,1) (−1,−1) (1,−1) with uv (0,0) (0,1) (1,1), so the fourth corner isv0 + v2 − v1. The vertex layout is not looked at: a 4-byte word equal in all three vertices is kept, any other is taken as a float. Limits: indexed rect lists and rectangles a shader makes from the vertex index alone are still one triangle.Others
XGTextureAddressComputermethod #10 answered asGetResourceTiling, derived from the layout model. Not checked against the console's library. (I looked at #169's version of this and kept mine; happy to drop it in favour of that one.)GetGPUVirtualAddressof a committed texture returns a block of plain memory, so the title'smemsetthrough it no longer writes to address 0. Workaround: those writes are not uploaded.Still wrong after this
DirectStorage: BCPack mode 7 unsupportedrefuses one 64 KiB chunk.Disclosure
Written with AI assistance (Claude Code); I ran every build and test run described above on my own machine and can re-run anything you want checked. A build of this branch plus #151 and some launcher changes, with source, is at https://github.com/theaustinayers/xcl/releases/tag/v0.1.0-mod.6
🤖 Generated with Claude Code
@Kalmarv on GitHub · 2026-11-23 20:28 UTC · original
Thanks for this, and for writing down the full-screen corner order: it helped. I've been working on rect lists for #189, now open as #199. The approach is different: a translated VS+PS pipeline of topology type 19 gets a generated geometry shader that adds the fourth corner. Since both PRs touch rect lists, here is how they interact.
What the GS path covers that the CPU path doesn't
The hazard if both land as they are
draw_rectssends v0 v1 v2 and then v0 v2 v3. The second triangle is also three corners of the same rect, so the GS completes it to the whole rect as well (there's a test for that on the branch). Each rect is then drawn twice. The picture is the same when it's opaque, but wrong with blending.pc_stream_typesrewrites topology type 19 to 3 beforestream_pipelinereads it. Stream pipelines then never get the GS, so their indexed rect lists stay half drawn.Proposed split
draw_rectsonly expands rect-list draws on pipelines without it, the refused cases. I can add a per-pipeline flag fordraw_rectsto check.translated_graphics_pso. On our branchstream_pipelinekeeps it only for console-VS pipelines, and the translated path, the stand-in and the fallback each map it to TRIANGLE withpc_topology_typebefore the driver builds the pipeline.Merging our branch onto your head (
bf26412) gives no conflicts. On the merge, our four rect tests pass on an RTX 5070 Ti. They test the GS and don't go throughdraw_rects, so the double draw isn't measured, only shown by the second-triangle test. I'll rebase on whichever of the two lands first and add the check on our side. Does that split work for you?@Kalmarv on GitHub · 2026-11-23 20:28 UTC · original
I reviewed the non-rect parts of #195 at
bf26412: the IA buffer mirror, the depth views and XG #10. I read the code and added two CPU unit tests on the PR head, kept locally and not pushed; the test code is available if you want it. I did no GPU run and used no game data.XG #10 (
GetResourceTiling): three PRs implement it. #169, #192 and this one all fill slot 10. I ran this PR's version on #192's own fixture and on two more textures:xg.rs:539). The shape's depth is always 1, but the block is 8 deep. 256 tiles of 8×16×1 cover 32,768 texels, while the volume has 262,144. This is wrong whatever the console's library does.xg.rs:513: a tile is one block of whatever the mode is). D3D12 tiles are 64 KiB.xg.rs:554). That is PC D3D12's form; #192 says the console library skips them.On these fixtures #195 differs from #192 only in those three places; the 64 KiB 2D numbers match exactly. One of the three implementations should be picked.
IA buffer mirror (
list_x.rs)list_x.rs:1676,1681; called frombind.rs:306). The test isDrawInstanced(4, 1, 0, StartInstanceLocation 5)with a mirrored per-instance buffer of 16-byte stride. The sync copies bytes 0–64 (vertices 0–3) but not element 5 (bytes 80–96), which is the one the draw reads.first_instanceis not passed tosync_title_buffers, and the buffer's stepping is not known there. Copying the whole buffer unless the input layout steps it per vertex would cover this.list_x.rs:1595–1598).mirror_ofchecksmirrored(), then takes the lock again without checking again. The thread that loses the race pushes a second mirror and binds it. Every latermirrored()finds the first mirror, including that thread's own draw-time sync, so the second mirror keeps the bytes it had when it was made. Checking again under the lock fixes it. This comes from reading the code; no test exercises it.bind.rs:306,319). Whatever the title writes after recording a draw and beforeExecuteCommandLists(X)is missed. This is not in the PR's list of limits.list_x.rs:1603),gpu_vagoes back to a copy made at bind time in the list's upload memory (1563), and that copy is never synced. That is the build-4 behaviour the mirrors replaced, and nothing says so in the log.list_x.rs:1663), for list topologies too. If 65535 is a draw's highest index, that vertex is not synced.Checked, no finding:
mirror_of's 64 KiB rounding and offsets: the alignment of the offset inside the mirror is kept.pc_depth_view_format's family mapping, and plane 1 for 22 / 47 in the SRV and in the UAV's SRV twin.Not covered: no D3D12 debug-layer run of the depth views, any GPU test or
ExecuteIndirect(already listed in the PR).AI-assisted (Claude Code); synthetic inputs only.
@idkwtftonamemyself on GitHub · 2026-11-23 20:29 UTC · original
its all claude my GUY
@Kalmarv on GitHub · 2026-11-23 20:32 UTC · original
About the missing body text and the
DirectStorage: BCPack mode 7 unsupportedlead: two points about what that log line shows, and an experiment you can run.The log line means more than one chunk. On
main, every BCPack refusal goes throughwarn_once("BCPack", …)(crates/xcl/src/hle/dstorage.rs,Request::check). That key is the same for every mode and every request, so the line is printed once per run: it is the first BCPack request refused, of any mode. Every later BCPack request, BC7 or otherwise, fails silently withE_DECOMPRESSION(0x89240030). The log can't tell one 64 KiB chunk from thousands.Mode 7 is BC7.
BcpackModeis the 4-bitDSTORAGE_BCPACK_MODEinDSTORAGE_REQUEST_OPTIONS. Microsoft's public GDK reference lists 1 BC1, 2 BC2, 3 BC3, 4 BC4, 5 BC5, 6 BC6H, 7 BC7 (DSTORAGE_BCPACK_MODE). So the title asked for BCPack-packed BC7 blocks, and XCL has no BCPack decoder for any mode. If a font atlas is among those textures, it is never written. Its blocks keep whatever the memory held, and zeroed BC7 blocks decode to transparent black, which would look like missing letters. That is a plausible cause, not a confirmed one. Your own list has other candidates: indexed rect lists, shader-made rects, andXGTextureAddressComputer#10.An experiment to tell them apart: #201 (diagnostics only; the refusals don't change).
report.jsongetsdstorage.bcpack_refused: requests, zlib-combined requests and destination bytes per mode. The log now has one warning per mode and zlib stage, and a running count line.XCL_DSTORAGE_BCPACK_FILL=1, each refused BCPack destination is filled with solid blocks of its format instead of being left as it was: magenta for BC1/2/3/6H/7, red for BC4/5. The request still fails with the same status.Run the menus once with
XCL_DSTORAGE_BCPACK_FILL=1:Either way,
bcpack_refusedinreport.jsonshows how many chunks and bytes it is about.AI-assisted (Claude Code). No game data.
@theaustinayers on GitHub · 2026-11-23 20:39 UTC · original
@Kalmarv thank you, that is a careful read and you are right on the points below. Pushed two commits.
Rect lists. Your split works for me: the GS where a pipeline has it,
draw_rectsonly for the pipelines it refuses. Add the per-pipeline flag on your side and I will check it indraw_rects; if #199 lands first I will rebase and do that here. Until then this PR is the only thing expanding them, so there is no double draw yet.XG #10. Dropped from this PR in favour of #192, which is read from the library. Your three differences are all cases where mine guessed. The branch now needs #192 as well as #163 / #168 / #170 to reach the menus; I have been running it with #192 since this afternoon (same result in the menus).
Mirrors.
mirror_oflooks again under the lock.BCPack. You were right that the line hides the count, and I was wrong to call it one chunk. I added a running count on my fork: on the first screen there is exactly one refused request (mode 7, 51012 → 65536 bytes), but one button press later there are 32 within 70 ms, modes 7 and 5, over 3 MB, and it keeps going. So the menus' textures are largely BCPack and none of it loads. The letters that are missing are the short lowercase ones (a c e m n o r s u) while digits, capitals and tall letters draw, which fits blocks of a height-sorted atlas being absent. I have not run #201's magenta fill yet; I will and report here.
Tested:
cargo check --release -p xclon the branch; the same mirror code on my fork ran the title's menus for 115 s with no device removal (RTX 5090). Not tested: the instance case and the race, which I have no reproduction for.(AI-assisted, as before.)
@Kalmarv on GitHub · 2026-11-23 20:44 UTC · original
Thanks, the flag is in #199 as fbc855c:
real::has_rect_list_gs(pso: usize) -> bool. It's true for a pipeline that was made with the generated rect-list GS. It takes the pipeline the same wayis_translated_graphicsdoes, so resolve a background stand-in first withpso_async::resolve_wait, asbind.rsdoes. A pipeline the driver refused with the GS and that was made again without it isn't flagged, andforget_psoclears the entry. Sodraw_rectsonly needs to return false whenhas_rect_list_gsis true for the bound pipeline. If #195 lands first, I'll add that check in #199 myself.@ivall on GitHub · 2026-11-23 20:57 UTC · original
Closing - taken into main in parts, thanks! On main (
38b05b7,eaa36b6) the retail game now reaches its first menu at 30 fps with ~19 GB of commit, checked on an RX 9070;cargo test --workspaceis green (548 unit tests). From this PR: index / vertex buffers outside unified memory mirrored and synced per draw, including your review fixes fromfa79d46(eaa36b6); rect lists as two triangles per rectangle on the CPU; GetGPUVirtualAddress memory for committed textures (reserved and committed on the first write instead of committed up front); stand-in streams with null shader pointers; the debug layer logged 8 messages per id. The view-format part was reworked to map views by the resource's PC format. XG #10 and the mesh-stream part are covered on main (see #192, #170).mainreaches on Windows; the obstacle is replaced vtables — proposal: proxies #175Pull request closed