d3d8: Use resource mapping functions in d3d8_device_DrawIndexedPrimitiveUP().
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
0338e10a73
commit
2adcec346c
|
@ -2122,11 +2122,12 @@ static HRESULT WINAPI d3d8_device_DrawIndexedPrimitiveUP(IDirect3DDevice8 *iface
|
|||
{
|
||||
struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
|
||||
HRESULT hr;
|
||||
BYTE *buffer_data;
|
||||
|
||||
UINT idx_count = vertex_count_from_primitive_count(primitive_type, primitive_count);
|
||||
UINT idx_fmt_size = index_format == D3DFMT_INDEX16 ? 2 : 4;
|
||||
UINT idx_size = idx_count * idx_fmt_size;
|
||||
struct wined3d_map_desc wined3d_map_desc;
|
||||
struct wined3d_box wined3d_box = {0};
|
||||
struct wined3d_resource *ib, *vb;
|
||||
UINT ib_pos;
|
||||
|
||||
UINT vtx_size = vertex_count * vertex_stride;
|
||||
|
@ -2157,12 +2158,14 @@ static HRESULT WINAPI d3d8_device_DrawIndexedPrimitiveUP(IDirect3DDevice8 *iface
|
|||
else
|
||||
vb_pos += align;
|
||||
|
||||
hr = wined3d_buffer_map(device->vertex_buffer, vb_pos, vtx_size, &buffer_data,
|
||||
vb_pos ? WINED3D_MAP_NOOVERWRITE : WINED3D_MAP_DISCARD);
|
||||
if (FAILED(hr))
|
||||
wined3d_box.left = vb_pos;
|
||||
wined3d_box.right = vb_pos + vtx_size;
|
||||
vb = wined3d_buffer_get_resource(device->vertex_buffer);
|
||||
if (FAILED(hr = wined3d_resource_map(vb, 0, &wined3d_map_desc, &wined3d_box,
|
||||
vb_pos ? WINED3D_MAP_NOOVERWRITE : WINED3D_MAP_DISCARD)))
|
||||
goto done;
|
||||
memcpy(buffer_data, vertex_data, vtx_size);
|
||||
wined3d_buffer_unmap(device->vertex_buffer);
|
||||
memcpy(wined3d_map_desc.data, vertex_data, vtx_size);
|
||||
wined3d_resource_unmap(vb, 0);
|
||||
device->vertex_buffer_pos = vb_pos + vtx_size;
|
||||
|
||||
hr = d3d8_device_prepare_index_buffer(device, idx_size);
|
||||
|
@ -2177,12 +2180,14 @@ static HRESULT WINAPI d3d8_device_DrawIndexedPrimitiveUP(IDirect3DDevice8 *iface
|
|||
else
|
||||
ib_pos += align;
|
||||
|
||||
hr = wined3d_buffer_map(device->index_buffer, ib_pos, idx_size, &buffer_data,
|
||||
ib_pos ? WINED3D_MAP_NOOVERWRITE : WINED3D_MAP_DISCARD);
|
||||
if (FAILED(hr))
|
||||
wined3d_box.left = ib_pos;
|
||||
wined3d_box.right = ib_pos + idx_size;
|
||||
ib = wined3d_buffer_get_resource(device->index_buffer);
|
||||
if (FAILED(hr = wined3d_resource_map(ib, 0, &wined3d_map_desc, &wined3d_box,
|
||||
ib_pos ? WINED3D_MAP_NOOVERWRITE : WINED3D_MAP_DISCARD)))
|
||||
goto done;
|
||||
memcpy(buffer_data, index_data, idx_size);
|
||||
wined3d_buffer_unmap(device->index_buffer);
|
||||
memcpy(wined3d_map_desc.data, index_data, idx_size);
|
||||
wined3d_resource_unmap(ib, 0);
|
||||
device->index_buffer_pos = ib_pos + idx_size;
|
||||
|
||||
hr = wined3d_device_set_stream_source(device->wined3d_device, 0, device->vertex_buffer, 0, vertex_stride);
|
||||
|
|
Loading…
Reference in New Issue