Signed-off-by: Henri Verbeet hverbeet@codeweavers.com --- dlls/ddraw/ddraw_private.h | 1 + dlls/ddraw/surface.c | 3 ++- dlls/ddraw/utils.c | 20 ++++++++++++++++++++ dlls/ddraw/vertexbuffer.c | 14 ++------------ 4 files changed, 25 insertions(+), 13 deletions(-)
diff --git a/dlls/ddraw/ddraw_private.h b/dlls/ddraw/ddraw_private.h index af58c11..3cf9b76 100644 --- a/dlls/ddraw/ddraw_private.h +++ b/dlls/ddraw/ddraw_private.h @@ -587,6 +587,7 @@ void ddrawformat_from_wined3dformat(DDPIXELFORMAT *ddraw_format, BOOL wined3d_colour_from_ddraw_colour(const DDPIXELFORMAT *pf, const struct ddraw_palette *palette, DWORD colour, struct wined3d_color *wined3d_colour) DECLSPEC_HIDDEN; enum wined3d_format_id wined3dformat_from_ddrawformat(const DDPIXELFORMAT *format) DECLSPEC_HIDDEN; +unsigned int wined3dmapflags_from_ddrawmapflags(unsigned int flags) DECLSPEC_HIDDEN; void DDRAW_dump_surface_desc(const DDSURFACEDESC2 *lpddsd) DECLSPEC_HIDDEN; void dump_D3DMATRIX(const D3DMATRIX *mat) DECLSPEC_HIDDEN; void DDRAW_dump_DDCAPS(const DDCAPS *lpcaps) DECLSPEC_HIDDEN; diff --git a/dlls/ddraw/surface.c b/dlls/ddraw/surface.c index 6307911..f09aaba 100644 --- a/dlls/ddraw/surface.c +++ b/dlls/ddraw/surface.c @@ -992,7 +992,8 @@ static HRESULT surface_lock(struct ddraw_surface *surface, hr = ddraw_surface_update_frontbuffer(surface, rect, TRUE); if (SUCCEEDED(hr)) hr = wined3d_resource_map(wined3d_texture_get_resource(surface->wined3d_texture), - surface->sub_resource_idx, &map_desc, rect ? &box : NULL, flags); + surface->sub_resource_idx, &map_desc, rect ? &box : NULL, + wined3dmapflags_from_ddrawmapflags(flags)); if (FAILED(hr)) { wined3d_mutex_unlock(); diff --git a/dlls/ddraw/utils.c b/dlls/ddraw/utils.c index 3785158..bb75666 100644 --- a/dlls/ddraw/utils.c +++ b/dlls/ddraw/utils.c @@ -561,6 +561,26 @@ enum wined3d_format_id wined3dformat_from_ddrawformat(const DDPIXELFORMAT *DDPix return WINED3DFMT_UNKNOWN; }
+unsigned int wined3dmapflags_from_ddrawmapflags(unsigned int flags) +{ + static const unsigned int handled = DDLOCK_READONLY + | DDLOCK_NOSYSLOCK + | DDLOCK_NOOVERWRITE + | DDLOCK_DISCARDCONTENTS + | DDLOCK_DONOTWAIT; + unsigned int wined3d_flags; + + wined3d_flags = flags & handled; + if (flags & DDLOCK_NODIRTYUPDATE) + wined3d_flags |= WINED3D_MAP_NO_DIRTY_UPDATE; + flags &= ~(handled | DDLOCK_WAIT | DDLOCK_NODIRTYUPDATE); + + if (flags) + FIXME("Unhandled flags %#x.\n", flags); + + return wined3d_flags; +} + static float colour_to_float(DWORD colour, DWORD mask) { if (!mask) diff --git a/dlls/ddraw/vertexbuffer.c b/dlls/ddraw/vertexbuffer.c index f89b620..b661e73 100644 --- a/dlls/ddraw/vertexbuffer.c +++ b/dlls/ddraw/vertexbuffer.c @@ -162,26 +162,16 @@ static HRESULT WINAPI d3d_vertex_buffer7_Lock(IDirect3DVertexBuffer7 *iface, struct wined3d_resource *wined3d_resource; struct wined3d_map_desc wined3d_map_desc; HRESULT hr; - DWORD wined3d_flags = 0;
TRACE("iface %p, flags %#x, data %p, data_size %p.\n", iface, flags, data, data_size);
if (buffer->version != 7) flags &= ~(DDLOCK_NOOVERWRITE | DDLOCK_DISCARDCONTENTS);
- /* Writeonly: Pointless. Event: Unsupported by native according to the sdk - * nosyslock: Not applicable - */ if (!(flags & DDLOCK_WAIT)) - wined3d_flags |= WINED3D_MAP_DONOTWAIT; - if (flags & DDLOCK_READONLY) - wined3d_flags |= WINED3D_MAP_READONLY; - if (flags & DDLOCK_NOOVERWRITE) - wined3d_flags |= WINED3D_MAP_NOOVERWRITE; + flags |= DDLOCK_DONOTWAIT; if (flags & DDLOCK_DISCARDCONTENTS) { - wined3d_flags |= WINED3D_MAP_DISCARD; - if (!buffer->dynamic) { struct wined3d_buffer *new_buffer; @@ -211,7 +201,7 @@ static HRESULT WINAPI d3d_vertex_buffer7_Lock(IDirect3DVertexBuffer7 *iface, }
hr = wined3d_resource_map(wined3d_buffer_get_resource(buffer->wined3d_buffer), - 0, &wined3d_map_desc, NULL, wined3d_flags); + 0, &wined3d_map_desc, NULL, wined3dmapflags_from_ddrawmapflags(flags)); *data = wined3d_map_desc.data;
wined3d_mutex_unlock();