Commit 3b5ae3c5 authored by Chip Davis's avatar Chip Davis Committed by Alexandre Julliard

d3d8: Introduce a helper to convert d3d8 primitive types to wined3d types.

parent 37e8cf5d
......@@ -449,6 +449,11 @@ static enum wined3d_render_state wined3d_render_state_from_d3d(D3DRENDERSTATETYP
return (enum wined3d_render_state)state;
}
static enum wined3d_primitive_type wined3d_primitive_type_from_d3d(D3DPRIMITIVETYPE type)
{
return (enum wined3d_primitive_type)type;
}
/* Handle table functions */
static DWORD d3d8_allocate_handle(struct d3d8_handle_table *t, void *object, enum d3d8_handle_type type)
{
......@@ -2479,7 +2484,7 @@ static HRESULT WINAPI d3d8_device_DrawPrimitive(IDirect3DDevice8 *iface,
vertex_count = vertex_count_from_primitive_count(primitive_type, primitive_count);
wined3d_mutex_lock();
d3d8_device_upload_sysmem_vertex_buffers(device, start_vertex, vertex_count);
wined3d_device_set_primitive_type(device->wined3d_device, primitive_type, 0);
wined3d_device_set_primitive_type(device->wined3d_device, wined3d_primitive_type_from_d3d(primitive_type), 0);
wined3d_device_apply_stateblock(device->wined3d_device, device->state);
hr = wined3d_device_draw_primitive(device->wined3d_device, start_vertex, vertex_count);
wined3d_mutex_unlock();
......@@ -2504,7 +2509,7 @@ static HRESULT WINAPI d3d8_device_DrawIndexedPrimitive(IDirect3DDevice8 *iface,
base_vertex_index = device->stateblock_state->base_vertex_index;
d3d8_device_upload_sysmem_vertex_buffers(device, base_vertex_index + min_vertex_idx, vertex_count);
d3d8_device_upload_sysmem_index_buffer(device, start_idx, index_count);
wined3d_device_set_primitive_type(device->wined3d_device, primitive_type, 0);
wined3d_device_set_primitive_type(device->wined3d_device, wined3d_primitive_type_from_d3d(primitive_type), 0);
wined3d_device_apply_stateblock(device->wined3d_device, device->state);
hr = wined3d_device_draw_indexed_primitive(device->wined3d_device, start_idx, index_count);
wined3d_mutex_unlock();
......@@ -2598,7 +2603,7 @@ static HRESULT WINAPI d3d8_device_DrawPrimitiveUP(IDirect3DDevice8 *iface,
if (FAILED(hr))
goto done;
wined3d_device_set_primitive_type(device->wined3d_device, primitive_type, 0);
wined3d_device_set_primitive_type(device->wined3d_device, wined3d_primitive_type_from_d3d(primitive_type), 0);
wined3d_device_apply_stateblock(device->wined3d_device, device->state);
hr = wined3d_device_draw_primitive(device->wined3d_device, vb_pos / stride, vtx_count);
wined3d_stateblock_set_stream_source(device->state, 0, NULL, 0, 0);
......@@ -2726,7 +2731,7 @@ static HRESULT WINAPI d3d8_device_DrawIndexedPrimitiveUP(IDirect3DDevice8 *iface
wined3dformat_from_d3dformat(index_format));
wined3d_stateblock_set_base_vertex_index(device->state, vb_pos / vertex_stride - min_vertex_idx);
wined3d_device_set_primitive_type(device->wined3d_device, primitive_type, 0);
wined3d_device_set_primitive_type(device->wined3d_device, wined3d_primitive_type_from_d3d(primitive_type), 0);
wined3d_device_apply_stateblock(device->wined3d_device, device->state);
hr = wined3d_device_draw_indexed_primitive(device->wined3d_device, ib_pos / idx_fmt_size, idx_count);
......
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