Skip to content

Title textures: what the CPU spends per texture before the GPU copy (numbers, and who does what) #449

Backlog

Description

@Kalmarv

Measurements only, no code of ours. Measured on main a6f5f7a, release, one thread, Ryzen 9 9950X, synthetic textures only:

  1. Detile first, and gw1337x's change does it. Their diff from KernelX / title textures: a GPU view of the title's CPU memory reads the CPU view (retail intro video, no green screen) #283 (comment) applies to a6f5f7a unchanged and its test passes here (gpu::tiling::: 12 passed, 0 failed). Thanks @gw1337x for posting it. After it a video plane detiles as fast as it is read, so threads or detiling on the GPU would buy little there.
  2. Then the layout tables. xg::Texture::new takes about 0.3 ms whatever the texture's size, and CreatePlacedResourceX builds it twice (device_x.rs, title_textures::register). For a BC7 256² with mips that is 0.6 ms, against 0.04 ms of detile and 0.34 ms of upload. Caching Layout::from_bits, as @notdxbi describes in Linux (Wine + vkd3d-proton): a retail game reaches what main reaches on Windows; the obstacle is replaced vtables — proposal: proxies #175 (comment), would remove most of it.
  3. The upload path is @Cattn's PR (Sparse windows: CPU-write uploads run beside the title queue's writes (debug layer 1047); waiting for that queue would deadlock #262 (comment)) and gw1337x has a diff. Numbers below for reference only.
CPU, one thread, MiB/s of texels out main + gw1337x's diff
R8 3840×2160 linear (a video plane): detile_level 119 (66 ms a plane) 9 390 (0.8 ms)
RGBA8 2048² / 1024² with mips, 4KB_S 379 / 416 1 478 / 1 958
BC1 4096² … 256² with mips 764 … 1 004 1 914 … 4 906
BC7 4096² … 256² with mips (4KB_S; 64KB_S, 64KB_S_X and 64KB_D_X at 2048² are close to it) 1 174 … 1 995 2 524 … 10 859
2 000 BCn textures with mips, 64² to 4096² (mostly small), 1 044 MiB: layout / read copy / detile 642 / 99 / 1 018 ms 620 / 104 / 408 ms

Upload path (texture::upload_batch, RTX 5070 Ti, driver 610.74, idle GPU with free memory): a new allocator and list 0.08 ms; a new upload buffer 0.3 ms at 64 KiB, 0.6 ms at 1 MiB, 5.6 ms at 16 MiB; the CPU wait on an idle queue 0.003 ms. A BC7 256² with mips costs 0.34 ms in a batch of 512 and 0.62 ms as a batch of its own; a video frame (three R8 planes, 11.9 MiB) 6.8 ms. So on an idle GPU the per-texture cost is the upload buffer, and the long waits reported need video memory past the card, which this does not reproduce.

Not tested: a retail title, AMD, more than one thread, a debug build, 3D textures (detile_volume is unchanged by the diff).

🤖 Claude Fable 5.2

Activity

  1. DarX-Oren commented on Nov 24, 2026

    @DarX-Oren

    Independent RDNA2 benchmark — RX 6700 XT

    Environment:

    • GPU: AMD RX 6700 XT (12 GB, RDNA2)
    • CPU: Ryzen 5 5600
    • RAM: 32 GB
    • Driver: 32.0.21045.29003
    • Upstream commit: 508a0c7
    • Release build

    Five runs, 50 measured pairs, alternating upload order, with 64 identical BC7 textures per measurement.

    Upload mode Median Min–max Sample SD
    Individual 198.38 ms 193.76–207.80 ms 2.74 ms
    Batched 60.71 ms 58.42–71.52 ms 2.85 ms

    Batching reduced median upload time by 69.4%.

    Additional findings

    • Fence waits: 64 → 1.
    • Host synchronization: 44.66 → 0.35 ms.
    • Upload buffer allocations: 64 in both modes.
    • Sampled local VRAM: unchanged at 19.61 MB.
    • Sampled nonlocal memory: 1.48 → 7.41 MB.

    Correctness was verified through GPU readback of all 5,594,112 bytes across 576 mip subresources after changing the source data.

    I also tested a write-only Map hint, but it regressed batched performance in five of six paired runs, so I am not proposing a patch.

    These are synthetic benchmark results, not measured in-game FPS improvements.

    Benchmark source and raw logs are available if needed. Happy to investigate further RDNA2-specific performance issues.

    AI use: OpenAI Codex (GPT-6) assisted with benchmark implementation, profiling and testing on physical hardware.

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