From db2e44a9bc428f82391629e7084816e43784f8cf Mon Sep 17 00:00:00 2001 From: =?utf8?q?Johannes=20Brandst=C3=A4tter?= Date: Thu, 25 Sep 2014 17:18:40 +0200 Subject: [PATCH] d3d10core: Add support for map_type flags D3D10_MAP_READ, D3D10_MAP_WRITE_NO_OVERWRITE and D3D10_MAP_DISCARD. --- dlls/d3d10core/buffer.c | 5 ++--- dlls/d3d10core/d3d10core_private.h | 1 + dlls/d3d10core/texture.c | 8 ++------ dlls/d3d10core/utils.c | 22 ++++++++++++++++++++++ 4 files changed, 27 insertions(+), 9 deletions(-) diff --git a/dlls/d3d10core/buffer.c b/dlls/d3d10core/buffer.c index b9ac6e12509..c5d851e3f48 100644 --- a/dlls/d3d10core/buffer.c +++ b/dlls/d3d10core/buffer.c @@ -154,12 +154,11 @@ static HRESULT STDMETHODCALLTYPE d3d10_buffer_Map(ID3D10Buffer *iface, D3D10_MAP TRACE("iface %p, map_type %u, map_flags %#x, data %p.\n", iface, map_type, map_flags, data); - if (map_type != D3D10_MAP_READ_WRITE) - FIXME("Ignoring map_type %#x.\n", map_type); if (map_flags) FIXME("Ignoring map_flags %#x.\n", map_flags); - return wined3d_buffer_map(buffer->wined3d_buffer, 0, 0, (BYTE **)data, 0); + return wined3d_buffer_map(buffer->wined3d_buffer, 0, 0, (BYTE **)data, + wined3d_map_flags_from_d3d10_map_type(map_type)); } static void STDMETHODCALLTYPE d3d10_buffer_Unmap(ID3D10Buffer *iface) diff --git a/dlls/d3d10core/d3d10core_private.h b/dlls/d3d10core/d3d10core_private.h index 71c4dc07904..30ae928d534 100644 --- a/dlls/d3d10core/d3d10core_private.h +++ b/dlls/d3d10core/d3d10core_private.h @@ -63,6 +63,7 @@ DXGI_FORMAT dxgi_format_from_wined3dformat(enum wined3d_format_id format) DECLSP enum wined3d_format_id wined3dformat_from_dxgi_format(DXGI_FORMAT format) DECLSPEC_HIDDEN; DWORD wined3d_usage_from_d3d10core(UINT bind_flags, enum D3D10_USAGE usage) DECLSPEC_HIDDEN; struct wined3d_resource *wined3d_resource_from_resource(ID3D10Resource *resource) DECLSPEC_HIDDEN; +DWORD wined3d_map_flags_from_d3d10_map_type(D3D10_MAP map_type) DECLSPEC_HIDDEN; static inline void read_dword(const char **ptr, DWORD *d) { diff --git a/dlls/d3d10core/texture.c b/dlls/d3d10core/texture.c index b488f910a18..5e112ddc2e9 100644 --- a/dlls/d3d10core/texture.c +++ b/dlls/d3d10core/texture.c @@ -176,15 +176,13 @@ static HRESULT STDMETHODCALLTYPE d3d10_texture2d_Map(ID3D10Texture2D *iface, UIN TRACE("iface %p, sub_resource_idx %u, map_type %u, map_flags %#x, mapped_texture %p.\n", iface, sub_resource_idx, map_type, map_flags, mapped_texture); - if (map_type != D3D10_MAP_READ_WRITE) - FIXME("Ignoring map_type %#x.\n", map_type); if (map_flags) FIXME("Ignoring map_flags %#x.\n", map_flags); if (!(sub_resource = wined3d_texture_get_sub_resource(texture->wined3d_texture, sub_resource_idx))) hr = E_INVALIDARG; else if (SUCCEEDED(hr = wined3d_surface_map(wined3d_surface_from_resource(sub_resource), - &wined3d_map_desc, NULL, 0))) + &wined3d_map_desc, NULL, wined3d_map_flags_from_d3d10_map_type(map_type)))) { mapped_texture->pData = wined3d_map_desc.data; mapped_texture->RowPitch = wined3d_map_desc.row_pitch; @@ -451,15 +449,13 @@ static HRESULT STDMETHODCALLTYPE d3d10_texture3d_Map(ID3D10Texture3D *iface, UIN TRACE("iface %p, sub_resource_idx %u, map_type %u, map_flags %#x, mapped_texture %p.\n", iface, sub_resource_idx, map_type, map_flags, mapped_texture); - if (map_type != D3D10_MAP_READ_WRITE) - FIXME("Ignoring map_type %#x.\n", map_type); if (map_flags) FIXME("Ignoring map_flags %#x.\n", map_flags); if (!(sub_resource = wined3d_texture_get_sub_resource(texture->wined3d_texture, sub_resource_idx))) hr = E_INVALIDARG; else if (SUCCEEDED(hr = wined3d_volume_map(wined3d_volume_from_resource(sub_resource), - &wined3d_map_desc, NULL, 0))) + &wined3d_map_desc, NULL, wined3d_map_flags_from_d3d10_map_type(map_type)))) { mapped_texture->pData = wined3d_map_desc.data; mapped_texture->RowPitch = wined3d_map_desc.row_pitch; diff --git a/dlls/d3d10core/utils.c b/dlls/d3d10core/utils.c index d955fbbeaec..91eda6d007a 100644 --- a/dlls/d3d10core/utils.c +++ b/dlls/d3d10core/utils.c @@ -389,6 +389,28 @@ struct wined3d_resource *wined3d_resource_from_resource(ID3D10Resource *resource } } +DWORD wined3d_map_flags_from_d3d10_map_type(D3D10_MAP map_type) +{ + switch (map_type) + { + case D3D10_MAP_READ_WRITE: + return 0; + + case D3D10_MAP_READ: + return WINED3D_MAP_READONLY; + + case D3D10_MAP_WRITE_DISCARD: + return WINED3D_MAP_DISCARD; + + case D3D10_MAP_WRITE_NO_OVERWRITE: + return WINED3D_MAP_NOOVERWRITE; + + default: + FIXME("Unhandled map_type %#x.\n", map_type); + return 0; + } +} + void skip_dword_unknown(const char **ptr, unsigned int count) { unsigned int i; -- 2.11.4.GIT