Henri Verbeet : d3d9: Explicitly translate swap effects.

Alexandre Julliard julliard at winehq.org
Thu Feb 15 14:42:27 CST 2018


Module: wine
Branch: master
Commit: 5057df1f3e066897cc5978ec3e9f3b594886e862
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=5057df1f3e066897cc5978ec3e9f3b594886e862

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Thu Feb 15 09:53:17 2018 +0330

d3d9: Explicitly translate swap effects.

Note that previously D3DSWAPEFFECT_OVERLAY would get mapped to
WINED3D_SWAP_EFFECT_COPY_VSYNC. That didn't matter so much because neither is
currently implemented.

Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/d3d9/device.c     | 44 ++++++++++++++++++++++++++++++++++++++++++--
 include/wine/wined3d.h | 10 ++++++----
 2 files changed, 48 insertions(+), 6 deletions(-)

diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c
index 4c1006c..ff95bef 100644
--- a/dlls/d3d9/device.c
+++ b/dlls/d3d9/device.c
@@ -186,6 +186,26 @@ static UINT vertex_count_from_primitive_count(D3DPRIMITIVETYPE primitive_type, U
     }
 }
 
+static D3DSWAPEFFECT d3dswapeffect_from_wined3dswapeffect(enum wined3d_swap_effect effect)
+{
+    switch (effect)
+    {
+        case WINED3D_SWAP_EFFECT_DISCARD:
+            return D3DSWAPEFFECT_DISCARD;
+        case WINED3D_SWAP_EFFECT_SEQUENTIAL:
+            return D3DSWAPEFFECT_FLIP;
+        case WINED3D_SWAP_EFFECT_COPY:
+            return D3DSWAPEFFECT_COPY;
+        case WINED3D_SWAP_EFFECT_OVERLAY:
+            return D3DSWAPEFFECT_OVERLAY;
+        case WINED3D_SWAP_EFFECT_FLIP_SEQUENTIAL:
+            return D3DSWAPEFFECT_FLIPEX;
+        default:
+            FIXME("Unhandled swap effect %#x.\n", effect);
+            return D3DSWAPEFFECT_FLIP;
+    }
+}
+
 void present_parameters_from_wined3d_swapchain_desc(D3DPRESENT_PARAMETERS *present_parameters,
         const struct wined3d_swapchain_desc *swapchain_desc)
 {
@@ -195,7 +215,7 @@ void present_parameters_from_wined3d_swapchain_desc(D3DPRESENT_PARAMETERS *prese
     present_parameters->BackBufferCount = swapchain_desc->backbuffer_count;
     present_parameters->MultiSampleType = swapchain_desc->multisample_type;
     present_parameters->MultiSampleQuality = swapchain_desc->multisample_quality;
-    present_parameters->SwapEffect = swapchain_desc->swap_effect;
+    present_parameters->SwapEffect = d3dswapeffect_from_wined3dswapeffect(swapchain_desc->swap_effect);
     present_parameters->hDeviceWindow = swapchain_desc->device_window;
     present_parameters->Windowed = swapchain_desc->windowed;
     present_parameters->EnableAutoDepthStencil = swapchain_desc->enable_auto_depth_stencil;
@@ -206,6 +226,26 @@ void present_parameters_from_wined3d_swapchain_desc(D3DPRESENT_PARAMETERS *prese
     present_parameters->PresentationInterval = swapchain_desc->swap_interval;
 }
 
+static enum wined3d_swap_effect wined3dswapeffect_from_d3dswapeffect(D3DSWAPEFFECT effect)
+{
+    switch (effect)
+    {
+        case D3DSWAPEFFECT_DISCARD:
+            return WINED3D_SWAP_EFFECT_DISCARD;
+        case D3DSWAPEFFECT_FLIP:
+            return WINED3D_SWAP_EFFECT_SEQUENTIAL;
+        case D3DSWAPEFFECT_COPY:
+            return WINED3D_SWAP_EFFECT_COPY;
+        case D3DSWAPEFFECT_OVERLAY:
+            return WINED3D_SWAP_EFFECT_OVERLAY;
+        case D3DSWAPEFFECT_FLIPEX:
+            return WINED3D_SWAP_EFFECT_FLIP_SEQUENTIAL;
+        default:
+            FIXME("Unhandled swap effect %#x.\n", effect);
+            return WINED3D_SWAP_EFFECT_SEQUENTIAL;
+    }
+}
+
 static BOOL wined3d_swapchain_desc_from_present_parameters(struct wined3d_swapchain_desc *swapchain_desc,
         const D3DPRESENT_PARAMETERS *present_parameters, BOOL extended)
 {
@@ -232,7 +272,7 @@ static BOOL wined3d_swapchain_desc_from_present_parameters(struct wined3d_swapch
     swapchain_desc->backbuffer_usage = WINED3DUSAGE_RENDERTARGET;
     swapchain_desc->multisample_type = present_parameters->MultiSampleType;
     swapchain_desc->multisample_quality = present_parameters->MultiSampleQuality;
-    swapchain_desc->swap_effect = present_parameters->SwapEffect;
+    swapchain_desc->swap_effect = wined3dswapeffect_from_d3dswapeffect(present_parameters->SwapEffect);
     swapchain_desc->device_window = present_parameters->hDeviceWindow;
     swapchain_desc->windowed = present_parameters->Windowed;
     swapchain_desc->enable_auto_depth_stencil = present_parameters->EnableAutoDepthStencil;
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index cca4476..22bb2d8 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -505,10 +505,12 @@ enum wined3d_patch_edge_style
 
 enum wined3d_swap_effect
 {
-    WINED3D_SWAP_EFFECT_DISCARD             = 1,
-    WINED3D_SWAP_EFFECT_SEQUENTIAL          = 2,
-    WINED3D_SWAP_EFFECT_COPY                = 3,
-    WINED3D_SWAP_EFFECT_COPY_VSYNC          = 4,
+    WINED3D_SWAP_EFFECT_DISCARD,
+    WINED3D_SWAP_EFFECT_SEQUENTIAL,
+    WINED3D_SWAP_EFFECT_FLIP_SEQUENTIAL,
+    WINED3D_SWAP_EFFECT_COPY,
+    WINED3D_SWAP_EFFECT_COPY_VSYNC,
+    WINED3D_SWAP_EFFECT_OVERLAY,
 };
 
 enum wined3d_sampler_state




More information about the wine-cvs mailing list