[PATCH 5/7] d3d11: Implement d3d11_texture3d_GetDesc().

Józef Kucia jkucia at codeweavers.com
Mon Aug 31 17:27:35 CDT 2015


---
 dlls/d3d11/d3d11_private.h |  5 +++--
 dlls/d3d11/device.c        | 13 ++++++++++++-
 dlls/d3d11/texture.c       | 25 ++++++++++++++++++++-----
 3 files changed, 35 insertions(+), 8 deletions(-)

diff --git a/dlls/d3d11/d3d11_private.h b/dlls/d3d11/d3d11_private.h
index c5379ed..6724a07 100644
--- a/dlls/d3d11/d3d11_private.h
+++ b/dlls/d3d11/d3d11_private.h
@@ -62,6 +62,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_d3d11(UINT bind_flags, enum D3D11_USAGE usage) 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;
@@ -125,12 +126,12 @@ struct d3d_texture3d
 
     struct wined3d_private_store private_store;
     struct wined3d_texture *wined3d_texture;
-    D3D10_TEXTURE3D_DESC desc;
+    D3D11_TEXTURE3D_DESC desc;
     ID3D11Device *device;
 };
 
 HRESULT d3d_texture3d_init(struct d3d_texture3d *texture, struct d3d_device *device,
-        const D3D10_TEXTURE3D_DESC *desc, const D3D10_SUBRESOURCE_DATA *data) DECLSPEC_HIDDEN;
+        const D3D11_TEXTURE3D_DESC *desc, const D3D10_SUBRESOURCE_DATA *data) DECLSPEC_HIDDEN;
 
 /* ID3D10Buffer */
 struct d3d10_buffer
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
index 7aef1f7..5f54795 100644
--- a/dlls/d3d11/device.c
+++ b/dlls/d3d11/device.c
@@ -2044,6 +2044,7 @@ static HRESULT STDMETHODCALLTYPE d3d10_device_CreateTexture3D(ID3D10Device1 *ifa
         ID3D10Texture3D **texture)
 {
     struct d3d_device *device = impl_from_ID3D10Device(iface);
+    D3D11_TEXTURE3D_DESC d3d11_desc;
     struct d3d_texture3d *object;
     HRESULT hr;
 
@@ -2053,7 +2054,17 @@ static HRESULT STDMETHODCALLTYPE d3d10_device_CreateTexture3D(ID3D10Device1 *ifa
     if (!object)
         return E_OUTOFMEMORY;
 
-    if (FAILED(hr = d3d_texture3d_init(object, device, desc, data)))
+    d3d11_desc.Width = desc->Width;
+    d3d11_desc.Height = desc->Height;
+    d3d11_desc.Depth = desc->Depth;
+    d3d11_desc.MipLevels = desc->MipLevels;
+    d3d11_desc.Format = desc->Format;
+    d3d11_desc.Usage = d3d11_usage_from_d3d10_usage(desc->Usage);
+    d3d11_desc.BindFlags = d3d11_bind_flags_from_d3d10_bind_flags(desc->BindFlags);
+    d3d11_desc.CPUAccessFlags = d3d11_cpu_access_flags_from_d3d10_cpu_access_flags(desc->CPUAccessFlags);
+    d3d11_desc.MiscFlags = d3d11_resource_misc_flags_from_d3d10_resource_misc_flags(desc->MiscFlags);
+
+    if (FAILED(hr = d3d_texture3d_init(object, device, &d3d11_desc, data)))
     {
         WARN("Failed to initialize texture, hr %#x.\n", hr);
         HeapFree(GetProcessHeap(), 0, object);
diff --git a/dlls/d3d11/texture.c b/dlls/d3d11/texture.c
index 55f5d49..52c3dba 100644
--- a/dlls/d3d11/texture.c
+++ b/dlls/d3d11/texture.c
@@ -467,7 +467,7 @@ static HRESULT d3d_texture2d_init(struct d3d_texture2d *texture, struct d3d_devi
     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 = wined3d_usage_from_d3d10core(desc->BindFlags, desc->Usage);
+    wined3d_desc.usage = wined3d_usage_from_d3d11(desc->BindFlags, desc->Usage);
     wined3d_desc.pool = WINED3D_POOL_DEFAULT;
     wined3d_desc.width = desc->Width;
     wined3d_desc.height = desc->Height;
@@ -683,7 +683,11 @@ static UINT STDMETHODCALLTYPE d3d11_texture3d_GetEvictionPriority(ID3D11Texture3
 
 static void STDMETHODCALLTYPE d3d11_texture3d_GetDesc(ID3D11Texture3D *iface, D3D11_TEXTURE3D_DESC *desc)
 {
-    FIXME("iface %p, desc %p stub!\n", iface, desc);
+    struct d3d_texture3d *texture = impl_from_ID3D11Texture3D(iface);
+
+    TRACE("iface %p, desc %p.\n", iface, desc);
+
+    *desc = texture->desc;
 }
 
 static const struct ID3D11Texture3DVtbl d3d11_texture3d_vtbl =
@@ -850,10 +854,21 @@ static void STDMETHODCALLTYPE d3d10_texture3d_Unmap(ID3D10Texture3D *iface, UINT
 static void STDMETHODCALLTYPE d3d10_texture3d_GetDesc(ID3D10Texture3D *iface, D3D10_TEXTURE3D_DESC *desc)
 {
     struct d3d_texture3d *texture = impl_from_ID3D10Texture3D(iface);
+    D3D11_TEXTURE3D_DESC d3d11_desc;
 
     TRACE("iface %p, desc %p.\n", iface, desc);
 
-    *desc = texture->desc;
+    d3d11_texture3d_GetDesc(&texture->ID3D11Texture3D_iface, &d3d11_desc);
+
+    desc->Width = d3d11_desc.Width;
+    desc->Height = d3d11_desc.Height;
+    desc->Depth = d3d11_desc.Depth;
+    desc->MipLevels = d3d11_desc.MipLevels;
+    desc->Format = d3d11_desc.Format;
+    desc->Usage = d3d10_usage_from_d3d11_usage(d3d11_desc.Usage);
+    desc->BindFlags = d3d10_bind_flags_from_d3d11_bind_flags(d3d11_desc.BindFlags);
+    desc->CPUAccessFlags = d3d10_cpu_access_flags_from_d3d11_cpu_access_flags(d3d11_desc.CPUAccessFlags);
+    desc->MiscFlags = d3d10_resource_misc_flags_from_d3d11_resource_misc_flags(d3d11_desc.MiscFlags);
 }
 
 static const struct ID3D10Texture3DVtbl d3d10_texture3d_vtbl =
@@ -883,7 +898,7 @@ static const struct wined3d_parent_ops d3d_texture3d_wined3d_parent_ops =
 };
 
 HRESULT d3d_texture3d_init(struct d3d_texture3d *texture, struct d3d_device *device,
-        const D3D10_TEXTURE3D_DESC *desc, const D3D10_SUBRESOURCE_DATA *data)
+        const D3D11_TEXTURE3D_DESC *desc, const D3D10_SUBRESOURCE_DATA *data)
 {
     struct wined3d_resource_desc wined3d_desc;
     unsigned int levels;
@@ -900,7 +915,7 @@ HRESULT d3d_texture3d_init(struct d3d_texture3d *texture, struct d3d_device *dev
     wined3d_desc.format = wined3dformat_from_dxgi_format(desc->Format);
     wined3d_desc.multisample_type = WINED3D_MULTISAMPLE_NONE;
     wined3d_desc.multisample_quality = 0;
-    wined3d_desc.usage = wined3d_usage_from_d3d10core(desc->BindFlags, desc->Usage);
+    wined3d_desc.usage = wined3d_usage_from_d3d11(desc->BindFlags, desc->Usage);
     wined3d_desc.pool = WINED3D_POOL_DEFAULT;
     wined3d_desc.width = desc->Width;
     wined3d_desc.height = desc->Height;
-- 
2.4.6




More information about the wine-patches mailing list