[PATCH 2/5] d3d10core: Translate d3d10 bind flags / usage to wined3d usage for textures.
Henri Verbeet
hverbeet at codeweavers.com
Wed Sep 25 02:58:12 CDT 2013
---
dlls/d3d10core/d3d10core_private.h | 1 +
dlls/d3d10core/texture.c | 7 ++-----
dlls/d3d10core/utils.c | 22 ++++++++++++++++++++++
3 files changed, 25 insertions(+), 5 deletions(-)
diff --git a/dlls/d3d10core/d3d10core_private.h b/dlls/d3d10core/d3d10core_private.h
index 9916d63..820f170 100644
--- a/dlls/d3d10core/d3d10core_private.h
+++ b/dlls/d3d10core/d3d10core_private.h
@@ -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)
{
diff --git a/dlls/d3d10core/texture.c b/dlls/d3d10core/texture.c
index 85c6d88..6fca08b 100644
--- a/dlls/d3d10core/texture.c
+++ b/dlls/d3d10core/texture.c
@@ -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;
diff --git a/dlls/d3d10core/utils.c b/dlls/d3d10core/utils.c
index 813cae6..e0c6014 100644
--- a/dlls/d3d10core/utils.c
+++ b/dlls/d3d10core/utils.c
@@ -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;
--
1.7.10.4
More information about the wine-patches
mailing list