Skip to content

d3d12_xs: no GPU timestamp on a COPY list; depth bounds survive a list cut (RT-XS-LIST-VALUES-COPY-TIMESTAMP-AND-DEPTH-BOUNDS) - #2500

Open
Tyrannys wants to merge 1 commit into
ProjectLeonida:mainfrom
Tyrannys:rt-xs-list-values-copy-timestamp-depth-bounds
Open

Tyrannys wants to merge 1 commit into
ProjectLeonida:mainfrom
Tyrannys:rt-xs-list-values-copy-timestamp-depth-bounds

Conversation

@Tyrannys

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as: RT-XS-LIST-VALUES-COPY-TIMESTAMP-AND-DEPTH-BOUNDS (#1608 (comment))

What and why

Item 3 of @kevincommits' finding in #1608 (#1608 (comment)). Thanks for the audit.

COPY-list timestamps. take_timestamp (d3d12_xs_device.cpp) recorded EndQuery and ResolveQueryData on the device's D3D12_QUERY_HEAP_TYPE_TIMESTAMP heap for every list that tracks values, and COPY lists track them too. A COPY list needs a COPY_QUEUE_TIMESTAMP heap: the layer's CommandQueue::timestamps_fit() refuses the whole COPY submission (invalid_query), and Windows' D3D12 validation flags it. A timestamp write (write64 flag 1 or 2) on a COPY list now takes the CPU's clock when it lands, the fallback the code already has for a device without the heap. DIRECT and COMPUTE lists keep the GPU's timestamp.

A separate COPY_QUEUE_TIMESTAMP heap per device would keep GPU timing on copy lists. That is left for later: it needs a second heap and readback, and the copy queue's clock calibration.

Depth bounds across a list cut. OMSetDepthBoundsX (console slot 70, PC slot 62) was forwarded to the real list but not kept in list_values::ListState. Any draw after a list cut (a wait after work), and any list after ExecuteBundle of a bundle that set them, went back to D3D12's default [0, 1]. ListState now records the bounds once the real list has taken them, clears them on Reset like the rest, inherits a bundle's, and replays them after a cut (through slot 62 of the new real list, which is the same kind of list).

Overlap: #2484 (RT-XS-LATE-RELAY, list values) touches the same three files on other lines; git merge-tree finds no conflict. The new test sits beside check_list_values, not in it, and runs between it and check_list_values_more, while the list-values threads are up. No conflict with #2498 either (the descriptor-mirror item, same files).

Tested

Windows 11, MSVC (VS 18), RelWithDebInfo, on main 43a9d56. CPU only.

The mock list now answers GetType (slot 8) with the type it was created with, and records slot 62's float arguments. xs_proxy_mock_test gains check_list_values_copy_and_depth_bounds:

  1. A write64 timestamp on a COPY list records no EndQuery or ResolveQueryData, while a DIRECT list still records both, with the TIMESTAMP query type.
  2. Depth bounds:
    • set, then work and an unmet wait: the spare list the cut moves to gets OMSetDepthBounds(0.25, 0.75) again;
    • after a Reset, the next cut does not set them;
    • a bundle's (0.125, 0.5) executed in the list is replayed after its cut.

With main's shims the test fails at the COPY check. With only the ListState recording line removed, it fails at the first replay check. With the fix it passes.

  • ctest -R "^(xs_proxy_mock.*|device_proxy)$": 10/10 pass.
  • scripts/check_no_game_data.py: clean.

GPUs tested: profile M: NVIDIA GeForce RTX 4070 SUPER, 12 GB, desktop, driver 621.01, Windows 11 (CPU tests only)

AI-assisted: yes (Claude Code)

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a: no translator change)

🤖 Generated with Claude Code

…t cut

Two gaps in console list values:

- take_timestamp recorded EndQuery and ResolveQueryData on the device's TIMESTAMP query heap for any
  list that tracks values, COPY lists included. A COPY list needs a COPY_QUEUE_TIMESTAMP heap, so the
  queue refused the whole submission (and D3D12 validation flags it). A timestamp write on a COPY
  list now takes the CPU's clock when it lands, the existing fallback.
- OMSetDepthBoundsX (console slot 70 -> PC slot 62) was forwarded but not kept in ListState. A draw
  after a list cut, and in a list after ExecuteBundle, ran with the default [0, 1] bounds. ListState
  now records the bounds once the real list took them, inherits them from a bundle and replays them
  after a cut.

From kevincommits' finding in ProjectLeonida#1608 (item 3). xs_proxy_mock_test gains
check_list_values_copy_and_depth_bounds. The mock list now answers GetType with its creation type and
captures slot 62's float arguments.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant