Zebediah Figura (@zfigura) commented about dlls/ddraw/device.c:
+ device->ddraw_device_buffer.primitive_type = primitive_type; + device->ddraw_device_buffer.fvf = fvf; + device->ddraw_device_buffer.stride = stride; + + /* We map & unmap directly. + * That way, we only reserve the space and other calls will have a new one. + * It should not happen, but let's be safe. + * + * We will fill it with following calls */ + wined3d_streaming_buffer_map(device->wined3d_device, &device->vertex_buffer, D3DMAXNUMVERTICES, stride, + &device->ddraw_device_buffer.vertex_buffer_pos, (void**) &device->ddraw_device_buffer.buffer_vertices); + wined3d_streaming_buffer_unmap(&device->vertex_buffer); + + wined3d_streaming_buffer_map(device->wined3d_device, &device->index_buffer, D3DMAXNUMVERTICES, sizeof(*device->ddraw_device_buffer.buffer_indices), + &device->ddraw_device_buffer.idx_buffer_pos, (void**) &device->ddraw_device_buffer.buffer_indices); + wined3d_streaming_buffer_unmap(&device->index_buffer); This isn't legal I'm afraid; you need to unmap *after* writing data to the buffer.
I also noticed a potential problem I hadn't considered when suggesting this approach: the streaming buffer is kind of a ring buffer, so if we run into the end, we'll need to flush before writing more data. Probably we should add an extra argument to wined3d_streaming_buffer_map() so it'll return an error if we're going to run over the end of the buffer. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/2105#note_24900