[PATCH v2 4/5] wined3d: Pass a struct wined3d_output pointer to wined3d_swapchain_state_set_fullscreen().

Zhiyi Zhang zzhang at codeweavers.com
Thu Mar 5 09:04:13 CST 2020


Signed-off-by: Zhiyi Zhang <zzhang at codeweavers.com>
---
 dlls/dxgi/swapchain.c       |  2 +-
 dlls/wined3d/device.c       |  2 +-
 dlls/wined3d/swapchain.c    | 14 ++++++--------
 dlls/wined3d/wined3d.spec   |  2 +-
 dlls/wined3d/wined3d_main.c |  2 +-
 include/wine/wined3d.h      |  2 +-
 6 files changed, 11 insertions(+), 13 deletions(-)

diff --git a/dlls/dxgi/swapchain.c b/dlls/dxgi/swapchain.c
index 004bd1457dd..603cf171e27 100644
--- a/dlls/dxgi/swapchain.c
+++ b/dlls/dxgi/swapchain.c
@@ -164,7 +164,7 @@ static HRESULT dxgi_swapchain_set_fullscreen_state(struct wined3d_swapchain_stat
 
     wined3d_mutex_lock();
     hr = wined3d_swapchain_state_set_fullscreen(state, swapchain_desc,
-            adapter->factory->wined3d, adapter->ordinal, NULL);
+            adapter->factory->wined3d, dxgi_output->wined3d_output, NULL);
     wined3d_mutex_unlock();
 
     return hr;
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 441601efcb6..4a5397b2e67 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -5206,7 +5206,7 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
             }
         }
         if (FAILED(hr = wined3d_swapchain_state_set_fullscreen(&swapchain->state,
-                swapchain_desc, device->wined3d, device->adapter->ordinal, mode)))
+                swapchain_desc, device->wined3d, &device->adapter->outputs[0], mode)))
             return hr;
 
         /* Switch from fullscreen to windowed. */
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
index c7c751f736e..a70b6c1e063 100644
--- a/dlls/wined3d/swapchain.c
+++ b/dlls/wined3d/swapchain.c
@@ -1604,13 +1604,13 @@ void wined3d_swapchain_state_restore_from_fullscreen(struct wined3d_swapchain_st
 
 HRESULT CDECL wined3d_swapchain_state_set_fullscreen(struct wined3d_swapchain_state *state,
         const struct wined3d_swapchain_desc *swapchain_desc, struct wined3d *wined3d,
-        unsigned int adapter_idx, const struct wined3d_display_mode *mode)
+        struct wined3d_output *output, const struct wined3d_display_mode *mode)
 {
     struct wined3d_display_mode actual_mode;
     HRESULT hr;
 
-    TRACE("state %p, swapchain_desc %p, wined3d %p, adapter_idx %u, mode %p.\n",
-            state, swapchain_desc, wined3d, adapter_idx, mode);
+    TRACE("state %p, swapchain_desc %p, wined3d %p, output %p, mode %p.\n",
+            state, swapchain_desc, wined3d, output, mode);
 
     if (state->desc.flags & WINED3D_SWAPCHAIN_ALLOW_MODE_SWITCH)
     {
@@ -1622,12 +1622,10 @@ HRESULT CDECL wined3d_swapchain_state_set_fullscreen(struct wined3d_swapchain_st
         {
             if (!swapchain_desc->windowed)
             {
-                const struct wined3d_adapter *adapter = wined3d->adapters[adapter_idx];
-
                 actual_mode.width = swapchain_desc->backbuffer_width;
                 actual_mode.height = swapchain_desc->backbuffer_height;
                 actual_mode.refresh_rate = swapchain_desc->refresh_rate;
-                actual_mode.format_id = adapter_format_from_backbuffer_format(adapter,
+                actual_mode.format_id = adapter_format_from_backbuffer_format(output->adapter,
                         swapchain_desc->backbuffer_format);
                 actual_mode.scanline_ordering = WINED3D_SCANLINE_ORDERING_UNKNOWN;
             }
@@ -1637,7 +1635,7 @@ HRESULT CDECL wined3d_swapchain_state_set_fullscreen(struct wined3d_swapchain_st
             }
         }
 
-        if (FAILED(hr = wined3d_swapchain_state_set_display_mode(state, wined3d, adapter_idx, &actual_mode)))
+        if (FAILED(hr = wined3d_swapchain_state_set_display_mode(state, wined3d, 0, &actual_mode)))
             return hr;
     }
     else
@@ -1645,7 +1643,7 @@ HRESULT CDECL wined3d_swapchain_state_set_fullscreen(struct wined3d_swapchain_st
         if (mode)
             WARN("WINED3D_SWAPCHAIN_ALLOW_MODE_SWITCH is not set, ignoring mode.\n");
 
-        if (FAILED(hr = wined3d_get_adapter_display_mode(wined3d, adapter_idx, &actual_mode, NULL)))
+        if (FAILED(hr = wined3d_get_adapter_display_mode(wined3d, 0, &actual_mode, NULL)))
         {
             ERR("Failed to get display mode, hr %#x.\n", hr);
             return WINED3DERR_INVALIDCALL;
diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec
index a85b5ac34b1..0423423f30e 100644
--- a/dlls/wined3d/wined3d.spec
+++ b/dlls/wined3d/wined3d.spec
@@ -299,7 +299,7 @@
 @ cdecl wined3d_swapchain_state_create(ptr ptr ptr long ptr)
 @ cdecl wined3d_swapchain_state_destroy(ptr)
 @ cdecl wined3d_swapchain_state_resize_target(ptr ptr long ptr)
-@ cdecl wined3d_swapchain_state_set_fullscreen(ptr ptr ptr long ptr)
+@ cdecl wined3d_swapchain_state_set_fullscreen(ptr ptr ptr ptr ptr)
 
 @ cdecl wined3d_texture_add_dirty_region(ptr long ptr)
 @ cdecl wined3d_texture_blt(ptr long ptr ptr long ptr long ptr long)
diff --git a/dlls/wined3d/wined3d_main.c b/dlls/wined3d/wined3d_main.c
index 05684aeb3ba..3e852bd4e62 100644
--- a/dlls/wined3d/wined3d_main.c
+++ b/dlls/wined3d/wined3d_main.c
@@ -565,7 +565,7 @@ static LRESULT CALLBACK wined3d_hook_proc(int code, WPARAM wparam, LPARAM lparam
             wined3d_swapchain_get_desc(swapchain, &swapchain_desc);
             swapchain_desc.windowed = !swapchain_desc.windowed;
             wined3d_swapchain_state_set_fullscreen(&swapchain->state, &swapchain_desc,
-                    swapchain->device->wined3d, swapchain->device->adapter->ordinal, NULL);
+                    swapchain->device->wined3d, &swapchain->device->adapter->outputs[0], NULL);
 
             wined3d_wndproc_mutex_unlock();
 
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index 63b4cba33a0..dbee737e263 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -2790,7 +2790,7 @@ HRESULT __cdecl wined3d_swapchain_state_resize_target(struct wined3d_swapchain_s
         struct wined3d *wined3d, unsigned int adapter_idx, const struct wined3d_display_mode *mode);
 HRESULT __cdecl wined3d_swapchain_state_set_fullscreen(struct wined3d_swapchain_state *state,
         const struct wined3d_swapchain_desc *desc, struct wined3d *wined3d,
-        unsigned int adapter_idx, const struct wined3d_display_mode *mode);
+        struct wined3d_output *output, const struct wined3d_display_mode *mode);
 
 HRESULT __cdecl wined3d_texture_add_dirty_region(struct wined3d_texture *texture,
         UINT layer, const struct wined3d_box *dirty_region);
-- 
2.20.1




More information about the wine-devel mailing list