=?UTF-8?Q?J=C3=B3zef=20Kucia=20?=: dxgi: Implement IDXGISwapChain_ResizeTarget().

Alexandre Julliard julliard at winehq.org
Fri Aug 5 16:20:07 CDT 2016


Module: wine
Branch: master
Commit: 537bd43ea843fb1419c1a744065c79ee185767e4
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=537bd43ea843fb1419c1a744065c79ee185767e4

Author: Józef Kucia <jkucia at codeweavers.com>
Date:   Thu Aug  4 17:23:43 2016 +0200

dxgi: Implement IDXGISwapChain_ResizeTarget().

Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/dxgi/dxgi_private.h |  4 ++++
 dlls/dxgi/factory.c      |  8 --------
 dlls/dxgi/swapchain.c    | 26 ++++++++++++++++++++++++--
 dlls/dxgi/utils.c        | 30 ++++++++++++++++++++++++++++++
 4 files changed, 58 insertions(+), 10 deletions(-)

diff --git a/dlls/dxgi/dxgi_private.h b/dlls/dxgi/dxgi_private.h
index 7148811..987370f1 100644
--- a/dlls/dxgi/dxgi_private.h
+++ b/dlls/dxgi/dxgi_private.h
@@ -79,10 +79,14 @@ struct dxgi_device_layer
 
 /* TRACE helper functions */
 const char *debug_dxgi_format(DXGI_FORMAT format) DECLSPEC_HIDDEN;
+const char *debug_dxgi_mode(const DXGI_MODE_DESC *desc) DECLSPEC_HIDDEN;
 void dump_feature_levels(const D3D_FEATURE_LEVEL *feature_levels, unsigned int level_count) DECLSPEC_HIDDEN;
 
 DXGI_FORMAT dxgi_format_from_wined3dformat(enum wined3d_format_id format) DECLSPEC_HIDDEN;
 enum wined3d_format_id wined3dformat_from_dxgi_format(DXGI_FORMAT format) DECLSPEC_HIDDEN;
