Signed-off-by: Henri Verbeet hverbeet@codeweavers.com --- dlls/d3d8/buffer.c | 4 ++-- dlls/d3d8/d3d8_private.h | 1 + dlls/d3d8/device.c | 18 ++++++++++++++++++ dlls/d3d8/surface.c | 2 +- dlls/d3d8/volume.c | 3 ++- 5 files changed, 24 insertions(+), 4 deletions(-)
diff --git a/dlls/d3d8/buffer.c b/dlls/d3d8/buffer.c index 772a233..d4d73ad 100644 --- a/dlls/d3d8/buffer.c +++ b/dlls/d3d8/buffer.c @@ -193,7 +193,7 @@ static HRESULT WINAPI d3d8_vertexbuffer_Lock(IDirect3DVertexBuffer8 *iface, UINT wined3d_box.right = offset + size; wined3d_mutex_lock(); hr = wined3d_resource_map(wined3d_buffer_get_resource(buffer->wined3d_buffer), - 0, &wined3d_map_desc, &wined3d_box, flags); + 0, &wined3d_map_desc, &wined3d_box, wined3dmapflags_from_d3dmapflags(flags)); wined3d_mutex_unlock(); *data = wined3d_map_desc.data;
@@ -490,7 +490,7 @@ static HRESULT WINAPI d3d8_indexbuffer_Lock(IDirect3DIndexBuffer8 *iface, UINT o wined3d_box.right = offset + size; wined3d_mutex_lock(); hr = wined3d_resource_map(wined3d_buffer_get_resource(buffer->wined3d_buffer), - 0, &wined3d_map_desc, &wined3d_box, flags); + 0, &wined3d_map_desc, &wined3d_box, wined3dmapflags_from_d3dmapflags(flags)); wined3d_mutex_unlock(); *data = wined3d_map_desc.data;
diff --git a/dlls/d3d8/d3d8_private.h b/dlls/d3d8/d3d8_private.h index 5e59065..ecde77a 100644 --- a/dlls/d3d8/d3d8_private.h +++ b/dlls/d3d8/d3d8_private.h @@ -273,6 +273,7 @@ HRESULT d3d8_pixel_shader_init(struct d3d8_pixel_shader *shader, struct d3d8_dev
D3DFORMAT d3dformat_from_wined3dformat(enum wined3d_format_id format) DECLSPEC_HIDDEN; enum wined3d_format_id wined3dformat_from_d3dformat(D3DFORMAT format) DECLSPEC_HIDDEN; +unsigned int wined3dmapflags_from_d3dmapflags(unsigned int flags) DECLSPEC_HIDDEN; void load_local_constants(const DWORD *d3d8_elements, struct wined3d_shader *wined3d_vertex_shader) DECLSPEC_HIDDEN; size_t parse_token(const DWORD *pToken) DECLSPEC_HIDDEN;
diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c index a6363d2..fc40026 100644 --- a/dlls/d3d8/device.c +++ b/dlls/d3d8/device.c @@ -141,6 +141,24 @@ enum wined3d_format_id wined3dformat_from_d3dformat(D3DFORMAT format) } }
+unsigned int wined3dmapflags_from_d3dmapflags(unsigned int flags) +{ + static const unsigned int handled = D3DLOCK_READONLY + | D3DLOCK_NOSYSLOCK + | D3DLOCK_NOOVERWRITE + | D3DLOCK_DISCARD + | D3DLOCK_NO_DIRTY_UPDATE; + unsigned int wined3d_flags; + + wined3d_flags = flags & handled; + flags &= ~handled; + + if (flags) + FIXME("Unhandled flags %#x.\n", flags); + + return wined3d_flags; +} + static UINT vertex_count_from_primitive_count(D3DPRIMITIVETYPE primitive_type, UINT primitive_count) { switch (primitive_type) diff --git a/dlls/d3d8/surface.c b/dlls/d3d8/surface.c index 6ad43a4..fff47f5 100644 --- a/dlls/d3d8/surface.c +++ b/dlls/d3d8/surface.c @@ -244,7 +244,7 @@ static HRESULT WINAPI d3d8_surface_LockRect(IDirect3DSurface8 *iface, }
hr = wined3d_resource_map(wined3d_texture_get_resource(surface->wined3d_texture), surface->sub_resource_idx, - &map_desc, rect ? &box : NULL, flags); + &map_desc, rect ? &box : NULL, wined3dmapflags_from_d3dmapflags(flags)); wined3d_mutex_unlock();
if (SUCCEEDED(hr)) diff --git a/dlls/d3d8/volume.c b/dlls/d3d8/volume.c index e8ff74b..89aa84f 100644 --- a/dlls/d3d8/volume.c +++ b/dlls/d3d8/volume.c @@ -147,7 +147,8 @@ static HRESULT WINAPI d3d8_volume_LockBox(IDirect3DVolume8 *iface,
wined3d_mutex_lock(); if (FAILED(hr = wined3d_resource_map(wined3d_texture_get_resource(volume->wined3d_texture), - volume->sub_resource_idx, &map_desc, (const struct wined3d_box *)box, flags))) + volume->sub_resource_idx, &map_desc, (const struct wined3d_box *)box, + wined3dmapflags_from_d3dmapflags(flags)))) map_desc.data = NULL; wined3d_mutex_unlock();