Repository navigation
Conversation
Slot 19 validates both textures (single-sample destination, multisampled source, matching size, subresource range) and moves them to the resolve states before the desktop call. Part of R0Y00#870.
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour 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. |
There was a problem hiding this comment.
💡 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
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
| 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)); |
There was a problem hiding this comment.
Preserve resolved data when uploading sampled textures
For a resolve destination with Flags == D3D12_RESOURCE_FLAG_NONE and readable title-memory backing, such as a texture created through slot 133, this updates only the desktop texture. The next translated SRV bind unconditionally calls upload_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 👍 / 👎.
| 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)); |
There was a problem hiding this comment.
Normalize console formats before submitting the resolve
When the caller supplies console colour format 116 or 117, sanitized() creates both desktop resources as DXGI_FORMAT_R10G10B10A2_UNORM through desktop_format(), but this call forwards the original console value. Both values pass x2w_resolve::check because 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 👍 / 👎.
| 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)); |
There was a problem hiding this comment.
Restore attachment states before subsequent draws
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, while list_draw() and draw_translated() do not re-establish it; the title's barrier calls are still no-ops. Since targets_bound remains 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 👍 / 👎.
| # 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) |
There was a problem hiding this comment.
Document the new resolve capability and reproduction command
This adds an externally usable startup operation and a new CTest command, but a repository-wide search for ResolveSubresource and resolve_subresource finds no corresponding README or experiment-documentation entry. AGENTS.md requires updating the relevant README row or docs/experiments.md when 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 👍 / 👎.
Ran your host test under MSVC, broke the rules seven ways: six caught, and the seventh is a real gapYour command works on Windows too, with cl /nologo /std:c++17 /EHsc tests/startup_resolve_subresource.cpp /I src/startup_stubs
startup_resolve_subresource: ok exit 0
The height check is unpinned, and it is the one that matters mostOnly the width is compared by the fixture. A probe that varies only the height proves it both ways: // 256x128 destination, 256x256 source: equal width and mip, different height
const Verdict v = check(dst, 0, src, 0, 28);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 const Side dst_h = side(256, 128, 1, 1, 1, true);
const Side src_h = side(256, 256, 1, 1, 4, true);
expect(check(dst_h, 0, src_h, 0, 28) == Verdict::size_mismatch, "height mismatch is refused");Two things the fixture does well
What I did not check
Notes
|
|
Closing as duplicate of our broader open PR #1944 (which already covers slot 19 alongside slots 15/17 and hardware tests). |
Part 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.