OSDN Git Service

st/nine: Ignore window size if error
authorAxel Davy <davyaxel0@gmail.com>
Wed, 2 Jan 2019 21:13:12 +0000 (22:13 +0100)
committerEmil Velikov <emil.l.velikov@gmail.com>
Thu, 14 Mar 2019 19:02:42 +0000 (19:02 +0000)
Check GetWindowInfo and ignore the computed sizes
if there is an error.

Fixes a regression caused by earlier commit when
using old wine gallium nine patches.

Should also address a crash at window destruction.

Related issues:
 https://github.com/iXit/Mesa-3D/issues/331
 https://github.com/iXit/Mesa-3D/issues/332

Cc: mesa-stable@lists.freedesktop.org
Fixes: 2318ca68bbe ("st/nine: Handle window resize when a presentation buffer is used")
Signed-off-by: Axel Davy <davyaxel0@gmail.com>
(cherry picked from commit 86666f051e0cae96f2596cac05e3c3f394744149)
[Emil: resolve trivial conflicts]
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Conflicts:
src/gallium/state_trackers/nine/swapchain9.c

src/gallium/state_trackers/nine/swapchain9.c

index 0958a90..296a9c0 100644 (file)
@@ -696,9 +696,16 @@ present( struct NineSwapChain9 *This,
     if (This->params.SwapEffect == D3DSWAPEFFECT_DISCARD)
         handle_draw_cursor_and_hud(This, resource);
 
-    ID3DPresent_GetWindowInfo(This->present, hDestWindowOverride, &target_width, &target_height, &target_depth);
+    hr = ID3DPresent_GetWindowInfo(This->present, hDestWindowOverride, &target_width, &target_height, &target_depth);
     (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) {
+        target_width = resource->width0;
+        target_height = resource->height0;
+    }
+
     pipe = NineDevice9_GetPipe(This->base.device);
 
     if (This->present_buffers[0]) {