startup: texture uploads report success when staging fails, and video-sized textures share one upload ring #2847

Open
opened 2026-11-26 14:29:41 +00:00 by tedin7 · 1 comment
tedin7 commented 2026-11-26 14:29:41 +00:00 (Migrated from github.com)
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T14:29:41Z.


Part of #870

Related: #2837, #2849 (upload ring recycling).

Problem 1: false success. upload_texture (src/startup_stubs/d3d12_draw.inl) returns true with state.done = false at five exits when the upload ring cannot stage a level. The caller treats true as "uploaded", so a draw samples, or a copy reads, a desktop texture that holds none or only some of its levels, and nothing retries it until the title memory changes.

Problem 2: large CPU textures use the shared ring. A linear title texture of 1 MiB or more (for example the planes of a 1920x1080 video frame, about 12 MiB per frame) is copied through the same transient upload ring as everything else. A burst of such uploads can exhaust or retire the ring while other uploads are in flight.

Expected.

  1. A level that cannot be staged makes upload_texture return false. A draw then binds no texture, a copy from the title texture is refused (title_backed_source, and source_not_uploaded for CopyTextureRegion), and the next bind retries every level.
  2. A linear texture of 1 MiB or more is filled from its own upload buffer, which lives until the copy has executed.

Tests. startup_slot133_heap_cap_check gains a video variant (40 textures of 1920x1080 RGBA8, both corners read back) and a stagefail variant (three-level texture, forced staging failure, then retry; lazy textures off and on). Fixture-only switch: X2W_TEST_UPLOAD_STAGING_FAIL=<n>.

Out of scope. Ring recycling itself (#2849).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6628809840 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2855). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-26T14:29:41Z. --- Part of #870 Related: #2837, #2849 (upload ring recycling). **Problem 1: false success.** `upload_texture` (src/startup_stubs/d3d12_draw.inl) returns `true` with `state.done = false` at five exits when the upload ring cannot stage a level. The caller treats `true` as "uploaded", so a draw samples, or a copy reads, a desktop texture that holds none or only some of its levels, and nothing retries it until the title memory changes. **Problem 2: large CPU textures use the shared ring.** A linear title texture of 1 MiB or more (for example the planes of a 1920x1080 video frame, about 12 MiB per frame) is copied through the same transient upload ring as everything else. A burst of such uploads can exhaust or retire the ring while other uploads are in flight. **Expected.** 1. A level that cannot be staged makes `upload_texture` return `false`. A draw then binds no texture, a copy from the title texture is refused (`title_backed_source`, and `source_not_uploaded` for CopyTextureRegion), and the next bind retries every level. 2. A linear texture of 1 MiB or more is filled from its own upload buffer, which lives until the copy has executed. **Tests.** `startup_slot133_heap_cap_check` gains a `video` variant (40 textures of 1920x1080 RGBA8, both corners read back) and a `stagefail` variant (three-level texture, forced staging failure, then retry; lazy textures off and on). Fixture-only switch: `X2W_TEST_UPLOAD_STAGING_FAIL=<n>`. **Out of scope.** Ring recycling itself (#2849).
tedin7 commented 2026-11-26 15:00:59 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T14:29:43Z.


Claiming this; a Draft PR follows after a confirming run.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7194901357 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2855#issuecomment-7194901357). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-26T14:29:43Z. --- Claiming this; a Draft PR follows after a confirming run.
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#2847
No description provided.