d3d10core: Translate d3d10 bind flags / usage to wined3d usage for textures.

This commit is contained in:
Henri Verbeet 2013-09-25 09:58:12 +02:00 committed by Alexandre Julliard
parent 991e47e3c9
commit cfe16a4bd1
3 changed files with 25 additions and 5 deletions

View file

@ -59,6 +59,7 @@ const char *debug_dxgi_format(DXGI_FORMAT format) DECLSPEC_HIDDEN;
DXGI_FORMAT dxgi_format_from_wined3dformat(enum wined3d_format_id format) DECLSPEC_HIDDEN;
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;
static inline void read_dword(const char **ptr, DWORD *d)
{

View file

@ -258,7 +258,6 @@ HRESULT d3d10_texture2d_init(struct d3d10_texture2d *texture, struct d3d10_devic
}
}
FIXME("Implement DXGI<->wined3d usage conversion\n");
if (desc->ArraySize != 1)
FIXME("Array textures not implemented.\n");
if (desc->SampleDesc.Count > 1)
@ -268,7 +267,7 @@ HRESULT d3d10_texture2d_init(struct d3d10_texture2d *texture, struct d3d10_devic
wined3d_desc.format = wined3dformat_from_dxgi_format(desc->Format);
wined3d_desc.multisample_type = desc->SampleDesc.Count > 1 ? desc->SampleDesc.Count : WINED3D_MULTISAMPLE_NONE;
wined3d_desc.multisample_quality = desc->SampleDesc.Quality;
wined3d_desc.usage = desc->Usage;
wined3d_desc.usage = wined3d_usage_from_d3d10core(desc->BindFlags, desc->Usage);
wined3d_desc.pool = WINED3D_POOL_DEFAULT;
wined3d_desc.width = desc->Width;
wined3d_desc.height = desc->Height;
@ -482,13 +481,11 @@ HRESULT d3d10_texture3d_init(struct d3d10_texture3d *texture, struct d3d10_devic
texture->refcount = 1;
texture->desc = *desc;
FIXME("Implement DXGI<->wined3d usage conversion.\n");
wined3d_desc.resource_type = WINED3D_RTYPE_VOLUME_TEXTURE;
wined3d_desc.format = wined3dformat_from_dxgi_format(desc->Format);
wined3d_desc.multisample_type = WINED3D_MULTISAMPLE_NONE;
wined3d_desc.multisample_quality = 0;
wined3d_desc.usage = desc->Usage;
wined3d_desc.usage = wined3d_usage_from_d3d10core(desc->BindFlags, desc->Usage);
wined3d_desc.pool = WINED3D_POOL_DEFAULT;
wined3d_desc.width = desc->Width;
wined3d_desc.height = desc->Height;

View file

@ -345,6 +345,28 @@ enum wined3d_format_id wined3dformat_from_dxgi_format(DXGI_FORMAT format)
}
}
DWORD wined3d_usage_from_d3d10core(UINT bind_flags, enum D3D10_USAGE usage)
{
static const DWORD handled = D3D10_BIND_SHADER_RESOURCE
| D3D10_BIND_RENDER_TARGET
| D3D10_BIND_DEPTH_STENCIL;
DWORD wined3d_usage = 0;
if (bind_flags & D3D10_BIND_SHADER_RESOURCE)
wined3d_usage |= WINED3DUSAGE_TEXTURE;
if (bind_flags & D3D10_BIND_RENDER_TARGET)
wined3d_usage |= WINED3DUSAGE_RENDERTARGET;
if (bind_flags & D3D10_BIND_DEPTH_STENCIL)
wined3d_usage |= WINED3DUSAGE_DEPTHSTENCIL;
if (bind_flags & ~handled)
FIXME("Unhandled bind flags %#x.\n", usage & ~handled);
if (usage == D3D10_USAGE_DYNAMIC)
wined3d_usage |= WINED3DUSAGE_DYNAMIC;
return wined3d_usage;
}
void skip_dword_unknown(const char **ptr, unsigned int count)
{
unsigned int i;