Commit b67870b7 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

wined3d: Add support for returning multiple viewports.

parent 2293faba
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
......@@ -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);
......
......@@ -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)
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment