Skip to content

runtime: capture slot 57 attachment formats for profiles - #3736

Open
lambirou wants to merge 1 commit into
R0Y00:mainfrom
lambirou:codex/mesh57-attachment-capture-clean
Open

lambirou wants to merge 1 commit into
R0Y00:mainfrom
lambirou:codex/mesh57-attachment-capture-clean

Conversation

@lambirou

@lambirou lambirou commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

X2W_MESH57_CAPTURE_STATE=1 archived the slot 57 state blocks in
req_<variant>.s57, but not the render-target and depth formats bound at
that draw. tools/startup/mesh57_profile_draft.py reads those from an
adjacent .t57 sidecar, so a color capture could only be reviewed as a
depth-only profile and no color profile could be built from the title.

The capture now writes req_<variant>.t57 immediately before .s57, in
one targets <N> <fmt...> dsv <fmt> writable <0|1> samples 1 0 line with
decimal DXGI formats. It is written only when the bound attachments are
single-sample and at least one target or the DSV has a known format; an empty
or multisample bind writes no sidecar and keeps .s57 as the archive. The
fixture binds R8G8B8A8_UNORM and D32_FLOAT_S8X24_UINT, checks the exact
tuple against its own formats, and covers the depth-only, empty and
multisample controls.

Validation (Windows, Release):

  • ctest --preset release --no-tests=error -R '^(native_fixed_mesh57(_mrt)?_(warp|hardware)|startup_indirect_mesh_(warp|hardware))$'
    — 6/6 pass, including AMD Radeon RX 9060 XT.
  • python -B tests/mesh57_profile_draft_check.py — pass.
  • python -B tests/docs_links_check.py — pass.

Refs #3497
Refs #3724

The fixed slot 57 capture kept the state blocks but not the render-target and depth formats, so a color profile could not be reviewed from it. Publish a `.t57` sidecar immediately before `.s57` when the bound attachments are single-sample: one `targets <N> <fmt...> dsv <fmt> writable <0|1> samples 1 0` line that `mesh57_profile_draft.py` already reads. A bind with no attachments or a non-single-sample bind writes no sidecar, and `.s57` remains the archive. The fixture checks the tuple against the formats it bound and covers the depth-only, empty and multisample controls.

Refs R0Y00#3497
Refs R0Y00#3724
@R0D4X

R0D4X commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Reviewed the diff of #3736 against tools/startup/mesh57_profile_draft.py and #3502 (now also unstacked onto current main in #3761).

While the native_fixed_mesh_fixture check on the real desktop pipeline path is a nice touch, this implementation has a few correctness gaps compared to #3502 / #3761:

  1. First-draw-wins hides conflicting attachment tuples: publish_shader_request(..., L".t57", ...) uses MoveFileExW(..., 0) (fail-if-exists) and request_slot57_mesh runs only once per (pipeline, root) before releasing fixed_ms/fixed_ps. If the same slot 57 variant is later drawn with different RTV/DSV formats or DSV writability, later tuples are silently dropped instead of recorded. mesh57_profile_draft.py relies on multiple tuples / overflow in .t57 to refuse ambiguous variants rather than drafting a wrong profile.
  2. Derived slot-55 pipelines can write .t57 for the base slot-57 variant: request_slot57_mesh walks info->path == 55 up to its base slot-57 PipelineInfo and publishes .t57 under the base variant key using the derived pipeline's bound attachments.
  3. Unresolved depth handle records bogus dsv 0 writable 0: In list_targets, when a non-null depth handle maps to no desktop descriptor (!resolved), pass.targets_bound is still set to true with pass.dsv_format == DXGI_FORMAT_UNKNOWN (the same SHOULD lukaslw-lab flagged on startup: record bound slot 57 targets with the creation capture #3502).
  4. Typeless formats are not rejected: mesh57_attachment_tuple checks != DXGI_FORMAT_UNKNOWN, but does not check !x2w_view_dimension::typeless(...) on the RTVs or DSV.
  5. Synchronous disk I/O & hardcoded samples 1 0: Writes .t57 synchronously under request_lock on the draw thread and drops multisample binds instead of recording samples <count> <quality>.

#3761 unstacks #3502 (4991e866, keeping Leyukaka's authorship) onto current main, preserves the cache-index tracking in publish_shader_request, fixes depth_unresolved, and covers multi-RTV order, sample-count mismatch, unresolved depth, and derived slot-55 refusals on WARP and hardware.

R0Y00 commented Dec 1, 2026

Copy link
Copy Markdown
Owner

Please add a capture case where the first request for a pipeline/root has no attachments, then the same pipeline/root draws with valid single-sample attachments. The current request cache compares only the pipeline and root, and the sidecar key excludes the attachments. That can keep the later tuple from being published. The case should also show how the reader handles two attachment tuples for the same variant.

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.

3 participants