Skip to content

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

Done

Description

@lukaslw-lab

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 up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions