[PATCH 5/7] ddraw: Discard the dst vertex buffer if possible.
Stefan Dösinger
stefandoesinger at gmx.at
Sun Oct 30 09:02:25 CDT 2016
Signed-off-by: Stefan Dösinger <stefandoesinger at gmx.at>
---
Once we have buffer->buffer copies working we can load the source data
into a buffer in SetExecuteData and never have to lock the destination
buffer. We could even consider putting the entire execute buffer data in
a sysmem wined3d buffer and avoid a memcpy - but that would mean that
ddraw accesses the wined3d buffer while it is not locked.
---
dlls/ddraw/ddraw_private.h | 1 +
dlls/ddraw/executebuffer.c | 8 +++++---
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/dlls/ddraw/ddraw_private.h b/dlls/ddraw/ddraw_private.h
index 08ab8a2..3f07300 100644
--- a/dlls/ddraw/ddraw_private.h
+++ b/dlls/ddraw/ddraw_private.h
@@ -528,6 +528,7 @@ struct d3d_execute_buffer
unsigned int index_size, index_pos;
unsigned int vertex_size, src_vertex_pos;
struct wined3d_buffer *src_vertex_buffer, *dst_vertex_buffer, *index_buffer;
+ DWORD dst_vertex_map_flags;
/* This flags is set to TRUE if we allocated ourselves the
* data buffer
diff --git a/dlls/ddraw/executebuffer.c b/dlls/ddraw/executebuffer.c
index da4d6dc..9cdcdf2 100644
--- a/dlls/ddraw/executebuffer.c
+++ b/dlls/ddraw/executebuffer.c
@@ -327,7 +327,7 @@ HRESULT d3d_execute_buffer_execute(struct d3d_execute_buffer *buffer,
box.left = ci->wDest * sizeof(*src);
box.right = (ci->wDest + ci->dwCount) * sizeof(*src);
hr = wined3d_resource_map(wined3d_buffer_get_resource(buffer->dst_vertex_buffer), 0,
- &map_desc, &box, 0);
+ &map_desc, &box, buffer->dst_vertex_map_flags);
if (FAILED(hr))
return hr;
@@ -342,6 +342,7 @@ HRESULT d3d_execute_buffer_execute(struct d3d_execute_buffer *buffer,
}
instr += size;
+ buffer->dst_vertex_map_flags = 0;
}
break;
@@ -591,8 +592,8 @@ static HRESULT WINAPI d3d_execute_buffer_SetExecuteData(IDirect3DExecuteBuffer *
return hr;
hr = wined3d_buffer_create_vb(buffer->d3ddev->wined3d_device, new_size * sizeof(D3DTLVERTEX),
- WINED3DUSAGE_STATICDECL, WINED3D_POOL_DEFAULT,
- NULL, &ddraw_null_wined3d_parent_ops, &dst_buffer);
+ WINED3DUSAGE_STATICDECL | WINED3DUSAGE_DYNAMIC | WINED3DUSAGE_WRITEONLY,
+ WINED3D_POOL_DEFAULT, NULL, &ddraw_null_wined3d_parent_ops, &dst_buffer);
if (FAILED(hr))
{
wined3d_buffer_decref(src_buffer);
@@ -608,6 +609,7 @@ static HRESULT WINAPI d3d_execute_buffer_SetExecuteData(IDirect3DExecuteBuffer *
buffer->dst_vertex_buffer = dst_buffer;
buffer->vertex_size = new_size;
buffer->src_vertex_pos = 0;
+ buffer->dst_vertex_map_flags = WINED3D_MAP_DISCARD;
}
if (TRACE_ON(ddraw))
--
2.7.3
More information about the wine-patches
mailing list