Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/HansKristian-Work/vkd3d-proton.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans-Kristian Arntzen <post@arntzen-software.no>2022-10-07 22:05:08 +0300
committerHans-Kristian Arntzen <post@arntzen-software.no>2022-10-07 22:25:47 +0300
commitc42f24a2b0da37f03758f1ab97f3fa98b082c2e0 (patch)
tree7af2742abd20930b1a16e6af545bdb1a47c2147f
parent8464a4459351c09438279e10ea615b9ef592123d (diff)
vkd3d: Reset current_buffer_index when changing swapchain size.
If application lowers the count, we might access resources out of bounds later. Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
-rw-r--r--libs/vkd3d/swapchain.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/libs/vkd3d/swapchain.c b/libs/vkd3d/swapchain.c
index 099554d9..69988164 100644
--- a/libs/vkd3d/swapchain.c
+++ b/libs/vkd3d/swapchain.c
@@ -2304,7 +2304,16 @@ static HRESULT d3d12_swapchain_resize_buffers(struct d3d12_swapchain *swapchain,
new_desc = swapchain->desc;
if (buffer_count)
+ {
+ if (swapchain->current_buffer_index >= buffer_count)
+ {
+ /* Current buffer index may overflow here, so reset it. */
+ swapchain->current_buffer_index = 0;
+ WARN("Resetting current buffer index due to future overflow.\n");
+ }
new_desc.BufferCount = buffer_count;
+ }
+
if (!width || !height)
{
RECT client_rect;