diff options
| author | Ryderadzeee <craftercrashonname@gmail.com> | 2026-11-22 18:06:12 +0400 |
|---|---|---|
| committer | Ryderadzeee <craftercrashonname@gmail.com> | 2026-11-22 18:06:12 +0400 |
| commit | e6bb76cd58b9280cac345e576235f0602d67cd19 (patch) | |
| tree | c2644af768ec0d7e0b5352bbdacd02d94b46c390 /runtime/shims/dxgi_com.cpp | |
| parent | 89b047cd8fab50675a43d76722a6a8a881f55dc2 (diff) | |
Reject changes to DXGI swapchain creation flags on resize
Diffstat (limited to 'runtime/shims/dxgi_com.cpp')
| -rw-r--r-- | runtime/shims/dxgi_com.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/runtime/shims/dxgi_com.cpp b/runtime/shims/dxgi_com.cpp index af3b96679..6d2e3e6fb 100644 --- a/runtime/shims/dxgi_com.cpp +++ b/runtime/shims/dxgi_com.cpp | |||
| @@ -239,6 +239,9 @@ public: | |||
| 239 | vk_fmt = dxgi_to_vk_format(fmt); | 239 | vk_fmt = dxgi_to_vk_format(fmt); |
| 240 | if (vk_fmt == VK_FORMAT_UNDEFINED) return DXGI_ERROR_UNSUPPORTED; | 240 | if (vk_fmt == VK_FORMAT_UNDEFINED) return DXGI_ERROR_UNSUPPORTED; |
| 241 | } | 241 | } |
| 242 | constexpr UINT creation_only_flags = DXGI_SWAP_CHAIN_FLAG_FRAME_LATENCY_WAITABLE_OBJECT | | ||
| 243 | DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING; | ||
| 244 | if ((flags & creation_only_flags) != (flags_ & creation_only_flags)) return E_INVALIDARG; | ||
| 242 | // DXGI refuses to resize while the app still holds a back buffer reference. | 245 | // DXGI refuses to resize while the app still holds a back buffer reference. |
| 243 | for (auto* bb : buffers_) | 246 | for (auto* bb : buffers_) |
| 244 | if (bb->held_by_app()) return DXGI_ERROR_INVALID_CALL; | 247 | if (bb->held_by_app()) return DXGI_ERROR_INVALID_CALL; |
| @@ -246,8 +249,7 @@ public: | |||
| 246 | const VkExtent2D size = size_or_client(width, height, swapchain_.extent()); | 249 | const VkExtent2D size = size_or_client(width, height, swapchain_.extent()); |
| 247 | const std::uint32_t w = size.width; | 250 | const std::uint32_t w = size.width; |
| 248 | const std::uint32_t h = size.height; | 251 | const std::uint32_t h = size.height; |
| 249 | const UINT waitable_bit = flags_ & DXGI_SWAP_CHAIN_FLAG_FRAME_LATENCY_WAITABLE_OBJECT; | 252 | const UINT next_flags = flags ? flags : flags_; |
| 250 | const UINT next_flags = (flags ? flags : flags_) | waitable_bit; | ||
| 251 | const bool allow_tearing = (next_flags & DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING) != 0; | 253 | const bool allow_tearing = (next_flags & DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING) != 0; |
| 252 | if (!swapchain_.resize(w, h, vk_fmt, count, allow_tearing)) return E_FAIL; | 254 | if (!swapchain_.resize(w, h, vk_fmt, count, allow_tearing)) return E_FAIL; |
| 253 | flags_ = next_flags; | 255 | flags_ = next_flags; |