Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/d3d11/device.c | 4 ++-- dlls/d3d8/device.c | 2 +- dlls/d3d9/device.c | 2 +- dlls/ddraw/device.c | 2 +- dlls/wined3d/device.c | 15 +++++++++++---- dlls/wined3d/wined3d.spec | 2 +- include/wine/wined3d.h | 3 ++- 7 files changed, 19 insertions(+), 11 deletions(-)
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c index 248cac69f8..0ee756dfa2 100644 --- a/dlls/d3d11/device.c +++ b/dlls/d3d11/device.c @@ -2107,7 +2107,7 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_RSGetViewports(ID3D11Devic return;
wined3d_mutex_lock(); - wined3d_device_get_viewport(device->wined3d_device, &wined3d_vp); + wined3d_device_get_viewports(device->wined3d_device, NULL, &wined3d_vp); wined3d_mutex_unlock();
viewports[0].TopLeftX = wined3d_vp.x; @@ -4909,7 +4909,7 @@ static void STDMETHODCALLTYPE d3d10_device_RSGetViewports(ID3D10Device1 *iface, return;
wined3d_mutex_lock(); - wined3d_device_get_viewport(device->wined3d_device, &wined3d_vp); + wined3d_device_get_viewports(device->wined3d_device, NULL, &wined3d_vp); wined3d_mutex_unlock();
viewports[0].TopLeftX = wined3d_vp.x; diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c index 3bdb278ec5..616886bcaf 100644 --- a/dlls/d3d8/device.c +++ b/dlls/d3d8/device.c @@ -1664,7 +1664,7 @@ static HRESULT WINAPI d3d8_device_GetViewport(IDirect3DDevice8 *iface, D3DVIEWPO TRACE("iface %p, viewport %p.\n", iface, viewport);
wined3d_mutex_lock(); - wined3d_device_get_viewport(device->wined3d_device, &wined3d_viewport); + wined3d_device_get_viewports(device->wined3d_device, NULL, &wined3d_viewport); wined3d_mutex_unlock();
viewport->X = wined3d_viewport.x; diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c index 5c0d6779c5..0a77b3e316 100644 --- a/dlls/d3d9/device.c +++ b/dlls/d3d9/device.c @@ -2082,7 +2082,7 @@ static HRESULT WINAPI d3d9_device_GetViewport(IDirect3DDevice9Ex *iface, D3DVIEW TRACE("iface %p, viewport %p.\n", iface, viewport);
wined3d_mutex_lock(); - wined3d_device_get_viewport(device->wined3d_device, &wined3d_viewport); + wined3d_device_get_viewports(device->wined3d_device, NULL, &wined3d_viewport); wined3d_mutex_unlock();
viewport->X = wined3d_viewport.x; diff --git a/dlls/ddraw/device.c b/dlls/ddraw/device.c index 23c61c5d80..5db0b81a81 100644 --- a/dlls/ddraw/device.c +++ b/dlls/ddraw/device.c @@ -5367,7 +5367,7 @@ static HRESULT d3d_device7_GetViewport(IDirect3DDevice7 *iface, D3DVIEWPORT7 *vi return DDERR_INVALIDPARAMS;
wined3d_mutex_lock(); - wined3d_device_get_viewport(device->wined3d_device, &wined3d_viewport); + wined3d_device_get_viewports(device->wined3d_device, NULL, &wined3d_viewport); wined3d_mutex_unlock();
viewport->dwX = wined3d_viewport.x; diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 4ee948019b..8d4f4cde0e 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -1940,11 +1940,18 @@ void CDECL wined3d_device_set_viewports(struct wined3d_device *device, unsigned wined3d_cs_emit_set_viewports(device->cs, viewport_count, viewports); }
-void CDECL wined3d_device_get_viewport(const struct wined3d_device *device, struct wined3d_viewport *viewport) +void CDECL wined3d_device_get_viewports(const struct wined3d_device *device, unsigned int *viewport_count, + struct wined3d_viewport *viewports) { - TRACE("device %p, viewport %p.\n", device, viewport); + unsigned int count;
- *viewport = device->state.viewports[0]; + TRACE("device %p, viewport_count %p, viewports %p.\n", device, viewport_count, viewports); + + count = viewport_count ? min(*viewport_count, device->state.viewport_count) : 1; + if (count && viewports) + memcpy(viewports, device->state.viewports, count * sizeof(*viewports)); + if (viewport_count) + *viewport_count = device->state.viewport_count; }
static void resolve_depth_buffer(struct wined3d_device *device) @@ -3139,7 +3146,7 @@ static HRESULT process_vertices_strided(const struct wined3d_device *device, DWO TRACE("%.8e %.8e %.8e %.8e\n", world_mat._41, world_mat._42, world_mat._43, world_mat._44);
/* Get the viewport */ - wined3d_device_get_viewport(device, &vp); + wined3d_device_get_viewports(device, NULL, &vp); TRACE("viewport x %.8e, y %.8e, width %.8e, height %.8e, min_z %.8e, max_z %.8e.\n", vp.x, vp.y, vp.width, vp.height, vp.min_z, vp.max_z);
diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec index b4c41cc59a..1b59178296 100644 --- a/dlls/wined3d/wined3d.spec +++ b/dlls/wined3d/wined3d.spec @@ -114,7 +114,7 @@ @ cdecl wined3d_device_get_unordered_access_view(ptr long) @ cdecl wined3d_device_get_vertex_declaration(ptr) @ cdecl wined3d_device_get_vertex_shader(ptr) -@ cdecl wined3d_device_get_viewport(ptr ptr) +@ cdecl wined3d_device_get_viewports(ptr ptr ptr) @ cdecl wined3d_device_get_vs_cb(ptr long) @ cdecl wined3d_device_get_vs_consts_b(ptr long long ptr) @ cdecl wined3d_device_get_vs_consts_f(ptr long long ptr) diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index 3539b4eb06..ccda987405 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -2324,7 +2324,8 @@ struct wined3d_unordered_access_view * __cdecl wined3d_device_get_unordered_acce const struct wined3d_device *device, unsigned int idx); struct wined3d_vertex_declaration * __cdecl wined3d_device_get_vertex_declaration(const struct wined3d_device *device); struct wined3d_shader * __cdecl wined3d_device_get_vertex_shader(const struct wined3d_device *device); -void __cdecl wined3d_device_get_viewport(const struct wined3d_device *device, struct wined3d_viewport *viewport); +void __cdecl wined3d_device_get_viewports(const struct wined3d_device *device, unsigned int *viewport_count, + struct wined3d_viewport *viewports); struct wined3d_buffer * __cdecl wined3d_device_get_vs_cb(const struct wined3d_device *device, UINT idx); HRESULT __cdecl wined3d_device_get_vs_consts_b(const struct wined3d_device *device, unsigned int start_idx, unsigned int count, BOOL *constants);