Repository navigation
Conversation
… first trace LEONIDA_PRESENTX_SLOT/_SUSPEND_SLOT/_RESUME_SLOT route only the named queue slot past the public 19 and log its first call; every other tail slot keeps E_NOTIMPL. LEONIDA_CAPTURE=<dir> makes a routed PresentX validate the plane count (0-2), the plane array, ppResources and each resource vtable with VirtualQuery, then copy ppResources[0] through a committed readback buffer on the presenting queue to present-<n>-plane-<m>.ppm (BGRA/RGBA8, ALLOW_DISPLAY). No window and no swapchain are created. Malformed calls return E_INVALIDARG with one log line; a zero-plane present writes nothing and returns S_OK. The presentx_capture_probe covers the PPM pixels, nine malformed arg sets and the inert E_NOTIMPL path.
|
Reviewer verification: built the PR head; all three probe modes pass on real hardware (8x8 BGRA pixel-exact PPM, malformed 9/9 E_INVALIDARG with no files, inert returns the old E_NOTIMPL). Also verified against the layer: the readback is a real GPU-timeline signal (d3d12_com.cpp:1447, :1218), the 30s-timeout
Verdict: merge, and safe to enable on exe day staged as documented (route → drop, then LEONIDA_CAPTURE) — the default with no env is verified inert, and this path is also the only way to measure the slot. But land (1) first: "never a fault" is the claim the slot guess leans on. Top risks: wrong-slot wrong-vtable call; the provisional plane layout even when the slot is right (xbox_present_types.h says it is not the console ABI); title-side handling of E_INVALIDARG/S_OK returned from a method it did not think it called. |
…e refusals A readable/executable vtable alone does not identify the object behind a mis-routed PresentX. check_resource now calls QueryInterface with the layer's private Resource tag (shared in d3d12_object_tags.h and used by the Resource class so they cannot drift) and refuses before GetDesc/GetHeapProperties unless the tag succeeds. The probe adds a foreign object with a readable/executable vtable and asserts its GetDesc is never called. Refusal lines are throttled per distinct message (one per 250 ms) so a mis-routed slot cannot flood stderr. The capture path now requires a Leonida layer resource; host PC resources are refused by design.
|
Reviewer finding applied in 255efe0 (delta on top of 7d52b0a). What changed
Counts (RTX 5070 Ti, driver 621.24, Windows 11 26200,
|
Razdva122
left a comment
There was a problem hiding this comment.
I found two ways windowless capture can report success without a completed image at 255efe094.
- At
runtime/shims/presentx_capture.cpp:367, if the device is lost afterSignalsucceeds, this layer'sFence::GetCompletedValuereturnsUINT64_MAX(d3d12_com.cpp:1219). The polling loop treats it as reaching 1. With a stub fence returning that sentinel, the code proceeded to theMapbranch. Check the sampled value for removal before comparing it with 1, and return a failure before mapping or writing. D3D12 fence return contract - At
runtime/shims/presentx_capture.cpp:268,out.good()is evaluated beforestd::ofstreamcloses. The first buffered write error can surface during close. For the same 8×8 RGBA input, the writer returned true for both a healthy 203-byte file and a zero-byte file when I imposed a zero-byte process file-size limit. The caller would log a successful capture for either result. Explicitly close the stream before testing its state so a write failure reaches the caller.
I compiled the writer and polling block from this head with Apple Clang on macOS arm64. These were synthetic CPU probes. AI-assisted review.
The kit now ships gta6rt-final.exe (base ba4b0bd + ItsNotRexed#3777 + ItsNotRexed#5867/ItsNotRexed#5808/ItsNotRexed#5851 + ItsNotRexed#6230 @ 255efe0 + ItsNotRexed#6107/ItsNotRexed#6149 + runtime layer 7bce00b + ItsNotRexed#6351 XMemTransferMemory). Prefer it, fall back to gta6rt-final-pre-xmem.exe, then to the trace-only gta6rt.exe; verify the selected binary's hash and the five strings that decide capture and the Series startup path. Add the discover-presentx-slot.ps1 helper and its launch-exeday.ps1 bin caveat.
HDR10 planes present as DXGI_FORMAT_R10G10B10A2_UNORM; dxgiformat.h has no _SRGB variant. Accept it in check_resource and decode each little-endian 32-bit texel (R bits 0..9, G 10..19, B 20..29) to 8-bit RGB in write_ppm. The existing Width*4 footprint check already covers its 4-byte texels. Extend presentx_capture_probe capture mode with an 8x8 HDR10 texture whose quadrants are red, green, blue and a mid 512/511/513 grey, and check the second PPM's bytes.
|
Extended the windowless capture to HDR10 planes at head
Counts: capture 2/2 presents, 2 PPMs exact; malformed 10/10 |
|
Independent native Windows check of 03df5238. RTX 3080 Ti, NVIDIA 621.35, MSVC 19.44, Vulkan SDK 1.4.363.0. Both synthetic image cases from AI-assisted. |
What
Opt-in routing of the trace-named Xbox queue methods and a windowless first-frame capture, so the first trace can name a
PresentXslot and the next run can produce an image without a code change. The queue proxy still refuses every unconfigured slot past the public 19 withE_NOTIMPL.Environment
LEONIDA_PRESENTX_SLOT=<n>n(19..127) asPresentX(planeCount, planes, params). Unset: the oldE_NOTIMPLrefusal.LEONIDA_PRESENTX_SUSPEND_SLOT=<n>nasSuspendX(flags); returnsS_OK.LEONIDA_PRESENTX_RESUME_SLOT=<n>nasResumeX(); returnsS_OK.LEONIDA_CAPTURE=<dir>PresentX, capture instead of presenting: no window, no swapchain, noWindowPresenter. Unset: a routed present is accepted and dropped.The variables are read once, on the first queue call past the public chain, so the path is inert when they are unset. The first routed call is logged with the slot and the three argument words, e.g.
Capture and guards
ppResources, or a bad pointer returnsE_INVALIDARGwith one log line.ppResourcesarray and each resource pointer are checked withVirtualQueryfor readable, committed memory before they are read; the resource's vtable (QueryInterfaceslot 0,GetDescslot 10,GetHeapPropertiesslot 14) must be readable and executable. Guard pages andPAGE_NOACCESSnever fault.ID3D12Resourcemethod is called, the resource must answer the layer's privateResourcetag (kLeonidaResourceTag, shared throughruntime/shims/d3d12_object_tags.hand used by the layer'sResourceclass itself). A foreign object with a readable/executable vtable, or a host PC resource, is refused withE_INVALIDARG; itsGetDescis never called. The probe covers this with a synthetic foreign vtable._UNORM/_SRGB), size 1..32768, created withD3D12_HEAP_FLAG_ALLOW_DISPLAY. Anything else givesE_INVALIDARG(one line) and no file.ResourceCount >= 1takesppResources[0], copies subresource 0 to a committedREADBACKbuffer through the presenting queue, and writespresent-<n>-plane-<m>.ppm(P6, RGB;ncounts routed presents including blanks,mis the plane). Source BGRA/RGBA is decoded per the resource desc.D3D12_RESOURCE_STATE_PRESENT(the documented Xbox back-buffer state): the copy transitionsPRESENT -> COPY_SOURCE -> PRESENT. The console's plane struct and 64-bit token are the existing provisional layouts inxbox_present_types.h; "committed" itself is not queryable throughID3D12Resource, so the enforceable part (desc+ALLOW_DISPLAY) is checked.PresentXwrites nothing and returnsS_OK.gta6rtand adds no dependency to the device proxy's test target beyond one new.cpp.Tests
Built on
561b65a83(RelWithDebInfo, MSVC 19.44.35228, Vulkan SDK 1.4.363.0), run on NVIDIA GeForce RTX 5070 Ti, driver 621.24, Windows 11 26200,LEONIDA_VK_DEVICE='RTX 5070 Ti'.gta6rtd3d12_present_test(d3d12_present)presentx_capture_probe capturepresent-0-plane-0.ppm, 203 bytes (11-byte P6 header + 8×8×3), all 64 texels match; blank + SuspendX + ResumeXS_OKpresentx_capture_probe malformedE_INVALIDARG, foreignGetDesc/heap calls 0, 40 repeated foreign calls still refused, no files, no crashpresentx_capture_probe inertE_NOTIMPL, no filesxs_proxy_mock+no_reserve+no_protect+no_handlerd3d12_com,allocator_proxy,xbox_present,d3d12_computed3d12_boot_movieLEONIDA_GAME_DIR/LEONIDA_MOVIE)ctestover those 13 tests: 12 passed, 1 skipped, 0 failed.LEONIDA_VK_VALIDATION=1on the capture probe: 0 validation errors/VUIDs.The malformed set covers: null plane array, null
ppResources, 3 planes, null resource,PAGE_NOACCESSplane array,PAGE_NOACCESSppResources,PAGE_NOACCESSresource, a 2D texture withoutALLOW_DISPLAY, a buffer, and a foreign object with a readable/executable vtable whoseGetDescmust not run.PPM check (first texel): expected BGRA
(30,20,10,255)-> PPM RGB(10,20,30); the probe checks all 64 texels, not a sample.Missing requested target
d3d12_mesh_compute_testdoes not exist at561b65a83(ninja: error: unknown target 'd3d12_mesh_compute_test'); it is present only on the unmergedfork/assist-4408-rebasedbranch. I did not cherry-pick unrelated mesh-compute work. The existingd3d12_compute_testwas built and passed 1/1 as the nearest compute coverage.Notes
LEONIDA_PRESENTX_SLOT/LEONIDA_CAPTUREbranch that docs: the 5-hour exe-day first-frame runbook #6198 describes as "if the branch lands".ID3D12Resource(it answers the private layer tag). Host PC resources are deliberately refused: a readable/executable vtable alone does not prove the object is one of ours.