st/nine: Test more presentation params
authorPatrick Rudolph <siro@das-labor.org>
Thu, 22 Oct 2015 14:02:14 +0000 (16:02 +0200)
committerAxel Davy <axel.davy@ens.fr>
Thu, 4 Feb 2016 21:12:17 +0000 (22:12 +0100)
Return errors in case of invalid presentation parameters.
Fixes failing WINE tests device.c test_swapchain_parameters().

Signed-off-by: Patrick Rudolph <siro@das-labor.org>
Reviewed-by: Axel Davy <axel.davy@ens.fr>
src/gallium/state_trackers/nine/swapchain9.c

index 3b1a7a4493cd23a2453fdf4dba27a4db6625cbf1..b97a387ce5d7ca3425515a235b3636cf06c28698 100644 (file)
@@ -118,6 +118,14 @@ NineSwapChain9_Resize( struct NineSwapChain9 *This,
 
     DBG("This=%p pParams=%p\n", This, pParams);
     user_assert(pParams != NULL, E_POINTER);
+    user_assert(pParams->SwapEffect, D3DERR_INVALIDCALL);
+    user_assert((pParams->SwapEffect != D3DSWAPEFFECT_COPY) ||
+                (pParams->BackBufferCount <= 1), D3DERR_INVALIDCALL);
+    user_assert(pDevice->ex || pParams->BackBufferCount <= 3, D3DERR_INVALIDCALL);
+    user_assert(pDevice->ex ||
+                (pParams->SwapEffect == D3DSWAPEFFECT_FLIP) ||
+                (pParams->SwapEffect == D3DSWAPEFFECT_COPY) ||
+                (pParams->SwapEffect == D3DSWAPEFFECT_DISCARD), D3DERR_INVALIDCALL);
 
     DBG("pParams(%p):\n"
         "BackBufferWidth: %u\n"
@@ -145,11 +153,6 @@ NineSwapChain9_Resize( struct NineSwapChain9 *This,
         pParams->FullScreen_RefreshRateInHz,
         pParams->PresentationInterval);
 
-    if (pParams->SwapEffect == D3DSWAPEFFECT_COPY &&
-        pParams->BackBufferCount > 1) {
-        pParams->BackBufferCount = 1;
-    }
-
     if (pParams->BackBufferCount > 3) {
         pParams->BackBufferCount = 3;
     }