d3d10core: Add support for map_type flags D3D10_MAP_READ, D3D10_MAP_WRITE_NO_OVERWRITE and D3D10_MAP_DISCARD.

This commit is contained in:
Johannes Brandstätter 2014-09-25 17:18:40 +02:00 committed by Alexandre Julliard
parent f23b46464e
commit db2e44a9bc
4 changed files with 27 additions and 9 deletions

View File

@ -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)

View File

@ -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)
{

View File

@ -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;

View File

@ -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;