upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/runtime/shims/dxgi_com.cpp
diff options
context:
space:
mode:
authorLukeOsland1 <85672257+LukeOsland1@users.noreply.github.com>2026-11-23 22:07:12 +0000
committerLukeOsland1 <85672257+LukeOsland1@users.noreply.github.com>2026-11-23 22:07:12 +0000
commitaf98770ba1974a2bbb2960bfbff38cec945b03ee (patch)
tree007ca447b59aa33bb5db3232d2cd1a8465da7195 /runtime/shims/dxgi_com.cpp
parentdbadb08b1509f47fd89b6f56628210d9693547a1 (diff)
Match DXGI error precedence for mixed resize flags
Diffstat (limited to 'runtime/shims/dxgi_com.cpp')
-rw-r--r--runtime/shims/dxgi_com.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/runtime/shims/dxgi_com.cpp b/runtime/shims/dxgi_com.cpp
index b1a5769fd..c8e55d3ba 100644
--- a/runtime/shims/dxgi_com.cpp
+++ b/runtime/shims/dxgi_com.cpp
@@ -357,17 +357,18 @@ public:
357 vk_fmt = dxgi_to_vk_format(fmt); 357 vk_fmt = dxgi_to_vk_format(fmt);
358 if (vk_fmt == VK_FORMAT_UNDEFINED) return E_INVALIDARG; 358 if (vk_fmt == VK_FORMAT_UNDEFINED) return E_INVALIDARG;
359 } 359 }
360 // Host-measured on a chain created with flags 0 (RTX 5070 Ti and WARP, Windows 11): NONPREROTATED, 360 // DXGI first checks creation-dependent flags against the chain's original flags. If one is missing, this
361 // FULLSCREEN_VIDEO and every bit from 0x4000 up are DXGI_ERROR_INVALID_CALL; FOREGROUND_LAYER, YUV_VIDEO and 361 // E_INVALIDARG wins even when the same call also includes flags that independently return INVALID_CALL.
362 // 0x2000 are E_INVALIDARG, as a waitable or tearing flag the chain wasn't created with is.
363 constexpr UINT refused_flags = ~0x3fffu | DXGI_SWAP_CHAIN_FLAG_NONPREROTATED |
364 DXGI_SWAP_CHAIN_FLAG_FULLSCREEN_VIDEO;
365 if (flags & refused_flags) return DXGI_ERROR_INVALID_CALL;
366 constexpr UINT creation_only_flags = DXGI_SWAP_CHAIN_FLAG_FRAME_LATENCY_WAITABLE_OBJECT | 362 constexpr UINT creation_only_flags = DXGI_SWAP_CHAIN_FLAG_FRAME_LATENCY_WAITABLE_OBJECT |
367 DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING | 363 DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING |
368 DXGI_SWAP_CHAIN_FLAG_FOREGROUND_LAYER | DXGI_SWAP_CHAIN_FLAG_YUV_VIDEO | 364 DXGI_SWAP_CHAIN_FLAG_FOREGROUND_LAYER | DXGI_SWAP_CHAIN_FLAG_YUV_VIDEO |
369 0x2000u; 365 0x2000u;
370 if ((flags & creation_only_flags) != (flags_ & creation_only_flags)) return E_INVALIDARG; 366 if ((flags & creation_only_flags) != (flags_ & creation_only_flags)) return E_INVALIDARG;
367 // On a chain whose creation flags match, NONPREROTATED, FULLSCREEN_VIDEO and every bit from 0x4000 up are
368 // DXGI_ERROR_INVALID_CALL (host-measured on Windows 11 with the RTX 5070 Ti and WARP).
369 constexpr UINT refused_flags = ~0x3fffu | DXGI_SWAP_CHAIN_FLAG_NONPREROTATED |
370 DXGI_SWAP_CHAIN_FLAG_FULLSCREEN_VIDEO;
371 if (flags & refused_flags) return DXGI_ERROR_INVALID_CALL;
371 // DXGI refuses to resize while the app still holds a back buffer reference. 372 // DXGI refuses to resize while the app still holds a back buffer reference.
372 for (auto* bb : buffers_) 373 for (auto* bb : buffers_)
373 if (bb->held_by_app()) return DXGI_ERROR_INVALID_CALL; 374 if (bb->held_by_app()) return DXGI_ERROR_INVALID_CALL;