ddraw: Return early in d3d_device7_DrawIndexedPrimitive() with a 0 vertex or index count.

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2016-04-22 17:11:49 +02:00 committed by Alexandre Julliard
parent 41975efef6
commit af4e471ef1
4 changed files with 13 additions and 7 deletions

View File

@ -3689,6 +3689,12 @@ static HRESULT d3d_device7_DrawIndexedPrimitive(IDirect3DDevice7 *iface,
"indices %p, index_count %u, flags %#x.\n",
iface, primitive_type, fvf, vertices, vertex_count, indices, index_count, flags);
if (!vertex_count || !index_count)
{
WARN("0 vertex or index count.\n");
return D3D_OK;
}
/* Set the D3DDevice's FVF */
wined3d_mutex_lock();

View File

@ -10132,15 +10132,15 @@ static void test_draw_primitive(void)
IDirect3D2_Release(d3d);
hr = IDirect3DDevice2_DrawIndexedPrimitive(device, D3DPT_TRIANGLESTRIP, D3DFVF_XYZ, NULL, 0, NULL, 0, 0);
todo_wine ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr);
ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr);
hr = IDirect3DDevice2_DrawPrimitive(device, D3DPT_TRIANGLESTRIP, D3DFVF_XYZ, NULL, 0, 0);
todo_wine ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr);
hr = IDirect3DDevice2_DrawIndexedPrimitive(device, D3DPT_TRIANGLESTRIP, D3DFVF_XYZ, NULL, 0, indices, 4, 0);
todo_wine ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr);
ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr);
hr = IDirect3DDevice2_DrawIndexedPrimitive(device, D3DPT_TRIANGLESTRIP, D3DFVF_XYZ, quad, 4, NULL, 0, 0);
todo_wine ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr);
ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr);
hr = IDirect3DDevice2_DrawPrimitive(device, D3DPT_TRIANGLESTRIP, D3DFVF_XYZ, quad, 4, 0);
ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr);
hr = IDirect3DDevice2_DrawIndexedPrimitive(device, D3DPT_TRIANGLESTRIP, D3DFVF_XYZ, quad, 4, indices, 4, 0);

View File

@ -11420,7 +11420,7 @@ static void test_draw_primitive(void)
memset(&strided, 0, sizeof(strided));
hr = IDirect3DDevice3_DrawIndexedPrimitive(device, D3DPT_TRIANGLESTRIP, D3DFVF_XYZ, NULL, 0, NULL, 0, 0);
todo_wine ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr);
ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr);
hr = IDirect3DDevice3_DrawIndexedPrimitiveStrided(device,
D3DPT_TRIANGLESTRIP, D3DFVF_XYZ, &strided, 0, NULL, 0, 0);
ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr);
@ -11434,7 +11434,7 @@ static void test_draw_primitive(void)
ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr);
hr = IDirect3DDevice3_DrawIndexedPrimitive(device, D3DPT_TRIANGLESTRIP, D3DFVF_XYZ, NULL, 0, indices, 4, 0);
todo_wine ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr);
ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr);
hr = IDirect3DDevice3_DrawIndexedPrimitiveStrided(device,
D3DPT_TRIANGLESTRIP, D3DFVF_XYZ, &strided, 0, indices, 4, 0);
ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr);

View File

@ -11685,7 +11685,7 @@ static void test_draw_primitive(void)
memset(&strided, 0, sizeof(strided));
hr = IDirect3DDevice7_DrawIndexedPrimitive(device, D3DPT_TRIANGLESTRIP, D3DFVF_XYZ, NULL, 0, NULL, 0, 0);
todo_wine ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr);
ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr);
hr = IDirect3DDevice7_DrawIndexedPrimitiveStrided(device,
D3DPT_TRIANGLESTRIP, D3DFVF_XYZ, &strided, 0, NULL, 0, 0);
ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr);
@ -11701,7 +11701,7 @@ static void test_draw_primitive(void)
ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr);
hr = IDirect3DDevice7_DrawIndexedPrimitive(device, D3DPT_TRIANGLESTRIP, D3DFVF_XYZ, NULL, 0, indices, 4, 0);
todo_wine ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr);
ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr);
hr = IDirect3DDevice7_DrawIndexedPrimitiveStrided(device,
D3DPT_TRIANGLESTRIP, D3DFVF_XYZ, &strided, 0, indices, 4, 0);
ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr);