Zebediah Figura (@zfigura) commented about dlls/ddraw/device.c:
* 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);- } else if (fvf != device->ddraw_device_buffer.fvf) {
/* Not the same fvf as the buffered one. Cannot buffer more of those */TRACE_(ddraw_perf)("Buffering failed due to mismatched fvf %ld != buffer.fvf %ld \n", fvf, device->ddraw_device_buffer.fvf);return WINED3DERR_NOTAVAILABLE;- } else if (primitive_type != device->ddraw_device_buffer.primitive_type) {
TRACE_(ddraw_perf)("Buffering failed due to mismatched primitive_type %d != buffer.primitive_type %d \n", primitive_type, device->ddraw_device_buffer.primitive_type);return WINED3DERR_NOTAVAILABLE;- }
Instead of returning false and retrying; I'd just flush here; that way you only need to call this function once, and it can't fail.