d3d10: 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:
parent
be106e5d80
commit
134d3f51fb
@ -4934,7 +4934,7 @@ float4 main(float4 color : COLOR) : SV_TARGET
|
|||||||
"Got unexpected scissor rect %s in slot %u.\n", wine_dbgstr_rect(&tmp_rect[i]), i);
|
"Got unexpected scissor rect %s in slot %u.\n", wine_dbgstr_rect(&tmp_rect[i]), i);
|
||||||
}
|
}
|
||||||
ID3D10Device_RSGetViewports(device, &count, NULL);
|
ID3D10Device_RSGetViewports(device, &count, NULL);
|
||||||
todo_wine ok(!count, "Got unexpected viewport count %u.\n", count);
|
ok(!count, "Got unexpected viewport count %u.\n", count);
|
||||||
memset(tmp_viewport, 0x55, sizeof(tmp_viewport));
|
memset(tmp_viewport, 0x55, sizeof(tmp_viewport));
|
||||||
count = D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE;
|
count = D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE;
|
||||||
ID3D10Device_RSGetViewports(device, &count, tmp_viewport);
|
ID3D10Device_RSGetViewports(device, &count, tmp_viewport);
|
||||||
@ -5329,7 +5329,7 @@ float4 main(float4 color : COLOR) : SV_TARGET
|
|||||||
"Got unexpected scissor rect %s in slot %u.\n", wine_dbgstr_rect(&tmp_rect[i]), i);
|
"Got unexpected scissor rect %s in slot %u.\n", wine_dbgstr_rect(&tmp_rect[i]), i);
|
||||||
}
|
}
|
||||||
ID3D10Device_RSGetViewports(device, &count, NULL);
|
ID3D10Device_RSGetViewports(device, &count, NULL);
|
||||||
todo_wine ok(count == D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE,
|
ok(count == D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE,
|
||||||
"Got unexpected viewport count %u.\n", count);
|
"Got unexpected viewport count %u.\n", count);
|
||||||
memset(tmp_viewport, 0x55, sizeof(tmp_viewport));
|
memset(tmp_viewport, 0x55, sizeof(tmp_viewport));
|
||||||
ID3D10Device_RSGetViewports(device, &count, tmp_viewport);
|
ID3D10Device_RSGetViewports(device, &count, tmp_viewport);
|
||||||
@ -5467,7 +5467,7 @@ float4 main(float4 color : COLOR) : SV_TARGET
|
|||||||
wine_dbgstr_rect(&tmp_rect[i]), i);
|
wine_dbgstr_rect(&tmp_rect[i]), i);
|
||||||
}
|
}
|
||||||
ID3D10Device_RSGetViewports(device, &count, NULL);
|
ID3D10Device_RSGetViewports(device, &count, NULL);
|
||||||
todo_wine ok(!count, "Got unexpected viewport count %u.\n", count);
|
ok(!count, "Got unexpected viewport count %u.\n", count);
|
||||||
memset(tmp_viewport, 0x55, sizeof(tmp_viewport));
|
memset(tmp_viewport, 0x55, sizeof(tmp_viewport));
|
||||||
count = D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE;
|
count = D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE;
|
||||||
ID3D10Device_RSGetViewports(device, &count, tmp_viewport);
|
ID3D10Device_RSGetViewports(device, &count, tmp_viewport);
|
||||||
@ -16330,6 +16330,10 @@ static void test_multiple_viewports(void)
|
|||||||
vp[1].Width = width;
|
vp[1].Width = width;
|
||||||
ID3D10Device_RSSetViewports(device, 2, vp);
|
ID3D10Device_RSSetViewports(device, 2, vp);
|
||||||
|
|
||||||
|
count = ARRAY_SIZE(vp);
|
||||||
|
ID3D10Device_RSGetViewports(device, &count, vp);
|
||||||
|
ok(count == 2, "Unexpected viewport count %d.\n", count);
|
||||||
|
|
||||||
constant.draw_id = 0;
|
constant.draw_id = 0;
|
||||||
ID3D10Device_UpdateSubresource(device, (ID3D10Resource *)cb, 0, NULL, &constant, 0, 0);
|
ID3D10Device_UpdateSubresource(device, (ID3D10Resource *)cb, 0, NULL, &constant, 0, 0);
|
||||||
draw_quad(&test_context);
|
draw_quad(&test_context);
|
||||||
@ -16379,7 +16383,6 @@ static void test_multiple_viewports(void)
|
|||||||
count = ARRAY_SIZE(vp);
|
count = ARRAY_SIZE(vp);
|
||||||
memset(vp, 0, sizeof(vp));
|
memset(vp, 0, sizeof(vp));
|
||||||
ID3D10Device_RSGetViewports(device, &count, vp);
|
ID3D10Device_RSGetViewports(device, &count, vp);
|
||||||
todo_wine
|
|
||||||
ok(count == 1, "Unexpected viewport count %d.\n", count);
|
ok(count == 1, "Unexpected viewport count %d.\n", count);
|
||||||
ok(vp[0].TopLeftX == 0.0f && vp[0].Width == width, "Unexpected viewport.\n");
|
ok(vp[0].TopLeftX == 0.0f && vp[0].Width == width, "Unexpected viewport.\n");
|
||||||
|
|
||||||
|
@ -4900,32 +4900,37 @@ static void STDMETHODCALLTYPE d3d10_device_RSGetViewports(ID3D10Device1 *iface,
|
|||||||
UINT *viewport_count, D3D10_VIEWPORT *viewports)
|
UINT *viewport_count, D3D10_VIEWPORT *viewports)
|
||||||
{
|
{
|
||||||
struct d3d_device *device = impl_from_ID3D10Device(iface);
|
struct d3d_device *device = impl_from_ID3D10Device(iface);
|
||||||
struct wined3d_viewport wined3d_vp;
|
struct wined3d_viewport wined3d_vp[WINED3D_MAX_VIEWPORTS];
|
||||||
|
unsigned int actual_count = ARRAY_SIZE(wined3d_vp), i;
|
||||||
|
|
||||||
TRACE("iface %p, viewport_count %p, viewports %p.\n", iface, viewport_count, viewports);
|
TRACE("iface %p, viewport_count %p, viewports %p.\n", iface, viewport_count, viewports);
|
||||||
|
|
||||||
if (!viewports)
|
if (!viewport_count)
|
||||||
{
|
|
||||||
*viewport_count = 1;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!*viewport_count)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wined3d_mutex_lock();
|
wined3d_mutex_lock();
|
||||||
wined3d_device_get_viewports(device->wined3d_device, NULL, &wined3d_vp);
|
wined3d_device_get_viewports(device->wined3d_device, &actual_count, viewports ? wined3d_vp : NULL);
|
||||||
wined3d_mutex_unlock();
|
wined3d_mutex_unlock();
|
||||||
|
|
||||||
viewports[0].TopLeftX = wined3d_vp.x;
|
if (!viewports)
|
||||||
viewports[0].TopLeftY = wined3d_vp.y;
|
{
|
||||||
viewports[0].Width = wined3d_vp.width;
|
*viewport_count = actual_count;
|
||||||
viewports[0].Height = wined3d_vp.height;
|
return;
|
||||||
viewports[0].MinDepth = wined3d_vp.min_z;
|
}
|
||||||
viewports[0].MaxDepth = wined3d_vp.max_z;
|
|
||||||
|
|
||||||
if (*viewport_count > 1)
|
if (*viewport_count > actual_count)
|
||||||
memset(&viewports[1], 0, (*viewport_count - 1) * sizeof(*viewports));
|
memset(&viewports[actual_count], 0, (*viewport_count - actual_count) * sizeof(*viewports));
|
||||||
|
|
||||||
|
*viewport_count = min(actual_count, *viewport_count);
|
||||||
|
for (i = 0; i < *viewport_count; ++i)
|
||||||
|
{
|
||||||
|
viewports[i].TopLeftX = wined3d_vp[i].x;
|
||||||
|
viewports[i].TopLeftY = wined3d_vp[i].y;
|
||||||
|
viewports[i].Width = wined3d_vp[i].width;
|
||||||
|
viewports[i].Height = wined3d_vp[i].height;
|
||||||
|
viewports[i].MinDepth = wined3d_vp[i].min_z;
|
||||||
|
viewports[i].MaxDepth = wined3d_vp[i].max_z;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void STDMETHODCALLTYPE d3d10_device_RSGetScissorRects(ID3D10Device1 *iface, UINT *rect_count, D3D10_RECT *rects)
|
static void STDMETHODCALLTYPE d3d10_device_RSGetScissorRects(ID3D10Device1 *iface, UINT *rect_count, D3D10_RECT *rects)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user