+UINT dxgi_rational_to_uint(const DXGI_RATIONAL *rational) DECLSPEC_HIDDEN;
+enum wined3d_scanline_ordering wined3d_scanline_ordering_from_dxgi(
+        DXGI_MODE_SCANLINE_ORDER scanline_order) DECLSPEC_HIDDEN;
 void dxgi_sample_desc_from_wined3d(DXGI_SAMPLE_DESC *desc,
         enum wined3d_multisample_type wined3d_type, unsigned int wined3d_quality) DECLSPEC_HIDDEN;
 void wined3d_sample_desc_from_dxgi(enum wined3d_multisample_type *wined3d_type,
diff --git a/dlls/dxgi/factory.c b/dlls/dxgi/factory.c
index 3aa8597..d54eea9 100644
--- a/dlls/dxgi/factory.c
+++ b/dlls/dxgi/factory.c
@@ -180,14 +180,6 @@ static HRESULT STDMETHODCALLTYPE dxgi_factory_GetWindowAssociation(IDXGIFactory1
     return E_NOTIMPL;
 }
 
-static UINT dxgi_rational_to_uint(const DXGI_RATIONAL *rational)
-{
-    if (rational->Denominator)
-        return rational->Numerator / rational->Denominator;
-    else
-        return rational->Numerator;
-}
-
 static HRESULT STDMETHODCALLTYPE dxgi_factory_CreateSwapChain(IDXGIFactory1 *iface,
         IUnknown *device, DXGI_SWAP_CHAIN_DESC *desc, IDXGISwapChain **swapchain)
 {
diff --git a/dlls/dxgi/swapchain.c b/dlls/dxgi/swapchain.c
index 869c799..172b0f4 100644
--- a/dlls/dxgi/swapchain.c
+++ b/dlls/dxgi/swapchain.c
@@ -337,9 +337,31 @@ static HRESULT STDMETHODCALLTYPE dxgi_swapchain_ResizeBuffers(IDXGISwapChain *if
 static HRESULT STDMETHODCALLTYPE dxgi_swapchain_ResizeTarget(IDXGISwapChain *iface,
         const DXGI_MODE_DESC *target_mode_desc)
 {
-    FIXME("iface %p, target_mode_desc %p stub!\n", iface, target_mode_desc);
+    struct dxgi_swapchain *swapchain = impl_from_IDXGISwapChain(iface);
+    struct wined3d_display_mode mode;
+    HRESULT hr;
 
-    return E_NOTIMPL;
+    TRACE("iface %p, target_mode_desc %p.\n", iface, target_mode_desc);
+
+    if (!target_mode_desc)
+        return DXGI_ERROR_INVALID_CALL;
+
+    TRACE("Mode: %s.\n", debug_dxgi_mode(target_mode_desc));
+
+    if (target_mode_desc->Scaling)
+        FIXME("Ignoring scaling %#x.\n", target_mode_desc->Scaling);
+
+    mode.width = target_mode_desc->Width;
+    mode.height = target_mode_desc->Height;
+    mode.refresh_rate = dxgi_rational_to_uint(&target_mode_desc->RefreshRate);
+    mode.format_id = wined3dformat_from_dxgi_format(target_mode_desc->Format);
+    mode.scanline_ordering = wined3d_scanline_ordering_from_dxgi(target_mode_desc->ScanlineOrdering);
+
+    wined3d_mutex_lock();
+    hr = wined3d_swapchain_resize_target(swapchain->wined3d_swapchain, &mode);
+    wined3d_mutex_unlock();
+
+    return hr;
 }
 
 static HRESULT STDMETHODCALLTYPE dxgi_swapchain_GetContainingOutput(IDXGISwapChain *iface, IDXGIOutput **output)
diff --git a/dlls/dxgi/utils.c b/dlls/dxgi/utils.c
index 5c6c5bd..9371de1 100644
--- a/dlls/dxgi/utils.c
+++ b/dlls/dxgi/utils.c
@@ -364,6 +364,14 @@ enum wined3d_format_id wined3dformat_from_dxgi_format(DXGI_FORMAT format)
     }
 }
 
+const char *debug_dxgi_mode(const DXGI_MODE_DESC *desc)
+{
+    return wine_dbg_sprintf("resolution %ux%u, refresh rate %u / %u, "
+            "format %s, scanline ordering %#x, scaling %#x",
+            desc->Width, desc->Height, desc->RefreshRate.Numerator, desc->RefreshRate.Denominator,
+            debug_dxgi_format(desc->Format), desc->ScanlineOrdering, desc->Scaling);
+}
+
 void dump_feature_levels(const D3D_FEATURE_LEVEL *feature_levels, unsigned int level_count)
 {
     unsigned int i;
@@ -379,6 +387,28 @@ void dump_feature_levels(const D3D_FEATURE_LEVEL *feature_levels, unsigned int l
         TRACE("    [%u] = %s.\n", i, debug_feature_level(feature_levels[i]));
 }
 
+UINT dxgi_rational_to_uint(const DXGI_RATIONAL *rational)
+{
+    if (rational->Denominator)
+        return rational->Numerator / rational->Denominator;
+    else
+        return rational->Numerator;
+}
+
+enum wined3d_scanline_ordering wined3d_scanline_ordering_from_dxgi(DXGI_MODE_SCANLINE_ORDER scanline_order)
+{
+    switch (scanline_order)
+    {
+        case DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED:
+            return WINED3D_SCANLINE_ORDERING_UNKNOWN;
+        case DXGI_MODE_SCANLINE_ORDER_PROGRESSIVE:
+            return WINED3D_SCANLINE_ORDERING_PROGRESSIVE;
+        default:
+            FIXME("Unhandled scanline ordering %#x.\n", scanline_order);
+            return WINED3D_SCANLINE_ORDERING_UNKNOWN;
+    }
+}
+
 void dxgi_sample_desc_from_wined3d(DXGI_SAMPLE_DESC *desc,
         enum wined3d_multisample_type wined3d_type, unsigned int wined3d_quality)
 {




More information about the wine-cvs mailing list