From accf300c6c27efce8a53c809c37fac629c569202 Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Wed, 15 Nov 2023 17:31:10 +1100 Subject: [PATCH] [host] dxgi: fix failure to reset texture state on fast restarts --- host/platform/Windows/capture/DXGI/src/dxgi.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/host/platform/Windows/capture/DXGI/src/dxgi.c b/host/platform/Windows/capture/DXGI/src/dxgi.c index 3a79fb67..8d7649c7 100644 --- a/host/platform/Windows/capture/DXGI/src/dxgi.c +++ b/host/platform/Windows/capture/DXGI/src/dxgi.c @@ -885,11 +885,20 @@ static bool dxgi_deinit(void) for (int i = 0; i < this->maxTextures; ++i) { Texture * tex = &this->texture[i]; - if (!tex->map) - continue; - this->backend->unmapTexture(i); - tex->map = NULL; - tex->state = TEXTURE_STATE_UNUSED; + switch(tex->state) + { + case TEXTURE_STATE_MAPPED: + this->backend->unmapTexture(i); + tex->map = NULL; + //fallthrough + + case TEXTURE_STATE_PENDING_MAP: + tex->state = TEXTURE_STATE_UNUSED; + //fallthrough + + case TEXTURE_STATE_UNUSED: + break; + } } if (this->dup && *this->dup)