ddraw: Fix vertex count in d3d_device3_DrawIndexedPrimitiveVB().

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47129
Signed-off-by: Paul Gofman <gofmanp@gmail.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Paul Gofman 2019-05-07 21:57:53 +03:00 committed by Alexandre Julliard
parent 622422e67b
commit 08d630e250
2 changed files with 19 additions and 10 deletions

View File

@ -4518,19 +4518,24 @@ static HRESULT WINAPI d3d_device7_DrawIndexedPrimitiveVB_FPUPreserve(IDirect3DDe
}
static HRESULT WINAPI d3d_device3_DrawIndexedPrimitiveVB(IDirect3DDevice3 *iface,
D3DPRIMITIVETYPE PrimitiveType, IDirect3DVertexBuffer *D3DVertexBuf, WORD *Indices,
DWORD IndexCount, DWORD Flags)
D3DPRIMITIVETYPE primitive_type, IDirect3DVertexBuffer *vertex_buffer,
WORD *indices, DWORD index_count, DWORD flags)
{
struct d3d_vertex_buffer *vb =
unsafe_impl_from_IDirect3DVertexBuffer7((IDirect3DVertexBuffer7 *)vertex_buffer);
struct d3d_device *device = impl_from_IDirect3DDevice3(iface);
struct d3d_vertex_buffer *vb = unsafe_impl_from_IDirect3DVertexBuffer7((IDirect3DVertexBuffer7 *)D3DVertexBuf);
DWORD stride;
TRACE("iface %p, primitive_type %#x, vb %p, indices %p, index_count %u, flags %#x.\n",
iface, PrimitiveType, D3DVertexBuf, Indices, IndexCount, Flags);
iface, primitive_type, vertex_buffer, indices, index_count, flags);
setup_lighting(device, vb->fvf, Flags);
setup_lighting(device, vb->fvf, flags);
return IDirect3DDevice7_DrawIndexedPrimitiveVB(&device->IDirect3DDevice7_iface, PrimitiveType,
&vb->IDirect3DVertexBuffer7_iface, 0, IndexCount, Indices, IndexCount, Flags);
if (!(stride = get_flexible_vertex_size(vb->fvf)))
return D3D_OK;
return IDirect3DDevice7_DrawIndexedPrimitiveVB(&device->IDirect3DDevice7_iface, primitive_type,
&vb->IDirect3DVertexBuffer7_iface, 0, vb->size / stride, indices, index_count, flags);
}
/*****************************************************************************

View File

@ -15523,12 +15523,16 @@ static void test_sysmem_draw(void)
}
quad[] =
{
{{ 0.0f, 0.0f, 0.0f}, 0x00000000},
{{ 0.0f, 0.0f, 0.0f}, 0x00000000},
{{ 0.0f, 0.0f, 0.0f}, 0x00000000},
{{ 0.0f, 0.0f, 0.0f}, 0x00000000},
{{-1.0f, -1.0f, 0.0f}, 0xffff0000},
{{-1.0f, 1.0f, 0.0f}, 0xff00ff00},
{{ 1.0f, -1.0f, 0.0f}, 0xff0000ff},
{{ 1.0f, 1.0f, 0.0f}, 0xffffffff},
};
static WORD indices[] = {0, 1, 2, 3};
static WORD indices[] = {4, 5, 6, 7};
window = create_window();
ok(!!window, "Failed to create a window.\n");
@ -15557,7 +15561,7 @@ static void test_sysmem_draw(void)
vb_desc.dwSize = sizeof(vb_desc);
vb_desc.dwCaps = D3DVBCAPS_SYSTEMMEMORY;
vb_desc.dwFVF = D3DFVF_XYZ | D3DFVF_DIFFUSE;
vb_desc.dwNumVertices = 4;
vb_desc.dwNumVertices = ARRAY_SIZE(quad);
hr = IDirect3D3_CreateVertexBuffer(d3d, &vb_desc, &vb, 0, NULL);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@ -15572,7 +15576,7 @@ static void test_sysmem_draw(void)
hr = IDirect3DDevice3_BeginScene(device);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DDevice3_DrawPrimitiveVB(device, D3DPT_TRIANGLESTRIP, vb, 0, 4, 0);
hr = IDirect3DDevice3_DrawPrimitiveVB(device, D3DPT_TRIANGLESTRIP, vb, 4, 4, 0);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DDevice3_EndScene(device);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);