Skip to content

d3d12_xs: device slot 133 places a resource as a committed DEFAULT one (CreatePlacedResourceX stand-in, depends on #6953) - #7075

Closed
NiiRoZz wants to merge 5 commits into
ProjectLeonida:mainfrom
NiiRoZz:rt-xs-slot133-placed-resource
Closed

NiiRoZz wants to merge 5 commits into
ProjectLeonida:mainfrom
NiiRoZz:rt-xs-slot133-placed-resource

Conversation

@NiiRoZz

@NiiRoZz NiiRoZz commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as: #7049 (comment) (item 2)

Depends on: #6953 (the 192-slot device table). This branch is #6953 plus one commit.

What and why

Xbox device slot 133 is (va, desc, initial_state, clear_value, riid, out), the shape of the console's CreatePlacedResourceX. Measured locally at a title's call sites: riid is ID3D12Resource, va is the start of a range the title has just reserved for physical pages, desc is a 56-byte D3D12_RESOURCE_DESC with Xbox bits in Flags above the PC flags, and initial_state is all ones, which is no PC state. With #6953 the call reaches the beyond-table refusal, and the title asserts on the E_NOTIMPL.

The proxy now answers slot 133 before that refusal and calls the PC CreateCommittedResource on a DEFAULT heap. The description is cleaned first:

  • PC flag bits only (up to USE_TIGHT_ALIGNMENT);
  • slot 76's layout rule (ROW_MAJOR for buffers, UNKNOWN otherwise);
  • COMMON for a buffer or for the all-ones state;
  • the clear value only for a render-target or depth texture.

This is a stand-in. The resource isn't backed by the memory at va, so what the title writes into that range doesn't reach it. The first-call log line says so. Backing it needs the physical-page mapper; I posted that as a new item on the coordination issue.

With it (and the other open PRs on that path), the boot gets past slot 133 to the first descriptor heap.

Tested

Windows 11 (build 26300), RTX 5090, MSVC 19.44, Vulkan SDK 1.4.363.0, RelWithDebInfo.

  • xs_proxy_mock_test: a mock CreateCommittedResource records its arguments. The new case uses a 76-slot device, so slot 133 is past its table, and covers a buffer with an Xbox flag and layout word, a render target in a PC state with its clear value, the all-ones state on a texture, null description/IID/output, and a failed creation. The beyond-table check moves to slot 134. PASS.
  • ctest -R "xs_proxy|device_proxy": 6/6 pass.
  • Local boot with the dependent PRs merged: slot 133 creates its resource and the run continues to CreateDescriptorHeap.

AI-assisted: yes (Claude Code)

Checklist

  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. Only slot numbers, public SDK types, flag classes and counts.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a: runtime only)

Update: the fourth word is a barrier layout

