Skip to content

D3d 725 vk suboptimal fix - #7432

Open
VoidxNullx wants to merge 4 commits into
ItsNotRexed:mainfrom
VoidxNullx:d3d-725-vk-suboptimal-fix
Open

VoidxNullx wants to merge 4 commits into
ItsNotRexed:mainfrom
VoidxNullx:d3d-725-vk-suboptimal-fix

Conversation

@VoidxNullx

Copy link
Copy Markdown

Claimed in the coordination issue as:

Depends on:

What and why

Tested

AI-assisted:

Checklist

  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed.

…oss-check

The parse_scarab_* functions could raise OSError (file access),
UnicodeDecodeError (invalid UTF-8), and ValueError (malformed hex
in int(x, 16)) which propagated uncaught and crashed the tool.

Wrap each parse call in check_scarab() with try/except and convert
exceptions to proper error messages in the returned errors list.

Fixes BUILD-1628.
…ebuild

VK_SUBOPTIMAL_KHR means the swapchain is still usable but not optimal
(e.g., after a resize that hasn't been processed yet). It does NOT
require a rebuild — only VK_ERROR_OUT_OF_DATE_KHR does.

Previously, stale_ was set to true on VK_SUBOPTIMAL_KHR, causing an
unnecessary swapchain recreate (with queue idle) on every subsequent
frame. The finder's test showed 12 rebuilds and 12 queue-idle calls
for 12 advisories; this fix brings both to zero.

Fixes D3D-725.
@RAINighty

Copy link
Copy Markdown

I ran this against the test added in #7391 (vk_presenter_sync_test, step "12 SUBOPTIMAL results on an unchanged surface") on Windows 11 (10.0.26300), RTX 5060 Laptop GPU (driver 32.0.16.2124), MSVC 19.44.35228, RelWithDebInfo, validation on.

With this PR's runtime/src/vulkan_present.h and #7391's test, the test fails exactly as it does on the merge base (line 575: driver::swapchain_creates.load() == 0), so the swapchain is still rebuilt on an unchanged surface.

Likely reason: the change drops stale_ = true for SUBOPTIMAL from vkAcquireNextImageKHR only. The present side (result == VK_ERROR_OUT_OF_DATE_KHR || result == VK_SUBOPTIMAL_KHR → stale_ = true, line 607 in this PR's file) is unchanged, and it triggers the same recreate on the next frame. Removing it as well would also stop a resize that only reports SUBOPTIMAL from ever rebuilding, which #7344 and #7391 handle in different ways.

Also: the PR template is not filled in (no claim link, no "Tested" section, no AI-assisted line), and the tools/d3d12_xs_surface.py changes look unrelated to D3D-725; they may be better as their own PR.

AI-assisted (Claude Code).

The acquire side fix (commit ed01b02) was incomplete - the present side
also set stale_ = true on VK_SUBOPTIMAL_KHR at line 607, causing the
swapchain to still be rebuilt every frame.

Now both paths correctly treat VK_SUBOPTIMAL_KHR as usable (no rebuild).
Only VK_ERROR_OUT_OF_DATE_KHR triggers a rebuild.

AI-assisted (Claude Code).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants