d3d11: Add support for returning multiple scissor rectangles.

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-26 10:58:40 +03:00 committed by Alexandre Julliard
parent 3ee3324c2f
commit a1c2cd0154
4 changed files with 40 additions and 38 deletions

View File

@ -4924,7 +4924,7 @@ float4 main(float4 color : COLOR) : SV_TARGET
ok(!tmp_dsv, "Got unexpected depth stencil view %p.\n", tmp_dsv);
ID3D10Device_RSGetScissorRects(device, &count, NULL);
todo_wine ok(!count, "Got unexpected scissor rect count %u.\n", count);
ok(!count, "Got unexpected scissor rect count %u.\n", count);
memset(tmp_rect, 0x55, sizeof(tmp_rect));
count = D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE;
ID3D10Device_RSGetScissorRects(device, &count, tmp_rect);
@ -5316,7 +5316,7 @@ float4 main(float4 color : COLOR) : SV_TARGET
ID3D10DepthStencilView_Release(tmp_dsv);
ID3D10Device_RSGetScissorRects(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 scissor rect count %u.\n", count);
memset(tmp_rect, 0x55, sizeof(tmp_rect));
ID3D10Device_RSGetScissorRects(device, &count, tmp_rect);
@ -5455,16 +5455,15 @@ float4 main(float4 color : COLOR) : SV_TARGET
ok(!tmp_dsv, "Got unexpected depth stencil view %p.\n", tmp_dsv);
ID3D10Device_RSGetScissorRects(device, &count, NULL);
todo_wine ok(!count, "Got unexpected scissor rect count %u.\n", count);
ok(!count, "Got unexpected scissor rect count %u.\n", count);
memset(tmp_rect, 0x55, sizeof(tmp_rect));
count = D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE;
ID3D10Device_RSGetScissorRects(device, &count, tmp_rect);
for (i = 0; i < D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE; ++i)
{
todo_wine_if(!i)
ok(!tmp_rect[i].left && !tmp_rect[i].top && !tmp_rect[i].right && !tmp_rect[i].bottom,
"Got unexpected scissor rect %s in slot %u.\n",
wine_dbgstr_rect(&tmp_rect[i]), i);
ok(!tmp_rect[i].left && !tmp_rect[i].top && !tmp_rect[i].right && !tmp_rect[i].bottom,
"Got unexpected scissor rect %s in slot %u.\n",
wine_dbgstr_rect(&tmp_rect[i]), i);
}
ID3D10Device_RSGetViewports(device, &count, NULL);
ok(!count, "Got unexpected viewport count %u.\n", count);

View File

@ -2127,23 +2127,25 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_RSGetScissorRects(ID3D11De
UINT *rect_count, D3D11_RECT *rects)
{
struct d3d_device *device = device_from_immediate_ID3D11DeviceContext(iface);
unsigned int actual_count;
TRACE("iface %p, rect_count %p, rects %p.\n", iface, rect_count, rects);
if (!rects)
{
*rect_count = 1;
return;
}
if (!*rect_count)
if (!rect_count)
return;
wined3d_mutex_lock();
wined3d_device_get_scissor_rects(device->wined3d_device, NULL, rects);
wined3d_device_get_scissor_rects(device->wined3d_device, &actual_count, rects);
wined3d_mutex_unlock();
if (*rect_count > 1)
memset(&rects[1], 0, (*rect_count - 1) * sizeof(*rects));
if (!rects)
{
*rect_count = actual_count;
return;
}
if (*rect_count > actual_count)
memset(&rects[actual_count], 0, (*rect_count - actual_count) * sizeof(*rects));
}
static void STDMETHODCALLTYPE d3d11_immediate_context_HSGetShaderResources(ID3D11DeviceContext *iface,
@ -4930,23 +4932,25 @@ static void STDMETHODCALLTYPE d3d10_device_RSGetViewports(ID3D10Device1 *iface,
static void STDMETHODCALLTYPE d3d10_device_RSGetScissorRects(ID3D10Device1 *iface, UINT *rect_count, D3D10_RECT *rects)
{
struct d3d_device *device = impl_from_ID3D10Device(iface);
unsigned int actual_count;
TRACE("iface %p, rect_count %p, rects %p.\n", iface, rect_count, rects);
if (!rects)
{
*rect_count = 1;
return;
}
if (!*rect_count)
if (!rect_count)
return;
wined3d_mutex_lock();
wined3d_device_get_scissor_rects(device->wined3d_device, NULL, rects);
wined3d_device_get_scissor_rects(device->wined3d_device, &actual_count, rects);
wined3d_mutex_unlock();
if (*rect_count > 1)
memset(&rects[1], 0, (*rect_count - 1) * sizeof(*rects));
if (!rects)
{
*rect_count = actual_count;
return;
}
if (*rect_count > actual_count)
memset(&rects[actual_count], 0, (*rect_count - actual_count) * sizeof(*rects));
}
static HRESULT STDMETHODCALLTYPE d3d10_device_GetDeviceRemovedReason(ID3D10Device1 *iface)

View File

@ -9808,7 +9808,7 @@ static void test_clear_state(void)
}
ID3D11DeviceContext_RSGetScissorRects(context, &count, NULL);
todo_wine ok(!count, "Got unexpected scissor rect count %u.\n", count);
ok(!count, "Got unexpected scissor rect count %u.\n", count);
memset(tmp_rect, 0x55, sizeof(tmp_rect));
count = D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE;
ID3D11DeviceContext_RSGetScissorRects(context, &count, tmp_rect);
@ -10337,7 +10337,7 @@ static void test_clear_state(void)
ID3D11UnorderedAccessView_Release(tmp_uav[i]);
ID3D11DeviceContext_RSGetScissorRects(context, &count, NULL);
todo_wine ok(count == D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE,
ok(count == D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE,
"Got unexpected scissor rect count %u.\n", count);
memset(tmp_rect, 0x55, sizeof(tmp_rect));
ID3D11DeviceContext_RSGetScissorRects(context, &count, tmp_rect);
@ -10557,7 +10557,7 @@ static void test_clear_state(void)
}
ID3D11DeviceContext_RSGetScissorRects(context, &count, NULL);
todo_wine ok(!count, "Got unexpected scissor rect count %u.\n", count);
ok(!count, "Got unexpected scissor rect count %u.\n", count);
memset(tmp_rect, 0x55, sizeof(tmp_rect));
count = D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE;
ID3D11DeviceContext_RSGetScissorRects(context, &count, tmp_rect);

View File

@ -510,20 +510,19 @@ float4 main(float4 color : COLOR) : SV_TARGET
ok(!tmp_dsv, "Got unexpected depth stencil view %p.\n", tmp_dsv);
ID3D10Device_RSGetScissorRects(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 scissor rect count %u.\n", count);
memset(tmp_rect, 0x55, sizeof(tmp_rect));
count = D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE;
ID3D10Device_RSGetScissorRects(device, &count, tmp_rect);
for (i = 0; i < D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE; ++i)
{
todo_wine_if(i)
ok(tmp_rect[i].left == i
&& tmp_rect[i].top == i * 2
&& tmp_rect[i].right == i + 1
&& tmp_rect[i].bottom == (i + 1) * 2,
"Got unexpected scissor rect %s in slot %u.\n",
wine_dbgstr_rect(&tmp_rect[i]), i);
ok(tmp_rect[i].left == i
&& tmp_rect[i].top == i * 2
&& tmp_rect[i].right == i + 1
&& tmp_rect[i].bottom == (i + 1) * 2,
"Got unexpected scissor rect %s in slot %u.\n",
wine_dbgstr_rect(&tmp_rect[i]), i);
}
ID3D10Device_RSGetViewports(device, &count, NULL);
ok(count == D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE,