Signed-off-by: Zhiyi Zhang zzhang@codeweavers.com --- dlls/d3d8/device.c | 5 ++++- dlls/d3d9/device.c | 5 ++++- dlls/wined3d/device.c | 5 +++-- dlls/wined3d/wined3d.spec | 2 +- include/wine/wined3d.h | 3 ++- 5 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c index 44a81ba672..25067512f9 100644 --- a/dlls/d3d8/device.c +++ b/dlls/d3d8/device.c @@ -740,6 +740,7 @@ static HRESULT WINAPI d3d8_device_SetCursorProperties(IDirect3DDevice8 *iface, { struct d3d8_device *device = impl_from_IDirect3DDevice8(iface); struct d3d8_surface *bitmap_impl = unsafe_impl_from_IDirect3DSurface8(bitmap); + unsigned int output_idx; HRESULT hr;
TRACE("iface %p, hotspot_x %u, hotspot_y %u, bitmap %p.\n", @@ -752,8 +753,10 @@ static HRESULT WINAPI d3d8_device_SetCursorProperties(IDirect3DDevice8 *iface, }
wined3d_mutex_lock(); + output_idx = device->adapter_ordinal; hr = wined3d_device_set_cursor_properties(device->wined3d_device, - hotspot_x, hotspot_y, bitmap_impl->wined3d_texture, bitmap_impl->sub_resource_idx); + device->d3d_parent->wined3d_outputs[output_idx], hotspot_x, hotspot_y, + bitmap_impl->wined3d_texture, bitmap_impl->sub_resource_idx); wined3d_mutex_unlock();
return hr; diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c index 61cb505d77..8204376106 100644 --- a/dlls/d3d9/device.c +++ b/dlls/d3d9/device.c @@ -787,6 +787,7 @@ static HRESULT WINAPI d3d9_device_SetCursorProperties(IDirect3DDevice9Ex *iface, { struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface); struct d3d9_surface *bitmap_impl = unsafe_impl_from_IDirect3DSurface9(bitmap); + unsigned int output_idx; HRESULT hr;
TRACE("iface %p, hotspot_x %u, hotspot_y %u, bitmap %p.\n", @@ -799,8 +800,10 @@ static HRESULT WINAPI d3d9_device_SetCursorProperties(IDirect3DDevice9Ex *iface, }
wined3d_mutex_lock(); + output_idx = device->adapter_ordinal; hr = wined3d_device_set_cursor_properties(device->wined3d_device, - hotspot_x, hotspot_y, bitmap_impl->wined3d_texture, bitmap_impl->sub_resource_idx); + device->d3d_parent->wined3d_outputs[output_idx], hotspot_x, hotspot_y, + bitmap_impl->wined3d_texture, bitmap_impl->sub_resource_idx); wined3d_mutex_unlock();
return hr; diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 0a0c4c526c..30c44aa5aa 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -4890,7 +4890,8 @@ static struct wined3d_texture *wined3d_device_create_cursor_texture(struct wined }
HRESULT CDECL wined3d_device_set_cursor_properties(struct wined3d_device *device, - UINT x_hotspot, UINT y_hotspot, struct wined3d_texture *texture, unsigned int sub_resource_idx) + struct wined3d_output *output, unsigned int x_hotspot, unsigned int y_hotspot, + struct wined3d_texture *texture, unsigned int sub_resource_idx) { unsigned int texture_level = sub_resource_idx % texture->level_count; unsigned int cursor_width, cursor_height; @@ -4918,7 +4919,7 @@ HRESULT CDECL wined3d_device_set_cursor_properties(struct wined3d_device *device return WINED3DERR_INVALIDCALL; }
- if (FAILED(hr = wined3d_output_get_display_mode(&device->adapter->outputs[0], &mode, NULL))) + if (FAILED(hr = wined3d_output_get_display_mode(output, &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 22a9a9dd74..a7ba855865 100644 --- a/dlls/wined3d/wined3d.spec +++ b/dlls/wined3d/wined3d.spec @@ -115,7 +115,7 @@ @ cdecl wined3d_device_set_cs_sampler(ptr long ptr) @ cdecl wined3d_device_set_cs_uav(ptr long ptr long) @ cdecl wined3d_device_set_cursor_position(ptr long long long) -@ cdecl wined3d_device_set_cursor_properties(ptr long long ptr long) +@ cdecl wined3d_device_set_cursor_properties(ptr ptr long long ptr long) @ cdecl wined3d_device_set_depth_stencil_view(ptr ptr) @ cdecl wined3d_device_set_dialog_box_mode(ptr long) @ cdecl wined3d_device_set_domain_shader(ptr ptr) diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index 30b6f9a7e8..3204c6af98 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -2437,7 +2437,8 @@ void __cdecl wined3d_device_set_cs_uav(struct wined3d_device *device, unsigned i void __cdecl wined3d_device_set_cursor_position(struct wined3d_device *device, int x_screen_space, int y_screen_space, DWORD flags); HRESULT __cdecl wined3d_device_set_cursor_properties(struct wined3d_device *device, - UINT x_hotspot, UINT y_hotspot, struct wined3d_texture *texture, unsigned int sub_resource_idx); + struct wined3d_output *output, unsigned int x_hotspot, unsigned int y_hotspot, + struct wined3d_texture *texture, unsigned int sub_resource_idx); HRESULT __cdecl wined3d_device_set_depth_stencil_view(struct wined3d_device *device, struct wined3d_rendertarget_view *view); HRESULT __cdecl wined3d_device_set_dialog_box_mode(struct wined3d_device *device, BOOL enable_dialogs);
On Tue, 24 Mar 2020 at 12:22, Zhiyi Zhang zzhang@codeweavers.com wrote:
dlls/d3d8/device.c | 5 ++++- dlls/d3d9/device.c | 5 ++++- dlls/wined3d/device.c | 5 +++-- dlls/wined3d/wined3d.spec | 2 +- include/wine/wined3d.h | 3 ++- 5 files changed, 14 insertions(+), 6 deletions(-)
This seems wrong, or at least suspicious. For one, we have wined3d_swapchain_get_output(), which we could use with the device's implicit swapchain to get the corresponding output. More importantly, the check against the display mode what introduced in a98ccb543d25cfe7047fe65d91609080ca2ede8b with a reference to MSDN, but no further details, and no tests as far as I'm aware. So just to list a couple of possibilities: - MSDN is lying; we don't need to check this. - The check is only supposed to happen in fullscreen mode. - The check is supposed to happen against *any* output instead of the semi-random current one. - The check is supposed to happen against *all* outputs. - The check is supposed to happen against the backbuffer/frontbuffer/window dimensions of the implicit swapchain. - Like the previous possibility, but against all swapchains.