diff options
author | Axel Davy <davyaxel0@gmail.com> | 2019-04-27 15:45:12 +0200 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2019-05-08 16:40:18 -0700 |
commit | fabaae4d8d2985f9b247c2e620af198972196d7f (patch) | |
tree | 6c2439262d7881a3781b31f096a3cadbe126ed91 | |
parent | 6e710c1fb4330d72c9ceb520b254f186708a4561 (diff) |
st/nine: Fix D3DWindowBuffer_release for old wine nine support
No-one reported bugs for that, but is seems
c442dd789066104e5e84cc90d98a7ff5cd6296cf
and previous commits used APIs not defined until
nine minor version 3.
This patch should prevent crash in this case.
Also turn off the resize feature in this case,
as we won't prevent a buffer leak anymore.
Cc: "19.0" mesa-stable@lists.freedesktop.org
Signed-off-by: Axel Davy <davyaxel0@gmail.com>
(cherry picked from commit 64a45ba7f83095a8a44a7b1104f31bab68b259fe)
-rw-r--r-- | src/gallium/state_trackers/nine/swapchain9.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/gallium/state_trackers/nine/swapchain9.c b/src/gallium/state_trackers/nine/swapchain9.c index 36e07310400..8026ee16b7a 100644 --- a/src/gallium/state_trackers/nine/swapchain9.c +++ b/src/gallium/state_trackers/nine/swapchain9.c @@ -133,6 +133,13 @@ D3DWindowBuffer_release(struct NineSwapChain9 *This, D3DWindowBuffer *present_handle) { int i; + + /* IsBufferReleased API not available */ + if (This->base.device->minor_version_num <= 2) { + ID3DPresent_DestroyD3DWindowBuffer(This->present, present_handle); + return; + } + /* Add it to the 'pending release' list */ for (i = 0; i < D3DPRESENT_BACK_BUFFERS_MAX_EX + 1; i++) { if (!This->present_handles_pending_release[i]) { @@ -754,8 +761,11 @@ present( struct NineSwapChain9 *This, (void)target_depth; /* Can happen with old Wine (presentation can still succeed), - * or at window destruction. */ - if (FAILED(hr) || target_width == 0 || target_height == 0) { + * or at window destruction. + * Also disable for very old wine as D3DWindowBuffer_release + * cannot do the DestroyD3DWindowBuffer workaround. */ + if (FAILED(hr) || target_width == 0 || target_height == 0 || + This->base.device->minor_version_num <= 2) { target_width = resource->width0; target_height = resource->height0; } |