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

Closed
opened 2026-11-26 20:17:53 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/389
Author: @lines9686-rgb
Created: 11/24/2026
Status: ✅ Merged
Merged: 11/24/2026
Merged by: @ubiquitarianism

Base: main ← Head: dxgi-resizebuffers-lost


📝 Commits (3)

  • a3090aa dxgi: a failed ResizeBuffers leaves the swap chain without buffers until the next one succeeds, as on the host
  • 3746bff dxgi: SetSourceSize checks the requested size after a failed ResizeBuffers; the comparison treats DXGI_STATUS_OCCLUDED as S_OK
  • eeeda84 dxgi_swapchain_count_test: every chain is the offscreen ring on main now, so the failed-resize cases with matching counts expect it too

📊 Changes

3 files changed (+287 additions, -18 deletions)

View changed files

📝 runtime/shims/dxgi_com.cpp (+52 -13)
📝 runtime/test/dxgi_swapchain_count_test.cpp (+100 -5)
📝 runtime/test/dxgi_swapchain_test.cpp (+135 -0)

📄 Description

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


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/389 **Author:** [@lines9686-rgb](https://github.com/lines9686-rgb) **Created:** 11/24/2026 **Status:** ✅ Merged **Merged:** 11/24/2026 **Merged by:** [@ubiquitarianism](https://github.com/ubiquitarianism) **Base:** `main` ← **Head:** `dxgi-resizebuffers-lost` --- ### 📝 Commits (3) - [`a3090aa`](https://github.com/ubiquitarianism/leonida/commit/a3090aab2d29bb859a87bfb22dc38a994629054a) dxgi: a failed ResizeBuffers leaves the swap chain without buffers until the next one succeeds, as on the host - [`3746bff`](https://github.com/ubiquitarianism/leonida/commit/3746bff239520d94d11251dd35df750c0345ecf6) dxgi: SetSourceSize checks the requested size after a failed ResizeBuffers; the comparison treats DXGI_STATUS_OCCLUDED as S_OK - [`eeeda84`](https://github.com/ubiquitarianism/leonida/commit/eeeda84c90898986a0644fc81eb0cf413cd83572) dxgi_swapchain_count_test: every chain is the offscreen ring on main now, so the failed-resize cases with matching counts expect it too ### 📊 Changes **3 files changed** (+287 additions, -18 deletions) <details> <summary>View changed files</summary> 📝 `runtime/shims/dxgi_com.cpp` (+52 -13) 📝 `runtime/test/dxgi_swapchain_count_test.cpp` (+100 -5) 📝 `runtime/test/dxgi_swapchain_test.cpp` (+135 -0) </details> ### 📄 Description 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) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
4ld0 2026-11-26 20:17:53 +01:00
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
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.

Dependencies

No dependencies set

Reference
starred/leonida#442
No description provided.