Later in the boot, slot 133 is called for 1x1 render-target and depth textures with the fourth word 6. Read as a resource state, that is INDEX_BUFFER | RENDER_TARGET, which the PC device refuses for a texture, and the title then asserts on the missing resource. As a D3D12_BARRIER_LAYOUT, 6 is SHADER_RESOURCE, and the all-ones value of the first call is UNDEFINED (#7052 reads slot 127's argument the same way). Commit e0b300f02:

  • On a PC device with ID3D12Device10, the resource is created through CreateCommittedResource3 with the layout as given (UNDEFINED for a buffer).
  • An older device gets CreateCommittedResource with the legacy state of that layout (COMMON for UNDEFINED and for layouts that have none).
  • xs_proxy_mock_test: the slot 133 case passes layouts now, adds SHADER_RESOURCE on the 76-slot device, and adds an ID3D12Device10 device whose CreateCommittedResource3 gets the layout, the cleaned description, the clear value and no session; a buffer goes in UNDEFINED. It passes; the previous handler fails it at the RENDER_TARGET layout case. device_proxy_test: OK.
  • Retail boot (locally merged with the boot-path PRs): the assert after the two refused textures is gone; the boot goes on to 2,317 D3D12 calls.

🤖 Generated with Claude Code

Pipodi and others added 2 commits November 23, 2026 16:30
…e PC vtable refuse with E_NOTIMPL

The retail title calls device slot 133, past the 128-entry table; the call read an empty entry and jumped to 0.
Every slot beyond the PC device's vtable now reaches the generic thunk. Mock test covers slot 133.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e (CreatePlacedResourceX stand-in)

Xbox device slot 133 is (va, desc, initial_state, clear_value, riid, out), the shape of the console's
CreatePlacedResourceX. With ItsNotRexed#6953 the call reaches the beyond-table refusal and the title asserts on the
E_NOTIMPL. The proxy now answers it before that refusal: a committed DEFAULT-heap resource from the
description with the PC flag bits only, slot 76's layout rule, COMMON for a buffer or the all-ones state,
and the clear value only for render-target and depth textures. The resource is not backed by the memory
at va; that needs the physical-page mapper.

xs_proxy_mock_test: a mock CreateCommittedResource that records its arguments, and a slot 133 case over a
76-slot device (buffer, render target, all-ones state, null arguments, a failed creation). The
beyond-table check moves to slot 134.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…resource

# Conflicts:
#	runtime/shims/d3d12_xs_device.cpp
#	runtime/shims/d3d12_xs_device.h
#	runtime/test/xs_proxy_mock_test.cpp
@Stalkerino

Copy link
Copy Markdown

Linux results for the committed control and for the physical backing work claimed by @guimsolutions. Backing task

  • Wine 11.22 and Proton CachyOS on RX 9070 XT (RADV GFX1201) both reach Xbox device slot 133 with d3d12_xs: the device proxy table covers slot 133, so slots past the PC vtable refuse instead of jumping to 0 #6953. With d3d12_xs: device slot 133 places a resource as a committed DEFAULT one (CreatePlacedResourceX stand-in, depends on #6953) #7075, Wine reaches the first descriptor heap. Adding d3d12_xs: honour __XMemAllocationHooks__ for descriptor heaps and translate CPU handles #7021 in the same build reaches the GPU descriptor handle, creates CBV/SRV/UAV views, and reaches slot 70. These runs are still at frame 0.
  • On the first placement the buffer spans 174 MiB across three contiguous XMem windows. At that instant all 2,784 pages of 64 KiB are mapped to distinct frames. The registry showed no internal or external aliases and no gaps.
  • Using synthetic data on the same GPU, the sparse-mapper test backed a 174 MiB buffer with 2,784 distinct XMem pages distributed across three equal windows in deliberately interleaved physical order. One compute dispatch accessed the buffer by device address, reading a CPU marker and writing a result for every page. After readback all 2,784 outputs and 5,568 guard words matched. The test exercises explicit synchronization. It does not establish automatic coherence for the runtime’s normal queue or the meaning of the extra Xbox resource flag.
  • A separate dense import of a Wine pagefile section failed at vkAllocateMemory with VK_ERROR_OUT_OF_HOST_MEMORY. A private allocation with matching size, alignment and memory type imported successfully on the same GPU. An independent committed buffer failed the CPU/GPU alias readback control.
  • When building this PR’s mock with clang-cl/xwin, the synthetic Xbox-only flag in check_placed_resource_x caused a constant-expression diagnostic, so our mock run supplied the flag as a raw integer test input. All four proxy mock configurations then passed.

The reproducer has a single commit on the public #5381 head and builds using the public XMem exports from #6919. The commit message gives the two refs and commands. I applied its patch in a fresh worktree, rebuilt it and reran it on this GPU. Source, shader and reproduction instructions

…n and runs on its own line, clear of the slot 73/list changes in ItsNotRexed#7076

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@DeSunShine

Copy link
Copy Markdown
Contributor

Tested cac1fc0cd merged into main 8714c3503 on NVIDIA GeForce RTX 4090 (driver 621.24), Windows 11 Pro 26200, MSVC (VS Build Tools 18) + Ninja, Vulkan SDK 1.4.363: pass.

  • ctest -R "xs_proxy|device_proxy" --output-on-failure: 8/8 passed (device_proxy, device_proxy_trace, xs_proxy_mock, _no_reserve, _no_protect, _no_handler, _env_slots, _env_slots_invalid).

AI-assisted (Claude Code).

@Marukooh

Copy link
Copy Markdown
Contributor

Independent test of the runtime change in cac1fc0c on CachyOS x86-64, Wine 11.22, clang-cl 23.1.5, xwin SDK 10.0.26100, RTX 5070 Ti (NVIDIA 620.73.04), Vulkan, offline on my local 1.0.2.1 copy.

On the same integration with #7076, all 581 lists create and close. With the 128-slot table, the next stop is a null execute fault. With #6953 the same path reaches slot 133 and receives E_NOTIMPL. With this PR's diagnostic stand-in, the committed resource creation succeeds and the first descriptor heap is created; startup then stops at the CPU handle check. This confirms the next stop under Wine, without verifying backing at the guest VA.

One cross-build issue in the synthetic test: clang-cl rejects the constexpr cast of the Xbox-only bit to D3D12_RESOURCE_FLAGS because the value lies outside the SDK enum's range. I kept the test's Xbox flag and layout words as uint32_t and copied them into the fixture's ABI fields with memcpy, with width assertions. That variant compiled and passed xs_proxy_mock under Wine.

Outcomes only; no retail data or trace. AI-assisted (Codex).

@465d6a0eac

Copy link
Copy Markdown
Contributor

Tested 11aee7e0a (which includes #6953) merged onto main f283b1378, on Windows 11 (build 26300), RTX 3070 Ti (driver 610.88): pass for what main can reach. The new slot 133 path is not reached on the retail executable at this base. Build: MSVC 19.44.35230, Windows SDK 10.0.26100, RelWithDebInfo with Ninja, LEONIDA_D3D12=vulkan. The executable is from my own 1.0.2.1 copy (SHA-256 matches docs/runtime_imports.md). Counts and outcomes only.

  • Build and tests. The build is clean. xs_proxy_mock passes, including its new slot 133 case ("past a 76-slot device"), as do device_proxy, device_proxy_trace and the xs_proxy_mock_* env variants. The full ctest -j 8 passes 233 of 234. The one failure is d3d12_vulkan_device line 6564: tiles == 1, the slot 78 regression from d3d12_xs: route the public HLE's Xbox device slots 48/73/78/79/80 #6935, which also fails on main and is fixed by d3d12_vulkan_device: check PC CreateReservedResource2 behind the Xbox proxy, not through slot 78 #7125.
  • --dry-run. Identical to main: 5 modules, game_scarlett_master.exe shim 54 / host 432 / module 72 / unimplemented 29, and the other modules unchanged.
  • --run, 16 runs each. This base stops before D3D12XboxCreateDevice, at the title's int3 after the XMemVirtualAlloc attribute events, so the proxy is never built.
    • With this PR: 10 × 0x80000003 (always the same site as on main), 3 × 0xC0000374 and 3 × 0xC0000005.
    • On main: 9 / 5 / 2.
    • The 0xC0000005s fall in different places on different runs, in the same way on both: two reads in ntdll/gta6rt.exe, and once a write in title code under the TLS callback path. That matches the variable endings docs/retail_boot_chain.md describes after the assert, not this change.

To see slot 133 itself, the boot needs the xmem, TLS, slot 26/48/73 and list-proxy PRs stacked. I didn't build that stack, and @kingzzim7-create claimed that integration check.

AI-assisted (Claude Code).

@NJ1912

NJ1912 commented Nov 23, 2026

Copy link
Copy Markdown

Code read of cac1fc0c (the slot-133 commit 11aee7e0 on top of #6953, merged with main; merges cleanly onto main 8575d36e): LGTM with notes.

  • Flag mask (runtime/shims/d3d12_xs_device.cpp:1495): kPcResourceFlags = 0x3FF; // ... up to USE_TIGHT_ALIGNMENT (0x200). D3D12_RESOURCE_FLAG_USE_TIGHT_ALIGNMENT is 0x400 in DirectX-Headers, not 0x200, and this repo's own host measurement (runtime/shims/d3d12_vulkan_device.cpp:1560-1561 on main) says the host accepts 0x400 and refuses 0x200 and 0x800. So the mask keeps 0x200, which the host refuses, and drops 0x400. The measured call gets through, so this is latent, but a description carrying 0x200 would still fail in CreateCommittedResource after "cleaning". Keeping the bits the 10.0.26100 header names (0x1FF), plus 0x400 explicitly if tight alignment should pass as it does at d3d12_vulkan_device.cpp:1564, and fixing the comment would close it.
  • First-call log line (:1515-1521): it prints "created committed, not backed by the VA" before CreateCommittedResource runs (:1525), and the result is returned without being logged. If the first call fails, the log still says "created" and the failing HRESULT never appears, while the title would just assert. Logging after the call, with the HRESULT (and maybe va), as slot 67 does on failure (:1446-1449), would make a failure on this boot-path call visible.
  • Tests (runtime/test/xs_proxy_mock_test.cpp): the buffer case (:760) passes the all-ones state, so the buffer || half of the COMMON rule (d3d12_xs_device.cpp:1510) isn't tested on its own (a buffer in e.g. COPY_DEST would); there is no ALLOW_DEPTH_STENCIL texture and no non-target texture given a clear value, although the summary line (:809-810) says "clear value for targets only"; and a non-PC bit inside 0x3FF (0x200) would have caught the first point.
  • Checked, no change needed: *out is cleared first and null desc/riid/out are refused before the device is called (:1501-1503); the PC HRESULT is returned unchanged; the resource comes back with its creation reference, as slot 76 does; the Slot == 133 branch sits ahead of the generic branch that checks d3d12_xs: route the public HLE's Xbox device slots 48/73/78/79/80 #6935's routes, and the LEONIDA_XS_*_SLOT overrides are clamped to 3..127 (:192), so no route can claim 133.

Not run: code read only, no tests run. AI-assisted review.

@controldebils

Copy link
Copy Markdown
Contributor

@NiiRoZz a retail note on slot 133's state word, from an RX 6900 XT run (Windows 11, MSVC, LEONIDA_D3D12=vulkan, own 1.0.2.1 copy, past stop 17):

  • For render-target and depth textures the title passes 6 as slot 133's state word; the all-ones word this PR already maps to COMMON is the other value seen. That fits D3D12_BARRIER_LAYOUT (6 = SHADER_RESOURCE, 0xFFFFFFFF = UNDEFINED), not D3D12_RESOURCE_STATES.
  • This PR passes the word to CreateCommittedResource as a resource state, so those textures are refused.
  • Creating them through CreateCommittedResource3 with the word as the initial layout works on our run.

@tibzejoker, the same applies to #7218: it handles buffers only, and the title also places textures through slot 133 with a layout word.

AI-assisted (Claude Code).

@kormocicsaba

Copy link
Copy Markdown

Tested cac1fc0cd, merged alone into main 8575d36: pass. 256/259. The failures are the main baseline; d3d12_bindless_churn_validated failed under -j8 here and then passed 3 of 3 times run alone.

Setup: RTX 4070 (driver 621.01), Windows 11 Pro 26300, MSVC (VS 18) RelWithDebInfo with Ninja, Vulkan SDK 1.4.363.0. The PR head was merged alone into main 8575d36 and runtime/ was built. I ran the full ctest -j8 --timeout 300; no game files were used.
Baseline on main: d3d12_vulkan_device and d3d12_indirect_dispatch_count fail on main 8575d36 as well. d3d12_bindless_churn fails now and then under -j8 on main too: it failed in main's -j8 run and passed 3 of 3 times run alone there.

AI-assisted review (Claude Code). How this compares with the other boot-chain PRs: #7333 (comment)

…CreateCommittedResource3 with it

The word slot 133 passes after the description is a D3D12_BARRIER_LAYOUT, not a resource state:
the title passes all ones (UNDEFINED) for its first buffer and 6 (SHADER_RESOURCE) for 1x1
render-target and depth textures. Read as a state, 6 is INDEX_BUFFER | RENDER_TARGET, which the
PC device refuses for a texture, and the title then asserts on the missing resource.

On a PC device with ID3D12Device10 the resource is created through CreateCommittedResource3 with
the layout as given (UNDEFINED for a buffer). An older device gets CreateCommittedResource with the
legacy state of that layout, COMMON for UNDEFINED and for layouts that have none.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tibzejoker

Copy link
Copy Markdown
Contributor

Hi, #7218 (mine) and this PR both handle device slot 133 and conflict in d3d12_xs_device.cpp (slot_name, proxy_create_placed_resource_x, the Slot == 133 branch), as @NJ1912 noted on #7218. A proposed split: #7218 keeps buffers (the title's pages imported with VK_EXT_external_memory_host, an ordinary buffer when the import is refused), and this PR keeps textures, which #7218 answers E_NOTIMPL. Whichever lands second rebases onto the other's handler. Happy to do that rebase myself if #7075 lands first. AI-assisted (Claude Code).

@zohaiblazuli

Copy link
Copy Markdown

Tested cac1fc0cd on the retail executable (before the latest push): pass.

Retail Xbox Series 1.0.2.1 package + executable (sizes match game/xbox-1.0.2.1.json), Windows 11 10.0.26300, MSVC 14.50, GeForce RTX 3060 (driver 32.0.16.1742). Vulkan backend (LEONIDA_D3D12=vulkan, Vulkan SDK 1.4.363). gta6rt --run with --overlay to a scratch folder, outbound network blocked, LEONIDA_UNIMPLEMENTED=stop. Base: main 8575d36ed plus my local console-queue-flag and struct-return (slots 25/26/43) changes, with these PRs merged in this order: #6953, #7187, #7076, #7075, #7021, #7066, #7235 (which carries #7052). Conflicts resolved locally.

Outcomes only; no game data.

@dcastell1

Copy link
Copy Markdown
Contributor

Tested with the retail image on RTX 5090, 621.24, Windows 11: pass, and it moves the boot.

Base: main@dde82f27 + #6943 + #4313 #4348 #6582 #6964 #6954 #2490 + #6953 + this PR, all merged locally (conflicts were comments only: the slot-26 block from main and the slot-133 block from here collide as an add/add, and the shared closing brace has to stay with whichever function is kept).

Result: the device-slot-133 crash is gone. The run now creates a descriptor heap and reaches heap slot 9 (GetCPUDescriptorHandleForHeapStart), then ends in a clean int3 (0x80000003) — the descriptor-handle assertion of docs/retail_boot_chain.md stop 13, which is the open question there (A10). No access violation at 0 anywhere.

So the "places a committed DEFAULT resource" shape is enough to get the title to the next stop on this machine. I have not built #7218 for comparison; if its author wants the same measurement on the alternative, it is one build away.

@dcastell1

Copy link
Copy Markdown
Contributor

Review note on the flag mask, with the values checked against the SDK on this machine rather than from memory.

kPcResourceFlags = 0x3FF is not the set the host accepts. From 10.0.26100/um/d3d12.h:3069-3078 the flags are RT 0x1, DS 0x2, UAV 0x4, DENY_SRV 0x8, CROSS_ADAPTER 0x10, SIMULTANEOUS 0x20, VIDEO_DECODE 0x40, VIDEO_ENCODE 0x80, AS 0x100 — there is no 0x200 and no 0x400 in this SDK. And committed_resource_refusal (d3d12_vulkan_device.cpp:1558-1567) accepts exactly:

  • buffer: RT | UAV | DENY_SRV | AS | 0x400 = 0x50D
  • texture: that | DS | SIMULTANEOUS = 0x52F

while its own comment says the host refuses 0x200 and 0x800. So 0x3FF passes 0x200 through (a console bit → E_INVALIDARG "resource flags") and drops 0x400 (which the host does accept). If any of the three call sites carries 0x200, this returns E_INVALIDARG instead of creating the resource; with the masked-to-0x50D/0x52F version the same flags become S_OK.

Two things worth doing while the mask changes anyway: make it per-dimension like the layer's (buffer vs texture), and log the original Flags next to the masked one on the first call. That is the only way anyone learns what the console bits actually were, and the layer's comment already says the values are unmeasured.

None of this changes what I measured: with this PR the boot reaches heap slot 9 and stop 13 on the 5090.

@byPreaZy byPreaZy left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed and tested on Windows 11, MSVC, RX 9060 XT (no GPU path needed, mock test only).

  • Applied the diff on main 3ef93ba, built xs_proxy_mock_test: PASS (9 intentional refusals), including the new slot-133 section: buffer -> ROW_MAJOR/COMMON/no clear, RT texture in layout 2 -> RENDER_TARGET + clear value, UNDEFINED layout -> COMMON, SHADER_RESOURCE layout 6, Xbox flag bits masked off, slot 134 still refused with E_NOTIMPL.
  • The fourth-word-is-BARRIER_LAYOUT reading matches the measured calls (all-ones = UNDEFINED, 6 = SHADER_RESOURCE); legacy_state_for_layout covers the pre-Device10 path and the Device10 path passes the layout through to CreateCommittedResource3.
  • The "committed, not backed by the VA" limitation is documented in the comment and the log line; consistent with the decision to take #7075 now and keep #7218's external-memory model for later.

LGTM from my side; CI was still pending when I checked.

AI-assisted review.

@byPreaZy

Copy link
Copy Markdown

+1 on dcastell1's flag-mask note, independently verified on this machine: SDK 10.0.26100 d3d12.h ends the enum at RAYTRACING_ACCELERATION_STRUCTURE (0x100), and committed_resource_refusal (d3d12_vulkan_device.cpp:1556-1571) accepts buffer 0x50D / texture 0x52F while refusing 0x200 and 0x800. kPcResourceFlags=0x3FF therefore forwards a bit the host refuses and drops 0x400 which it accepts. Per-dimension masks matching the layer's accepted sets plus logging the original Flags on the first call would close it.

AI-assisted.

@kacper-serewis

Copy link
Copy Markdown
Contributor

checked: A38, e0b300f on #6953 at 4b76715. Windows x64, MSVC 14.50, RelWithDebInfo. I called slot 133 with synthetic buffer descriptors and captured the flags at the receiving mock. Both Device9 CreateCommittedResource and Device10 CreateCommittedResource3 received 0x200 for input 0x200 and zero for input 0x400. This confirms the mask strips the PC tight-alignment bit on both routes. xs_proxy_mock and device_proxy passed (2/2). No retail inference from this check. AI-assisted.

@tedin7

tedin7 commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

checked: #7075 at e0b300f, merged onto main 867d922 (clean merge, 3 files, +276/-2; note it carries the same kMaxSlots = 192 line as #6953) | on: Wine 11 on RunPod RTX 4090 (Linux), clang-cl cross-build; not native Windows, host D3D12/WARP comparisons do not run | result: NOT a clean pass. Two real defects at this head.

  1. The test file does not compile with clang-cl (the repo's own cmake/clang-cl-xwin.cmake cross-build). Built as published, xs_proxy_mock_test fails: xs_proxy_mock_test.cpp(778,32): error: integer value 131072 is outside the valid range of values [0, 511] for the enumeration type 'D3D12_RESOURCE_FLAGS' [-Wenum-constexpr-conversion] on constexpr auto kXboxFlag = static_cast<D3D12_RESOURCE_FLAGS>(0x20000); (EXIT 98). MSVC accepts it, so native Windows testers do not see it. This confirms @lunarminus's report on the current head. With only that one line changed in my scratch copy to const auto (not part of the PR), xs_proxy_mock_test EXIT 0 (PASS) and its five ctest modes (--fail-virtualalloc, --fail-virtualprotect, --fail-veh, --env-slots, --env-slots-invalid) all EXIT 0.
  2. The flag mask is wrong against the layer it feeds. kPcResourceFlags = 0x3FF (comment: "up to USE_TIGHT_ALIGNMENT (0x200)"). In runtime/shims/d3d12_vulkan_device.cpp committed_resource_refusal the comment says the host accepts 0x400 and refuses 0x200 and 0x800, and its accepted set is RT|UAV|DENY_SRV|AS|0x400 (+DS|SIMULTANEOUS for textures). So 0x3FF lets a console 0x200 bit through (the resource is then refused with "resource flags") and strips the 0x400 bit the host does accept. 0x200 is not USE_TIGHT_ALIGNMENT. Agrees with @zqqqqx and @dcastell1; not fixed at this head. Impact depends on which bits the title sets, which is not measured.

Other review notes: the layout word is treated as a D3D12_BARRIER_LAYOUT (UNDEFINED for a buffer), a reasoned reading of measurements I cannot reproduce; the resource is committed, not backed by the VA, and the code and log line say so honestly; va is unused. A tester reports the same slot-133 path returns E_INVALIDARG for a UAV texture from the initial-state check, and another that it should reuse #7356's pc_initial_state; neither is addressed here. The proxy test is mock-only.

Not verified: retail boot (others report it moves the boot), native Windows, any real device, #6953 stacked (I tested this PR alone on main; both add kMaxSlots = 192 so they merge in either order), negative control (none claimed).

agent: yes
AI-assisted.

ramenbellic added a commit to ramenbellic/Leonida that referenced this pull request Nov 23, 2026
Impre-visible pushed a commit to Impre-visible/Leonida that referenced this pull request Nov 23, 2026
…e resource of a slot 70 view of that address

Device slot 70 makes a shader-resource view from a description and a console
address, with no resource object. It asked only the device behind the proxy
for a buffer at that address, and that device knows the buffer by the title's
address only when it could put the buffer on the title's own pages. When it
could not (the import is refused, or the device is a PC one), the slot 133
buffer has an address of its own, nothing was found, and the title's
descriptor got the null view.

The proxy now remembers every buffer a slot 133 call made by the range the
title placed it at, whichever way it was made (the placed-at-VA handler, PC
CreateCommittedResource3 or CreateCommittedResource), and slot 70 asks there
first, then the device's provider. An entry holds no reference. An object
attached to the resource as private data removes the entry when the resource
dies, and a device proxy's entries go with it. The newest buffer over an
address answers, so a range the title places again is the new buffer's.

xs_proxy_mock_test: check_slot70_placed_buffer covers both creation paths
and the handler path, the element range, the cut at the buffer's end, the
addresses around two buffers, a texture, the provider fallback and its
order, a range placed twice, a released buffer and a released device. The
check of the placed-at-VA handler in check_levels hands out a mock resource
instead of a made-up pointer, since the proxy now asks the object for
ID3D12Resource.

Depends on: ItsNotRexed#7066 (slot 70), ItsNotRexed#7218 or ItsNotRexed#7075 (slot 133), ItsNotRexed#6953 (the table
reaches slot 133), and ItsNotRexed#7235 for the mock's SetPrivateDataInterface.

(cherry picked from commit 7387445)
Signed-off-by: local <local@localhost>
@ramenbellic

Copy link
Copy Markdown

Tested e0b300f under Wine: Proton Experimental (wine 11), runtime cross-built with clang-cl 23.1.6 + xwin SDK 10.0.26100 (RelWithDebInfo), merged onto main dfe4e4a, RTX 3070 host, NVIDIA driver 620.70.06 (tests are CPU-side): fail: build

  • Build: failed with clang-cl 23.1.6: 1 of 589 steps, xs_proxy_mock_test; the line is added by this PR, main dfe4e4a builds
runtime/test/xs_proxy_mock_test.cpp(778,20): error: constexpr variable 'kXboxFlag' must be initialized by a constant expression
  778 |     constexpr auto kXboxFlag = static_cast<D3D12_RESOURCE_FLAGS>(0x20000);  // a bit above every PC flag
      |                    ^           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
runtime/test/xs_proxy_mock_test.cpp(778,32): note: integer value 131072 is outside the valid range of values [0, 511] for the enumeration type 'D3D12_RESOURCE_FLAGS'
  • Tests: not run (no build).

D3D12_RESOURCE_FLAGS has no fixed underlying type, so clang refuses a constant expression with a value outside its range; MSVC accepts it. A non-constexpr constant (const auto kXboxFlag = static_cast<D3D12_RESOURCE_FLAGS>(0x20000);) or comparing the flags as std::uint32_t builds with both. #7110 had the same thing.

AI-assisted run (Claude Code); no game files used.

@bobczan

bobczan commented Nov 23, 2026

Copy link
Copy Markdown

Verified on a retail run: this carries the title past slot 133 to the next stop (Windows 11, RTX 5070)

I had a stack that reached slot 133 and stopped there with E_NOTIMPL, which made this PR the obvious next thing to test.

Base: main 5d74c2723 + #8461 + #6964 + #8258 + #7076 (those four only to get the title down the boot chain) + #6953
(the 192-slot table, without which the call never arrives at all). Then this PR. LEONIDA_D3D12=vulkan, 150 s, fresh
trace each run, 2/2.

Without this PR — the call is refused and the run ends there:

d3d12_xs: device slot 133 (forwarded) is beyond the PC device vtable (80 slots); returning E_NOTIMPL
rc=3   (2/2)

With this PR — the call is handled and the run advances:

d3d12_xs: device slot 133 (Xbox CreatePlacedResourceX -> committed resource) first call
d3d12_xs: slot 133 places a resource at a VA: dimension=1 flags=0x20004 -> 0x4, layout=0xffffffff; created committed resource
...
d3d12_xs: heap slot 9 (GetCPUDescriptorHandleForHeapStart) first call
rc=3   (2/2)

So the stop moves from device slot 133 to heap slot 9 (GetCPUDescriptorHandleForHeapStart), deterministically,
on both runs. Your flags=0x20004 -> 0x4 and layout=0xffffffff cleaning is exactly what the log shows the title
passing, so the argument order you read is the one the title used.

Two things you should know about my build. I merged this by hand and two seams needed fixing, so a failure here would
not necessarily be yours:

  • the slot-26 function lost its closing brace at the merge point (I put it back);
  • device_slot_overridden() needed the union of both lists — mine had slots 12 and 26, yours added 133, so the merged
    line reads … 12 … 14 … 26 … … 75 || 76 || 133.

I also dropped #7052 (slot 127 CreateCommittedResource3) from this
run: it collides with this PR over the same constants, and slot 127 is never reached on this path, so leaving it out
costs nothing and keeps the result clean.

Slot numbers and outcome only; no game data.

AntoninMichelq added a commit to AntoninMichelq/Leonida that referenced this pull request Nov 23, 2026
… and drops UAV on depth-stencil textures

On an RX 7600 retail run, slot 133 placed a 2D depth-stencil texture with
unordered access (console flags) in layout 3 (UNORDERED_ACCESS). The
stand-in passed 3 as a resource state, which the PC refuses for a texture
(buffer-only bits), so the title got a null resource and faulted reading
through it. Map the layout as ProjectLeonida#7075 measured it, clean the flags as slot 76
does, and retry once in COMMON if the device still refuses.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AZ9pSEQH36Tc3GjTNQcxUs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.