Commit f72b682d authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

ddraw: Use resource mapping functions in d3d_device7_DrawPrimitiveStrided().

parent 16a20955
...@@ -4030,8 +4030,10 @@ static HRESULT d3d_device7_DrawPrimitiveStrided(IDirect3DDevice7 *iface, D3DPRIM ...@@ -4030,8 +4030,10 @@ static HRESULT d3d_device7_DrawPrimitiveStrided(IDirect3DDevice7 *iface, D3DPRIM
HRESULT hr; HRESULT hr;
UINT dst_stride = get_flexible_vertex_size(fvf); UINT dst_stride = get_flexible_vertex_size(fvf);
UINT dst_size = dst_stride * vertex_count; UINT dst_size = dst_stride * vertex_count;
struct wined3d_map_desc wined3d_map_desc;
struct wined3d_box wined3d_box = {0};
struct wined3d_resource *vb;
UINT vb_pos, align; UINT vb_pos, align;
BYTE *dst_data;
TRACE("iface %p, primitive_type %#x, fvf %#x, strided_data %p, vertex_count %u, flags %#x.\n", TRACE("iface %p, primitive_type %#x, fvf %#x, strided_data %p, vertex_count %u, flags %#x.\n",
iface, primitive_type, fvf, strided_data, vertex_count, flags); iface, primitive_type, fvf, strided_data, vertex_count, flags);
...@@ -4055,12 +4057,14 @@ static HRESULT d3d_device7_DrawPrimitiveStrided(IDirect3DDevice7 *iface, D3DPRIM ...@@ -4055,12 +4057,14 @@ static HRESULT d3d_device7_DrawPrimitiveStrided(IDirect3DDevice7 *iface, D3DPRIM
else else
vb_pos += align; vb_pos += align;
hr = wined3d_buffer_map(device->vertex_buffer, vb_pos, dst_size, &dst_data, wined3d_box.left = vb_pos;
vb_pos ? WINED3D_MAP_NOOVERWRITE : WINED3D_MAP_DISCARD); wined3d_box.right = vb_pos + dst_size;
if (FAILED(hr)) 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; goto done;
pack_strided_data(dst_data, vertex_count, strided_data, fvf); pack_strided_data(wined3d_map_desc.data, vertex_count, strided_data, fvf);
wined3d_buffer_unmap(device->vertex_buffer); wined3d_resource_unmap(vb, 0);
device->vertex_buffer_pos = vb_pos + dst_size; device->vertex_buffer_pos = vb_pos + dst_size;
hr = wined3d_device_set_stream_source(device->wined3d_device, 0, device->vertex_buffer, 0, dst_stride); hr = wined3d_device_set_stream_source(device->wined3d_device, 0, device->vertex_buffer, 0, dst_stride);
......
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