startup: every constant buffer view and descriptor copy goes through the stand-in, and it costs frame rate #3428

Closed
opened 2026-11-29 01:37:54 +00:00 by lukaslw-lab · 0 comments
lukaslw-lab commented 2026-11-29 01:37:54 +00:00 (Migrated from github.com)
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by lukaslw-lab on 2026-11-29T01:37:54Z.


Since #3211 the stand-in sets byte +0x18 of the guest device, so the title calls device slot 17 for every constant
buffer view and slot 24 for every CopyDescriptorsSimple instead of writing the descriptors itself. In
the main executable's startup run (#870) copies are one of the two note_lock writers: #3390 measured ~59,000
exclusive note_copy takes per second late in the load, next to ~118,000 view creations.

The stand-in does not need these calls:

  • Constant buffer views written by the title are hardware buffer descriptors, which the draw and compute buffer
    readers already decode (the branch of indirect_table_buffer for words that are not a view token).
  • Texture views still go through slot 18, so their tokens still name view records; a copy the title makes of one is
    a plain copy of the token.
  • The one thing that relies on the copies is X2W_D3D12_RELEASE_RETIRED: retire_view_refs counts descriptor slots
    that name a released texture. With copies made in title memory, nothing counts them. D3D12 leaves this to the
    application (a resource must stay alive while its descriptors are in use), and the stand-in never frees a wrapper,
    so a stale token binds null rather than another resource.

Measured with the byte left at 0 and retirement at the release fences (proposed in #3429): Windows 10 22H2,
i7-4790K, RTX 3080 Ti, NVIDIA 32.0.16.1047, release, main 212d4b5f, merged switches (#2949, #2977, #3028, #3313),
250 s, scripted input, two pairs (off/on/on/off):

loaded blocks 75–100k 100–125k 125–150k 150–175k 175–200k
fps, byte set 11.0 / 12.5 13.1 / 13.9 12.6 / 12.2 9.4 / 10.0 7.4 / 9.1
fps, byte 0 16.1 / 16.4 16.3 / 16.1 14.6 / 13.6 12.5 / 11.2 10.3 / –
title CPU ms per frame, byte set 359 / 297 320 / 328 410 / 391 476 / 465 542 / 496
title CPU ms per frame, byte 0 276 / 218 290 / 258 315 / 339 380 / 392 437 / –

Null bindings per 1,000 draws, refusals and retained texture memory stay in the same range; no device removal.

This report was prepared with AI assistance (Claude); the runs are mine.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6673511198 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/3428). Originally posted by [lukaslw-lab](https://github.com/lukaslw-lab) on 2026-11-29T01:37:54Z. --- Since #3211 the stand-in sets byte +0x18 of the guest device, so the title calls device slot 17 for every constant buffer view and slot 24 for every `CopyDescriptorsSimple` instead of writing the descriptors itself. In the main executable's startup run (#870) copies are one of the two `note_lock` writers: #3390 measured ~59,000 exclusive `note_copy` takes per second late in the load, next to ~118,000 view creations. The stand-in does not need these calls: - Constant buffer views written by the title are hardware buffer descriptors, which the draw and compute buffer readers already decode (the branch of `indirect_table_buffer` for words that are not a view token). - Texture views still go through slot 18, so their tokens still name view records; a copy the title makes of one is a plain copy of the token. - The one thing that relies on the copies is `X2W_D3D12_RELEASE_RETIRED`: `retire_view_refs` counts descriptor slots that name a released texture. With copies made in title memory, nothing counts them. D3D12 leaves this to the application (a resource must stay alive while its descriptors are in use), and the stand-in never frees a wrapper, so a stale token binds null rather than another resource. Measured with the byte left at 0 and retirement at the release fences (proposed in #3429): Windows 10 22H2, i7-4790K, RTX 3080 Ti, NVIDIA 32.0.16.1047, release, `main` `212d4b5f`, merged switches (#2949, #2977, #3028, #3313), 250 s, scripted input, two pairs (off/on/on/off): | loaded blocks | 75–100k | 100–125k | 125–150k | 150–175k | 175–200k | |---|---|---|---|---|---| | fps, byte set | 11.0 / 12.5 | 13.1 / 13.9 | 12.6 / 12.2 | 9.4 / 10.0 | 7.4 / 9.1 | | fps, byte 0 | 16.1 / 16.4 | 16.3 / 16.1 | 14.6 / 13.6 | 12.5 / 11.2 | 10.3 / – | | title CPU ms per frame, byte set | 359 / 297 | 320 / 328 | 410 / 391 | 476 / 465 | 542 / 496 | | title CPU ms per frame, byte 0 | 276 / 218 | 290 / 258 | 315 / 339 | 380 / 392 | 437 / – | Null bindings per 1,000 draws, refusals and retained texture memory stay in the same range; no device removal. This report was prepared with AI assistance (Claude); the runs are mine.
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
R0Y00/Xbox2Windows#3428
No description provided.