Commit 1519977d authored by Józef Kucia's avatar Józef Kucia Committed by Alexandre Julliard

d3d9: Upload vertex buffer range relative to base vertex index.

Fixes a regression introduced by b18a53a5. Signed-off-by: 's avatarJózef Kucia <jkucia@codeweavers.com> Signed-off-by: 's avatarHenri Verbeet <hverbeet@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent ce8ef46a
......@@ -2708,7 +2708,7 @@ static void d3d9_generate_auto_mipmaps(struct d3d9_device *device)
}
static void d3d9_device_upload_sysmem_vertex_buffers(struct d3d9_device *device,
unsigned int start_vertex, unsigned int vertex_count)
int base_vertex, unsigned int start_vertex, unsigned int vertex_count)
{
struct wined3d_box box = {0, 0, 0, 1, 0, 1};
struct d3d9_vertexbuffer *d3d9_buffer;
......@@ -2716,6 +2716,14 @@ static void d3d9_device_upload_sysmem_vertex_buffers(struct d3d9_device *device,
struct wined3d_buffer *dst_buffer;
HRESULT hr;
if (!device->sysmem_vb)
return;
if (base_vertex >= 0 || start_vertex >= -base_vertex)
start_vertex += base_vertex;
else
FIXME("System memory vertex data offset is negative.\n");
map = device->sysmem_vb;
while (map)
{
......@@ -2777,7 +2785,7 @@ static HRESULT WINAPI d3d9_device_DrawPrimitive(IDirect3DDevice9Ex *iface,
return D3DERR_INVALIDCALL;
}
vertex_count = vertex_count_from_primitive_count(primitive_type, primitive_count);
d3d9_device_upload_sysmem_vertex_buffers(device, start_vertex, vertex_count);
d3d9_device_upload_sysmem_vertex_buffers(device, 0, start_vertex, vertex_count);
d3d9_generate_auto_mipmaps(device);
wined3d_device_set_primitive_type(device->wined3d_device, primitive_type, 0);
hr = wined3d_device_draw_primitive(device->wined3d_device, start_vertex, vertex_count);
......@@ -2809,7 +2817,7 @@ static HRESULT WINAPI d3d9_device_DrawIndexedPrimitive(IDirect3DDevice9Ex *iface
return D3DERR_INVALIDCALL;
}
index_count = vertex_count_from_primitive_count(primitive_type, primitive_count);
d3d9_device_upload_sysmem_vertex_buffers(device, min_vertex_idx, vertex_count);
d3d9_device_upload_sysmem_vertex_buffers(device, base_vertex_idx, min_vertex_idx, vertex_count);
d3d9_device_upload_sysmem_index_buffer(device, start_idx, index_count);
d3d9_generate_auto_mipmaps(device);
wined3d_device_set_base_vertex_index(device->wined3d_device, base_vertex_idx);
......
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