On Wed, Dec 12, 2018 at 5:10 PM Matteo Bruni mbruni@codeweavers.com wrote:
+static void d3d9_device_upload_sysmem_buffers(struct d3d9_device *device,
unsigned int start_vertex, unsigned int vertex_count)
+{
- struct wined3d_box box = {0, 0, 0, 1, 0, 1};
- struct d3d9_vertexbuffer *d3d9_buffer;
- unsigned int i, offset, stride, map;
- struct wined3d_buffer *dst_buffer;
- HRESULT hr;
- map = device->upload_map;
- while (map)
- {
i = ffs(map) - 1;
map ^= 1u << i;
if (FAILED(hr = wined3d_device_get_stream_source(device->wined3d_device, i, &dst_buffer, &offset, &stride)))
ERR("Failed to get stream source.\n");
d3d9_buffer = wined3d_buffer_get_parent(dst_buffer);
box.left = offset + start_vertex * stride;
box.right = box.left + vertex_count * stride;
if (FAILED(hr = wined3d_device_copy_sub_resource_region(device->wined3d_device,
wined3d_buffer_get_resource(dst_buffer), 0, box.left, 0, 0,
wined3d_buffer_get_resource(d3d9_buffer->wined3d_buffer), 0, &box, 0)))
ERR("Failed to update buffer.\n");
- }
+}
It looks like this might stall the rendering pipeline frequently, i.e. we will be updating the same draw buffers continuously between subsequent draw calls with system memory buffers. I am not sure how important it is in practice.