d3d11: Implement d3d11_immediate_context_Map().

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Józef Kucia 2015-11-02 17:12:28 +01:00 committed by Alexandre Julliard
parent 3f2fa96b98
commit 75db69ad02
5 changed files with 29 additions and 11 deletions

View file

@ -312,7 +312,7 @@ static HRESULT STDMETHODCALLTYPE d3d10_buffer_Map(ID3D10Buffer *iface, D3D10_MAP
wined3d_mutex_lock();
hr = wined3d_buffer_map(buffer->wined3d_buffer, 0, 0, (BYTE **)data,
wined3d_map_flags_from_d3d10_map_type(map_type));
wined3d_map_flags_from_d3d11_map_type(map_type));
wined3d_mutex_unlock();
return hr;

View file

@ -65,7 +65,7 @@ enum wined3d_format_id wined3dformat_from_dxgi_format(DXGI_FORMAT format) DECLSP
DWORD wined3d_usage_from_d3d11(UINT bind_flags, enum D3D11_USAGE usage) DECLSPEC_HIDDEN;
struct wined3d_resource *wined3d_resource_from_d3d11_resource(ID3D11Resource *resource) DECLSPEC_HIDDEN;
struct wined3d_resource *wined3d_resource_from_d3d10_resource(ID3D10Resource *resource) DECLSPEC_HIDDEN;
DWORD wined3d_map_flags_from_d3d10_map_type(D3D10_MAP map_type) DECLSPEC_HIDDEN;
DWORD wined3d_map_flags_from_d3d11_map_type(D3D11_MAP map_type) DECLSPEC_HIDDEN;
enum D3D11_USAGE d3d11_usage_from_d3d10_usage(enum D3D10_USAGE usage) DECLSPEC_HIDDEN;
enum D3D10_USAGE d3d10_usage_from_d3d11_usage(enum D3D11_USAGE usage) DECLSPEC_HIDDEN;

View file

@ -202,10 +202,28 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_Draw(ID3D11DeviceContext *
static HRESULT STDMETHODCALLTYPE d3d11_immediate_context_Map(ID3D11DeviceContext *iface, ID3D11Resource *resource,
UINT subresource_idx, D3D11_MAP map_type, UINT map_flags, D3D11_MAPPED_SUBRESOURCE *mapped_subresource)
{
FIXME("iface %p, resource %p, subresource_idx %u, map_type %u, map_flags %#x, mapped_subresource %p stub!\n",
struct wined3d_resource *wined3d_resource;
struct wined3d_map_desc map_desc;
HRESULT hr;
TRACE("iface %p, resource %p, subresource_idx %u, map_type %u, map_flags %#x, mapped_subresource %p.\n",
iface, resource, subresource_idx, map_type, map_flags, mapped_subresource);
return E_NOTIMPL;
if (map_flags)
FIXME("Ignoring map_flags %#x.\n", map_flags);
wined3d_resource = wined3d_resource_from_d3d11_resource(resource);
wined3d_mutex_lock();
hr = wined3d_resource_map(wined3d_resource, subresource_idx,
&map_desc, NULL, wined3d_map_flags_from_d3d11_map_type(map_type));
wined3d_mutex_unlock();
mapped_subresource->pData = map_desc.data;
mapped_subresource->RowPitch = map_desc.row_pitch;
mapped_subresource->DepthPitch = map_desc.slice_pitch;
return hr;
}
static void STDMETHODCALLTYPE d3d11_immediate_context_Unmap(ID3D11DeviceContext *iface, ID3D11Resource *resource,

View file

@ -367,7 +367,7 @@ static HRESULT STDMETHODCALLTYPE d3d10_texture2d_Map(ID3D10Texture2D *iface, UIN
wined3d_mutex_lock();
if (SUCCEEDED(hr = wined3d_texture_map(texture->wined3d_texture, sub_resource_idx,
&wined3d_map_desc, NULL, wined3d_map_flags_from_d3d10_map_type(map_type))))
&wined3d_map_desc, NULL, wined3d_map_flags_from_d3d11_map_type(map_type))))
{
mapped_texture->pData = wined3d_map_desc.data;
mapped_texture->RowPitch = wined3d_map_desc.row_pitch;
@ -824,7 +824,7 @@ static HRESULT STDMETHODCALLTYPE d3d10_texture3d_Map(ID3D10Texture3D *iface, UIN
wined3d_mutex_lock();
if (SUCCEEDED(hr = wined3d_texture_map(texture->wined3d_texture, sub_resource_idx,
&wined3d_map_desc, NULL, wined3d_map_flags_from_d3d10_map_type(map_type))))
&wined3d_map_desc, NULL, wined3d_map_flags_from_d3d11_map_type(map_type))))
{
mapped_texture->pData = wined3d_map_desc.data;
mapped_texture->RowPitch = wined3d_map_desc.row_pitch;

View file

@ -546,20 +546,20 @@ struct wined3d_resource *wined3d_resource_from_d3d10_resource(ID3D10Resource *re
}
}
DWORD wined3d_map_flags_from_d3d10_map_type(D3D10_MAP map_type)
DWORD wined3d_map_flags_from_d3d11_map_type(D3D11_MAP map_type)
{
switch (map_type)
{
case D3D10_MAP_READ_WRITE:
case D3D11_MAP_READ_WRITE:
return 0;
case D3D10_MAP_READ:
case D3D11_MAP_READ:
return WINED3D_MAP_READONLY;
case D3D10_MAP_WRITE_DISCARD:
case D3D11_MAP_WRITE_DISCARD:
return WINED3D_MAP_DISCARD;
case D3D10_MAP_WRITE_NO_OVERWRITE:
case D3D11_MAP_WRITE_NO_OVERWRITE:
return WINED3D_MAP_NOOVERWRITE;
default: