wined3d: Add support for returning multiple viewports.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2018-04-18 12:50:45 +03:00 committed by Alexandre Julliard
parent 2293fabad1
commit b67870b7a7
7 changed files with 19 additions and 11 deletions

View File

@ -2107,7 +2107,7 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_RSGetViewports(ID3D11Devic
return; return;
wined3d_mutex_lock(); 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(); wined3d_mutex_unlock();
viewports[0].TopLeftX = wined3d_vp.x; viewports[0].TopLeftX = wined3d_vp.x;
@ -4909,7 +4909,7 @@ static void STDMETHODCALLTYPE d3d10_device_RSGetViewports(ID3D10Device1 *iface,
return; return;
wined3d_mutex_lock(); 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(); wined3d_mutex_unlock();
viewports[0].TopLeftX = wined3d_vp.x; viewports[0].TopLeftX = wined3d_vp.x;

View File

@ -1664,7 +1664,7 @@ static HRESULT WINAPI d3d8_device_GetViewport(IDirect3DDevice8 *iface, D3DVIEWPO
TRACE("iface %p, viewport %p.\n", iface, viewport); TRACE("iface %p, viewport %p.\n", iface, viewport);
wined3d_mutex_lock(); 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(); wined3d_mutex_unlock();
viewport->X = wined3d_viewport.x; viewport->X = wined3d_viewport.x;

View File

@ -2082,7 +2082,7 @@ static HRESULT WINAPI d3d9_device_GetViewport(IDirect3DDevice9Ex *iface, D3DVIEW
TRACE("iface %p, viewport %p.\n", iface, viewport); TRACE("iface %p, viewport %p.\n", iface, viewport);
wined3d_mutex_lock(); 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(); wined3d_mutex_unlock();
viewport->X = wined3d_viewport.x; viewport->X = wined3d_viewport.x;

View File

@ -5367,7 +5367,7 @@ static HRESULT d3d_device7_GetViewport(IDirect3DDevice7 *iface, D3DVIEWPORT7 *vi
return DDERR_INVALIDPARAMS; return DDERR_INVALIDPARAMS;
wined3d_mutex_lock(); 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(); wined3d_mutex_unlock();
viewport->dwX = wined3d_viewport.x; viewport->dwX = wined3d_viewport.x;

View File

@ -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); 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) 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); TRACE("%.8e %.8e %.8e %.8e\n", world_mat._41, world_mat._42, world_mat._43, world_mat._44);
/* Get the viewport */ /* 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", 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); vp.x, vp.y, vp.width, vp.height, vp.min_z, vp.max_z);

View File

@ -114,7 +114,7 @@
@ cdecl wined3d_device_get_unordered_access_view(ptr long) @ cdecl wined3d_device_get_unordered_access_view(ptr long)
@ cdecl wined3d_device_get_vertex_declaration(ptr) @ cdecl wined3d_device_get_vertex_declaration(ptr)
@ cdecl wined3d_device_get_vertex_shader(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_cb(ptr long)
@ cdecl wined3d_device_get_vs_consts_b(ptr long long ptr) @ cdecl wined3d_device_get_vs_consts_b(ptr long long ptr)
@ cdecl wined3d_device_get_vs_consts_f(ptr long long ptr) @ cdecl wined3d_device_get_vs_consts_f(ptr long long ptr)

View File

@ -2324,7 +2324,8 @@ struct wined3d_unordered_access_view * __cdecl wined3d_device_get_unordered_acce
const struct wined3d_device *device, unsigned int idx); 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_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); 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); 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, HRESULT __cdecl wined3d_device_get_vs_consts_b(const struct wined3d_device *device,
unsigned int start_idx, unsigned int count, BOOL *constants); unsigned int start_idx, unsigned int count, BOOL *constants);