OLD-8171: a failed ResizeBuffers leaves the swap chain without buffers until the next one succeeds, as on the host #389

Merged
lines9686-rgb merged 3 commits from upstream-pr/389 into main 2026-11-24 05:09:52 +00:00
lines9686-rgb commented 2026-11-24 04:24:13 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by lines9686-rgb on 2026-11-24T04:24:13Z.


Claimed in the coordination issue as: OLD-8171 (carried over from the original repository, same author)

What and why

On the host, once ResizeBuffers accepts its arguments the old buffers are gone. When the new ones cannot be made the call fails and the swap chain stays without buffers: its description already reports the new size, count and format, GetBuffer and Present are DXGI_ERROR_INVALID_CALL, and the next successful ResizeBuffers brings it back. A side above 16384 is E_INVALIDARG on a hardware device. The layer kept the old buffers instead, so a title that recovers by resizing again saw different answers than on Windows.

dxgi_com.cpp now models that state (lost_): GetDesc/GetDesc1 report the requested description, Present and GetBuffer refuse, SetSourceSize checks against the requested size, a side above 16384 is E_INVALIDARG, and a Vulkan failure is E_OUTOFMEMORY.

Rebased on this main: on main every chain is the offscreen ring, so the two fake-table cases that expected the direct path now expect the ring with matching counts.

Tested

Windows 11, RTX 3060 Ti, NVIDIA 621.24, MSVC:

  • dxgi_swapchain_test: PASS. Its new step compares 17 steps of a failed resize and the recovery with the host runtime: 0 mismatches (Present answering DXGI_STATUS_OCCLUDED for a window off screen counts as S_OK).
  • dxgi_swapchain_count_test: PASS, with 4 failed-resize cases: vkCreateSwapchainKHR fails or the new ring fails, with and without extra native images. Each case checks that the next resize builds a working swap chain.

GPUs tested: NVIDIA GeForce RTX 3060 Ti, driver 621.24, Windows 11

AI-assisted: yes (Claude Code)

Checklist

  • Based on current main and merges cleanly.
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (scripts/check_no_game_data.py over every changed file: clean).
  • A new translator rule is in the contract table of docs/design.md: n/a

🤖 Generated with Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5466051937 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/389). Originally posted by [lines9686-rgb](https://github.com/lines9686-rgb) on 2026-11-24T04:24:13Z. --- Claimed in the coordination issue as: `OLD-8171` (carried over from the original repository, same author) ### What and why On the host, once `ResizeBuffers` accepts its arguments the old buffers are gone. When the new ones cannot be made the call fails and the swap chain stays without buffers: its description already reports the new size, count and format, `GetBuffer` and `Present` are `DXGI_ERROR_INVALID_CALL`, and the next successful `ResizeBuffers` brings it back. A side above 16384 is `E_INVALIDARG` on a hardware device. The layer kept the old buffers instead, so a title that recovers by resizing again saw different answers than on Windows. `dxgi_com.cpp` now models that state (`lost_`): `GetDesc`/`GetDesc1` report the requested description, `Present` and `GetBuffer` refuse, `SetSourceSize` checks against the requested size, a side above 16384 is `E_INVALIDARG`, and a Vulkan failure is `E_OUTOFMEMORY`. Rebased on this `main`: on `main` every chain is the offscreen ring, so the two fake-table cases that expected the direct path now expect the ring with matching counts. ### Tested Windows 11, RTX 3060 Ti, NVIDIA 621.24, MSVC: - `dxgi_swapchain_test`: PASS. Its new step compares 17 steps of a failed resize and the recovery with the host runtime: 0 mismatches (`Present` answering `DXGI_STATUS_OCCLUDED` for a window off screen counts as `S_OK`). - `dxgi_swapchain_count_test`: PASS, with 4 failed-resize cases: `vkCreateSwapchainKHR` fails or the new ring fails, with and without extra native images. Each case checks that the next resize builds a working swap chain. GPUs tested: NVIDIA GeForce RTX 3060 Ti, driver 621.24, Windows 11 AI-assisted: yes (Claude Code) ### Checklist - [x] Based on current `main` and merges cleanly. - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (`scripts/check_no_game_data.py` over every changed file: clean). - [x] A new translator rule is in the contract table of `docs/design.md`: n/a 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign in to join this conversation.
No reviewers
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
ProjectLeonida/mandy!389
No description provided.