startup: implement ResolveSubresource command-list slot (Part of #870) #2049
No reviewers
Labels
No labels
accessibility
awaiting author
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
priority: P0
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/R0Y00--Xbox2Windows!2049
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/2049/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?
@tedin7 on GitHub · 2026-11-24 23:38 UTC · original
tedin7:x2w-870-resolve-subresource→main· +152 −0 · 4 files · 1 commits · closed without mergingPart of #870
What this unblocks: MSAA render targets can be resolved into a single-sample texture, so a title's resolve step no longer falls to the no-op stub.
Forwards command list slot 19 (
ResolveSubresource, desktop order) to the desktop list. Both textures must use COMMON state tracking. The list moves them to RESOLVE_DEST / RESOLVE_SOURCE for the call. Calls that do not fit (buffer, multisampled destination, single-sample source, size mismatch, subresource out of range, unknown format) are refused and logged instead of reaching the driver. The rules live insrc/startup_stubs/resolve_subresource.h(no Windows types) with a unit test.Verification:
g++ -std=c++17 -Wall -o /tmp/rs_test tests/startup_resolve_subresource.cpp && /tmp/rs_test(Linux host) ->startup_resolve_subresource: okgit diff --check-> cleand3d12_xs_device.cppchange is not compiled yet, and slot 19 has no call-site confirmation (it is the desktop slot, bracketed by confirmed slots 13 and 20). Needs a Win2025 build andctest -R startup_resolve_subresourcebefore merge.@chatgpt-codex-connector[bot] on GitHub · 2026-11-24 23:41 UTC · original · edited 2026-11-24 23:47 UTC
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
b3ac4aeℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.
@ -2300,0 +2330,4 @@if (verdict != x2w_resolve::Verdict::ok) return refuse("arguments do not describe a valid resolve");require_state(self, target, D3D12_RESOURCE_STATE_RESOLVE_DEST);require_state(self, origin, D3D12_RESOURCE_STATE_RESOLVE_SOURCE);list->ResolveSubresource(target, destination_subresource, origin, source_subresource, static_cast<DXGI_FORMAT>(format));@chatgpt-codex-connector[bot] on GitHub · 2026-11-24 23:47 UTC · original
For a resolve destination with
Flags == D3D12_RESOURCE_FLAG_NONEand readable title-memory backing, such as a texture created through slot 133, this updates only the desktop texture. The next translated SRV bind unconditionally callsupload_texture(src/startup_stubs/d3d12_draw.inl:999), which excludes only render-target, depth-stencil and UAV resources. On its first bind, it therefore uploads the untouched CPU backing over the resolved pixels. A valid resolve-then-sample sequence reads stale CPU data instead of the resolve result. Record the destination's GPU-written contents and make the upload path preserve them.Useful? React with 👍 / 👎.
@ -2300,0 +2330,4 @@if (verdict != x2w_resolve::Verdict::ok) return refuse("arguments do not describe a valid resolve");require_state(self, target, D3D12_RESOURCE_STATE_RESOLVE_DEST);require_state(self, origin, D3D12_RESOURCE_STATE_RESOLVE_SOURCE);list->ResolveSubresource(target, destination_subresource, origin, source_subresource, static_cast<DXGI_FORMAT>(format));@chatgpt-codex-connector[bot] on GitHub · 2026-11-24 23:47 UTC · original
When the caller supplies console colour format 116 or 117,
sanitized()creates both desktop resources asDXGI_FORMAT_R10G10B10A2_UNORMthroughdesktop_format(), but this call forwards the original console value. Both values passx2w_resolve::checkbecause its format check rejects only zero. Consequently, successfully created stand-ins receive a resolve with an unsupported desktop format that also differs from their actual format, potentially invalidating the command list or removing the device. Apply the existing desktop-format conversion before validating and forwarding the call.Useful? React with 👍 / 👎.
@ -2300,0 +2330,4 @@if (verdict != x2w_resolve::Verdict::ok) return refuse("arguments do not describe a valid resolve");require_state(self, target, D3D12_RESOURCE_STATE_RESOLVE_DEST);require_state(self, origin, D3D12_RESOURCE_STATE_RESOLVE_SOURCE);list->ResolveSubresource(target, destination_subresource, origin, source_subresource, static_cast<DXGI_FORMAT>(format));@chatgpt-codex-connector[bot] on GitHub · 2026-11-24 23:47 UTC · original
If the single-sample destination is already bound as a render target, resolving into it and then drawing again without rebinding leaves it in
RESOLVE_DEST.list_targets()establishes render-target state only at bind time, whilelist_draw()anddraw_translated()do not re-establish it; the title's barrier calls are still no-ops. Sincetargets_boundremains true, the next draw is recorded against an attachment in the wrong state, producing validation errors and possible device removal. Restore the previous tracked states after resolving, or ensure subsequent draws transition their bound attachments back to the required states.Useful? React with 👍 / 👎.
@ -662,0 +663,4 @@# Rules that gate a title's ResolveSubresource (src/startup_stubs/resolve_subresource.h, #870).add_executable(startup_resolve_subresource tests/startup_resolve_subresource.cpp)target_compile_features(startup_resolve_subresource PRIVATE cxx_std_17)add_test(NAME startup_resolve_subresource COMMAND startup_resolve_subresource)@chatgpt-codex-connector[bot] on GitHub · 2026-11-24 23:47 UTC · original
This adds an externally usable startup operation and a new CTest command, but a repository-wide search for
ResolveSubresourceandresolve_subresourcefinds no corresponding README or experiment-documentation entry.AGENTS.mdrequires updating the relevant README row ordocs/experiments.mdwhen a public capability or reproduction command changes. Add the supported resource constraints, the fixture's reproduction command and result, and the distinction between the tested argument predicates and the still-unverified Windows forwarding path.AGENTS.md reference: AGENTS.md:L211-L212
Useful? React with 👍 / 👎.
@ChazY11 on GitHub · 2026-11-24 23:55 UTC · original
Ran your host test under MSVC, broke the rules seven ways: six caught, and the seventh is a real gap
Your command works on Windows too, with
clinstead ofg++:resolve_subresource.hdestination.sample_count != 1removedsource.sample_count <= 1→< 1is_texture2drequirement removedif (!format)removeddestination_subresource >= subresource_count→>mip_extentfloor1→0falseThe height check is unpinned, and it is the one that matters most
Only the width is compared by the fixture. A probe that varies only the height proves it both ways:
So today the header is correct and the height clause is untested. That is the clause whose failure mode the file's own comment describes: the call reaches
the driver and the desktop runtime treats it as a device-removing error. A one-line case closes it:
Two things the fixture does well
mip_extent's floor at 1 is caught: without it, a mip chain that shifts a small base to zero would compare0 != 1for identical textures and refusevalid resolves. That is a real one and it is pinned.
>=, not>), which is the boundary that off-by-one always lands on.What I did not check
d3d12_xs_device.cpp's use of these verdicts — the state transitions toRESOLVE_DEST/RESOLVE_SOURCEand the logging path are Windows-only and I have nodevice here. The header is genuinely "no Windows types" as claimed, which is what made this review possible without a build tree.
Notes
@tedin7 on GitHub · 2026-11-25 00:30 UTC · original
Closing as duplicate of our broader open PR #1944 (which already covers slot 19 alongside slots 15/17 and hardware tests).
@chatgpt-codex-connector[bot] on GitHub · 2026-11-24 23:47 UTC · original · reviewed
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:
b3ac4aec3aℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Pull request closed