diff options
author | Axel Davy <[email protected]> | 2019-01-02 22:13:12 +0100 |
---|---|---|
committer | Axel Davy <[email protected]> | 2019-03-04 21:52:15 +0100 |
commit | 86666f051e0cae96f2596cac05e3c3f394744149 (patch) | |
tree | c0a59f1ac97555fab8bd8e4c720fec8deae021ab /src/gallium/state_trackers/nine/swapchain9.c | |
parent | ec0f465bc5f02c93aeb4193db8b5bd90a254b080 (diff) |
st/nine: Ignore window size if error
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: [email protected]
Fixes: 2318ca68bbe ("st/nine: Handle window resize when a presentation
buffer is used")
Signed-off-by: Axel Davy <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers/nine/swapchain9.c')
-rw-r--r-- | src/gallium/state_trackers/nine/swapchain9.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/gallium/state_trackers/nine/swapchain9.c b/src/gallium/state_trackers/nine/swapchain9.c index 6c22be24c7c..36e07310400 100644 --- a/src/gallium/state_trackers/nine/swapchain9.c +++ b/src/gallium/state_trackers/nine/swapchain9.c @@ -750,9 +750,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; + } + /* Switch to using presentation buffers on window resize. * Note: Most apps should resize the d3d back buffers when * a window resize is detected, which will result in a call to |