Rebase against 2986e895015b9785d61e7265763efacc053d7ad6.

This commit is contained in:
Zebediah Figura 2018-04-03 17:51:58 -05:00
parent 2736dff771
commit 0cf0a265da
52 changed files with 15 additions and 6389 deletions

View File

@ -1,2 +1 @@
Fixes: [42191] Add semi-stub for D3D11 deferred context implementation
Depends: d3d11-ID3D11Texture1D_Rebased

View File

@ -1,454 +0,0 @@
From 19d3f2a7b2bdd740cc46e4b0f8a08d4c7e3e33bc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Thu, 25 Aug 2016 19:41:15 +0200
Subject: [PATCH] d3d11: Add stub ID3D11Texture2D and ID3D10Texture2D
interfaces.
---
dlls/d3d11/d3d11_private.h | 21 +++
dlls/d3d11/device.c | 36 ++++-
dlls/d3d11/texture.c | 340 +++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 393 insertions(+), 4 deletions(-)
diff --git a/dlls/d3d11/d3d11_private.h b/dlls/d3d11/d3d11_private.h
index 52496d8..bdd7c34 100644
--- a/dlls/d3d11/d3d11_private.h
+++ b/dlls/d3d11/d3d11_private.h
@@ -111,6 +111,27 @@ void skip_dword_unknown(const char **ptr, unsigned int count) DECLSPEC_HIDDEN;
HRESULT parse_dxbc(const char *data, SIZE_T data_size,
HRESULT (*chunk_handler)(const char *data, DWORD data_size, DWORD tag, void *ctx), void *ctx) DECLSPEC_HIDDEN;
+/* ID3D11Texture1D, ID3D10Texture1D */
+struct d3d_texture1d
+{
+ ID3D11Texture1D ID3D11Texture1D_iface;
+ ID3D10Texture1D ID3D10Texture1D_iface;
+ LONG refcount;
+
+ D3D11_TEXTURE1D_DESC desc;
+ ID3D11Device *device;
+};
+
+static inline struct d3d_texture1d *impl_from_ID3D10Texture1D(ID3D10Texture1D *iface)
+{
+ return CONTAINING_RECORD(iface, struct d3d_texture1d, ID3D10Texture1D_iface);
+}
+
+HRESULT d3d_texture1d_create(struct d3d_device *device, const D3D11_TEXTURE1D_DESC *desc,
+ const D3D11_SUBRESOURCE_DATA *data, struct d3d_texture1d **texture) DECLSPEC_HIDDEN;
+struct d3d_texture1d *unsafe_impl_from_ID3D11Texture1D(ID3D11Texture1D *iface) DECLSPEC_HIDDEN;
+struct d3d_texture1d *unsafe_impl_from_ID3D10Texture1D(ID3D10Texture1D *iface) DECLSPEC_HIDDEN;
+
/* ID3D11Texture2D, ID3D10Texture2D */
struct d3d_texture2d
{
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
index 6a747d0..b514ebd 100644
--- a/dlls/d3d11/device.c
+++ b/dlls/d3d11/device.c
@@ -6028,9 +6028,18 @@ static HRESULT STDMETHODCALLTYPE d3d11_device_CreateBuffer(ID3D11Device *iface,
static HRESULT STDMETHODCALLTYPE d3d11_device_CreateTexture1D(ID3D11Device *iface,
const D3D11_TEXTURE1D_DESC *desc, const D3D11_SUBRESOURCE_DATA *data, ID3D11Texture1D **texture)
{
- FIXME("iface %p, desc %p, data %p, texture %p stub!\n", iface, desc, data, texture);
+ struct d3d_device *device = impl_from_ID3D11Device(iface);
+ struct d3d_texture1d *object;
+ HRESULT hr;
- return E_NOTIMPL;
+ TRACE("iface %p, desc %p, data %p, texture %p.\n", iface, desc, data, texture);
+
+ if (FAILED(hr = d3d_texture1d_create(device, desc, data, &object)))
+ return hr;
+
+ *texture = &object->ID3D11Texture1D_iface;
+
+ return S_OK;
}
static HRESULT STDMETHODCALLTYPE d3d11_device_CreateTexture2D(ID3D11Device *iface,
@@ -8272,9 +8281,28 @@ static HRESULT STDMETHODCALLTYPE d3d10_device_CreateBuffer(ID3D10Device1 *iface,
static HRESULT STDMETHODCALLTYPE d3d10_device_CreateTexture1D(ID3D10Device1 *iface,
const D3D10_TEXTURE1D_DESC *desc, const D3D10_SUBRESOURCE_DATA *data, ID3D10Texture1D **texture)
{
- FIXME("iface %p, desc %p, data %p, texture %p stub!\n", iface, desc, data, texture);
+ struct d3d_device *device = impl_from_ID3D10Device(iface);
+ D3D11_TEXTURE1D_DESC d3d11_desc;
+ struct d3d_texture1d *object;
+ HRESULT hr;
- return E_NOTIMPL;
+ TRACE("iface %p, desc %p, data %p, texture %p.\n", iface, desc, data, texture);
+
+ d3d11_desc.Width = desc->Width;
+ d3d11_desc.MipLevels = desc->MipLevels;
+ d3d11_desc.ArraySize = desc->ArraySize;
+ 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_texture1d_create(device, &d3d11_desc, (const D3D11_SUBRESOURCE_DATA *)data, &object)))
+ return hr;
+
+ *texture = &object->ID3D10Texture1D_iface;
+
+ return S_OK;
}
static HRESULT STDMETHODCALLTYPE d3d10_device_CreateTexture2D(ID3D10Device1 *iface,
diff --git a/dlls/d3d11/texture.c b/dlls/d3d11/texture.c
index 4315284..00540b5 100644
--- a/dlls/d3d11/texture.c
+++ b/dlls/d3d11/texture.c
@@ -25,6 +25,346 @@
WINE_DEFAULT_DEBUG_CHANNEL(d3d11);
+
+/* ID3D11Texture1D methods */
+
+static inline struct d3d_texture1d *impl_from_ID3D11Texture1D(ID3D11Texture1D *iface)
+{
+ return CONTAINING_RECORD(iface, struct d3d_texture1d, ID3D11Texture1D_iface);
+}
+
+static HRESULT STDMETHODCALLTYPE d3d11_texture1d_QueryInterface(ID3D11Texture1D *iface, REFIID riid, void **object)
+{
+ struct d3d_texture1d *texture = impl_from_ID3D11Texture1D(iface);
+
+ TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object);
+
+ if (IsEqualGUID(riid, &IID_ID3D11Texture1D)
+ || IsEqualGUID(riid, &IID_ID3D11Resource)
+ || IsEqualGUID(riid, &IID_ID3D11DeviceChild)
+ || IsEqualGUID(riid, &IID_IUnknown))
+ {
+ *object = &texture->ID3D11Texture1D_iface;
+ IUnknown_AddRef((IUnknown *)*object);
+ return S_OK;
+ }
+ else if (IsEqualGUID(riid, &IID_ID3D10Texture1D)
+ || IsEqualGUID(riid, &IID_ID3D10Resource)
+ || IsEqualGUID(riid, &IID_ID3D10DeviceChild))
+ {
+ *object = &texture->ID3D10Texture1D_iface;
+ IUnknown_AddRef((IUnknown *)*object);
+ return S_OK;
+ }
+
+ WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid));
+
+ *object = NULL;
+ return E_NOINTERFACE;
+}
+
+static ULONG STDMETHODCALLTYPE d3d11_texture1d_AddRef(ID3D11Texture1D *iface)
+{
+ struct d3d_texture1d *texture = impl_from_ID3D11Texture1D(iface);
+ ULONG refcount = InterlockedIncrement(&texture->refcount);
+
+ TRACE("%p increasing refcount to %u.\n", texture, refcount);
+
+ if (refcount == 1)
+ {
+ ID3D11Device_AddRef(texture->device);
+ }
+
+ return refcount;
+}
+
+static ULONG STDMETHODCALLTYPE d3d11_texture1d_Release(ID3D11Texture1D *iface)
+{
+ struct d3d_texture1d *texture = impl_from_ID3D11Texture1D(iface);
+ ULONG refcount = InterlockedDecrement(&texture->refcount);
+
+ TRACE("%p decreasing refcount to %u.\n", texture, refcount);
+
+ if (!refcount)
+ {
+ ID3D11Device *device = texture->device;
+
+ /* Release the device last, it may cause the wined3d device to be
+ * destroyed. */
+ ID3D11Device_Release(device);
+ }
+
+ return refcount;
+}
+
+static void STDMETHODCALLTYPE d3d11_texture1d_GetDevice(ID3D11Texture1D *iface, ID3D11Device **device)
+{
+ struct d3d_texture1d *texture = impl_from_ID3D11Texture1D(iface);
+
+ TRACE("iface %p, device %p.\n", iface, device);
+
+ *device = texture->device;
+ ID3D11Device_AddRef(*device);
+}
+
+static HRESULT STDMETHODCALLTYPE d3d11_texture1d_GetPrivateData(ID3D11Texture1D *iface,
+ REFGUID guid, UINT *data_size, void *data)
+{
+ FIXME("iface %p, guid %s, data_size %p, data %p: stub.\n", iface, debugstr_guid(guid), data_size, data);
+
+ return E_FAIL;
+}
+
+static HRESULT STDMETHODCALLTYPE d3d11_texture1d_SetPrivateData(ID3D11Texture1D *iface,
+ REFGUID guid, UINT data_size, const void *data)
+{
+ FIXME("iface %p, guid %s, data_size %u, data %p: stub.\n", iface, debugstr_guid(guid), data_size, data);
+
+ return E_FAIL;
+}
+
+static HRESULT STDMETHODCALLTYPE d3d11_texture1d_SetPrivateDataInterface(ID3D11Texture1D *iface,
+ REFGUID guid, const IUnknown *data)
+{
+ FIXME("iface %p, guid %s, data %p: stub.\n", iface, debugstr_guid(guid), data);
+
+ return E_FAIL;
+}
+
+static void STDMETHODCALLTYPE d3d11_texture1d_GetType(ID3D11Texture1D *iface,
+ D3D11_RESOURCE_DIMENSION *resource_dimension)
+{
+ TRACE("iface %p, resource_dimension %p.\n", iface, resource_dimension);
+
+ *resource_dimension = D3D11_RESOURCE_DIMENSION_TEXTURE1D;
+}
+
+static void STDMETHODCALLTYPE d3d11_texture1d_SetEvictionPriority(ID3D11Texture1D *iface, UINT eviction_priority)
+{
+ FIXME("iface %p, eviction_priority %#x stub!\n", iface, eviction_priority);
+}
+
+static UINT STDMETHODCALLTYPE d3d11_texture1d_GetEvictionPriority(ID3D11Texture1D *iface)
+{
+ FIXME("iface %p stub!\n", iface);
+
+ return 0;
+}
+
+static void STDMETHODCALLTYPE d3d11_texture1d_GetDesc(ID3D11Texture1D *iface, D3D11_TEXTURE1D_DESC *desc)
+{
+ struct d3d_texture1d *texture = impl_from_ID3D11Texture1D(iface);
+
+ FIXME("iface %p, desc %p: semi-stub.\n", iface, desc);
+
+ *desc = texture->desc;
+}
+
+static const struct ID3D11Texture1DVtbl d3d11_texture1d_vtbl =
+{
+ /* IUnknown methods */
+ d3d11_texture1d_QueryInterface,
+ d3d11_texture1d_AddRef,
+ d3d11_texture1d_Release,
+ /* ID3D11DeviceChild methods */
+ d3d11_texture1d_GetDevice,
+ d3d11_texture1d_GetPrivateData,
+ d3d11_texture1d_SetPrivateData,
+ d3d11_texture1d_SetPrivateDataInterface,
+ /* ID3D11Resource methods */
+ d3d11_texture1d_GetType,
+ d3d11_texture1d_SetEvictionPriority,
+ d3d11_texture1d_GetEvictionPriority,
+ /* ID3D11Texture1D methods */
+ d3d11_texture1d_GetDesc,
+};
+
+struct d3d_texture1d *unsafe_impl_from_ID3D11Texture1D(ID3D11Texture1D *iface)
+{
+ if (!iface)
+ return NULL;
+ assert(iface->lpVtbl == &d3d11_texture1d_vtbl);
+ return CONTAINING_RECORD(iface, struct d3d_texture1d, ID3D11Texture1D_iface);
+}
+
+/* IUnknown methods */
+
+static HRESULT STDMETHODCALLTYPE d3d10_texture1d_QueryInterface(ID3D10Texture1D *iface, REFIID riid, void **object)
+{
+ struct d3d_texture1d *texture = impl_from_ID3D10Texture1D(iface);
+
+ TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object);
+
+ return d3d11_texture1d_QueryInterface(&texture->ID3D11Texture1D_iface, riid, object);
+}
+
+static ULONG STDMETHODCALLTYPE d3d10_texture1d_AddRef(ID3D10Texture1D *iface)
+{
+ struct d3d_texture1d *texture = impl_from_ID3D10Texture1D(iface);
+
+ TRACE("iface %p.\n", iface);
+
+ return d3d11_texture1d_AddRef(&texture->ID3D11Texture1D_iface);
+}
+
+static ULONG STDMETHODCALLTYPE d3d10_texture1d_Release(ID3D10Texture1D *iface)
+{
+ struct d3d_texture1d *texture = impl_from_ID3D10Texture1D(iface);
+
+ TRACE("iface %p.\n", iface);
+
+ return d3d11_texture1d_Release(&texture->ID3D11Texture1D_iface);
+}
+
+/* ID3D10DeviceChild methods */
+
+static void STDMETHODCALLTYPE d3d10_texture1d_GetDevice(ID3D10Texture1D *iface, ID3D10Device **device)
+{
+ struct d3d_texture1d *texture = impl_from_ID3D10Texture1D(iface);
+
+ TRACE("iface %p, device %p.\n", iface, device);
+
+ ID3D11Device_QueryInterface(texture->device, &IID_ID3D10Device, (void **)device);
+}
+
+static HRESULT STDMETHODCALLTYPE d3d10_texture1d_GetPrivateData(ID3D10Texture1D *iface,
+ REFGUID guid, UINT *data_size, void *data)
+{
+ struct d3d_texture1d *texture = impl_from_ID3D10Texture1D(iface);
+
+ TRACE("iface %p, guid %s, data_size %p, data %p.\n", iface, debugstr_guid(guid), data_size, data);
+
+ return d3d11_texture1d_GetPrivateData(&texture->ID3D11Texture1D_iface, guid, data_size, data);
+}
+
+static HRESULT STDMETHODCALLTYPE d3d10_texture1d_SetPrivateData(ID3D10Texture1D *iface,
+ REFGUID guid, UINT data_size, const void *data)
+{
+ struct d3d_texture1d *texture = impl_from_ID3D10Texture1D(iface);
+
+ TRACE("iface %p, guid %s, data_size %u, data %p.\n", iface, debugstr_guid(guid), data_size, data);
+
+ return d3d11_texture1d_SetPrivateData(&texture->ID3D11Texture1D_iface, guid, data_size, data);
+}
+
+static HRESULT STDMETHODCALLTYPE d3d10_texture1d_SetPrivateDataInterface(ID3D10Texture1D *iface,
+ REFGUID guid, const IUnknown *data)
+{
+ struct d3d_texture1d *texture = impl_from_ID3D10Texture1D(iface);
+
+ TRACE("iface %p, guid %s, data %p.\n", iface, debugstr_guid(guid), data);
+
+ return d3d11_texture1d_SetPrivateDataInterface(&texture->ID3D11Texture1D_iface, guid, data);
+}
+
+/* ID3D10Resource methods */
+
+static void STDMETHODCALLTYPE d3d10_texture1d_GetType(ID3D10Texture1D *iface,
+ D3D10_RESOURCE_DIMENSION *resource_dimension)
+{
+ TRACE("iface %p, resource_dimension %p\n", iface, resource_dimension);
+
+ *resource_dimension = D3D10_RESOURCE_DIMENSION_TEXTURE1D;
+}
+
+static void STDMETHODCALLTYPE d3d10_texture1d_SetEvictionPriority(ID3D10Texture1D *iface, UINT eviction_priority)
+{
+ FIXME("iface %p, eviction_priority %u stub!\n", iface, eviction_priority);
+}
+
+static UINT STDMETHODCALLTYPE d3d10_texture1d_GetEvictionPriority(ID3D10Texture1D *iface)
+{
+ FIXME("iface %p stub!\n", iface);
+
+ return 0;
+}
+
+/* ID3D10Texture1D methods */
+
+static HRESULT STDMETHODCALLTYPE d3d10_texture1d_Map(ID3D10Texture1D *iface, UINT sub_resource_idx,
+ D3D10_MAP map_type, UINT map_flags, void **data)
+{
+ FIXME("iface %p, sub_resource_idx %u, map_type %u, map_flags %#x, mapped_texture %p: stub.\n",
+ iface, sub_resource_idx, map_type, map_flags, data);
+
+ return E_FAIL;
+}
+
+static void STDMETHODCALLTYPE d3d10_texture1d_Unmap(ID3D10Texture1D *iface, UINT sub_resource_idx)
+{
+ FIXME("iface %p, sub_resource_idx %u: stub.\n", iface, sub_resource_idx);
+}
+
+static void STDMETHODCALLTYPE d3d10_texture1d_GetDesc(ID3D10Texture1D *iface, D3D10_TEXTURE1D_DESC *desc)
+{
+ FIXME("iface %p, desc %p: stub\n", iface, desc);
+}
+
+static const struct ID3D10Texture1DVtbl d3d10_texture1d_vtbl =
+{
+ /* IUnknown methods */
+ d3d10_texture1d_QueryInterface,
+ d3d10_texture1d_AddRef,
+ d3d10_texture1d_Release,
+ /* ID3D10DeviceChild methods */
+ d3d10_texture1d_GetDevice,
+ d3d10_texture1d_GetPrivateData,
+ d3d10_texture1d_SetPrivateData,
+ d3d10_texture1d_SetPrivateDataInterface,
+ /* ID3D10Resource methods */
+ d3d10_texture1d_GetType,
+ d3d10_texture1d_SetEvictionPriority,
+ d3d10_texture1d_GetEvictionPriority,
+ /* ID3D10Texture1D methods */
+ d3d10_texture1d_Map,
+ d3d10_texture1d_Unmap,
+ d3d10_texture1d_GetDesc,
+};
+
+struct d3d_texture1d *unsafe_impl_from_ID3D10Texture1D(ID3D10Texture1D *iface)
+{
+ if (!iface)
+ return NULL;
+ assert(iface->lpVtbl == &d3d10_texture1d_vtbl);
+ return CONTAINING_RECORD(iface, struct d3d_texture1d, ID3D10Texture1D_iface);
+}
+
+static HRESULT d3d_texture1d_init(struct d3d_texture1d *texture, struct d3d_device *device,
+ const D3D11_TEXTURE1D_DESC *desc, const D3D11_SUBRESOURCE_DATA *data)
+{
+ texture->ID3D11Texture1D_iface.lpVtbl = &d3d11_texture1d_vtbl;
+ texture->ID3D10Texture1D_iface.lpVtbl = &d3d10_texture1d_vtbl;
+ texture->refcount = 1;
+ texture->desc = *desc;
+
+ texture->device = &device->ID3D11Device_iface;
+ ID3D11Device_AddRef(texture->device);
+
+ return S_OK;
+}
+
+HRESULT d3d_texture1d_create(struct d3d_device *device, const D3D11_TEXTURE1D_DESC *desc,
+ const D3D11_SUBRESOURCE_DATA *data, struct d3d_texture1d **texture)
+{
+ struct d3d_texture1d *object;
+ HRESULT hr;
+
+ if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
+ return E_OUTOFMEMORY;
+
+ if (FAILED(hr = d3d_texture1d_init(object, device, desc, data)))
+ {
+ WARN("Failed to initialize texture, hr %#x.\n", hr);
+ HeapFree(GetProcessHeap(), 0, object);
+ return hr;
+ }
+
+ TRACE("Created texture %p.\n", object);
+ *texture = object;
+
+ return S_OK;
+}
+
/* ID3D11Texture2D methods */
static HRESULT STDMETHODCALLTYPE d3d11_texture2d_QueryInterface(ID3D11Texture2D *iface, REFIID riid, void **object)
--
1.9.1

View File

@ -1,135 +0,0 @@
From a1e800ac4f09ae90a19e2503682f069dd81850a5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Wed, 31 Aug 2016 16:22:43 +0200
Subject: d3d11: Create a texture in d3d_texture1d_init.
---
dlls/d3d11/d3d11_private.h | 1 +
dlls/d3d11/texture.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++
dlls/d3d11/utils.c | 8 ++++++++
3 files changed, 59 insertions(+)
diff --git a/dlls/d3d11/d3d11_private.h b/dlls/d3d11/d3d11_private.h
index 6bd7282..73f4196 100644
--- a/dlls/d3d11/d3d11_private.h
+++ b/dlls/d3d11/d3d11_private.h
@@ -111,6 +111,7 @@ struct d3d_texture1d
ID3D10Texture1D ID3D10Texture1D_iface;
LONG refcount;
+ struct wined3d_texture *wined3d_texture;
D3D11_TEXTURE1D_DESC desc;
ID3D11Device *device;
};
diff --git a/dlls/d3d11/texture.c b/dlls/d3d11/texture.c
index d201b23..55fb265 100644
--- a/dlls/d3d11/texture.c
+++ b/dlls/d3d11/texture.c
@@ -73,6 +73,9 @@ static ULONG STDMETHODCALLTYPE d3d11_texture1d_AddRef(ID3D11Texture1D *iface)
if (refcount == 1)
{
ID3D11Device_AddRef(texture->device);
+ wined3d_mutex_lock();
+ wined3d_texture_incref(texture->wined3d_texture);
+ wined3d_mutex_unlock();
}
return refcount;
@@ -89,6 +92,9 @@ static ULONG STDMETHODCALLTYPE d3d11_texture1d_Release(ID3D11Texture1D *iface)
{
ID3D11Device *device = texture->device;
+ wined3d_mutex_lock();
+ wined3d_texture_decref(texture->wined3d_texture);
+ wined3d_mutex_unlock();
/* Release the device last, it may cause the wined3d device to be
* destroyed. */
ID3D11Device_Release(device);
@@ -329,14 +335,58 @@ struct d3d_texture1d *unsafe_impl_from_ID3D10Texture1D(ID3D10Texture1D *iface)
return CONTAINING_RECORD(iface, struct d3d_texture1d, ID3D10Texture1D_iface);
}
+static void STDMETHODCALLTYPE d3d_texture1d_wined3d_object_released(void *parent)
+{
+ struct d3d_texture1d *texture = parent;
+
+ HeapFree(GetProcessHeap(), 0, texture);
+}
+
+static const struct wined3d_parent_ops d3d_texture1d_wined3d_parent_ops =
+{
+ d3d_texture1d_wined3d_object_released,
+};
+
static HRESULT d3d_texture1d_init(struct d3d_texture1d *texture, struct d3d_device *device,
const D3D11_TEXTURE1D_DESC *desc, const D3D11_SUBRESOURCE_DATA *data)
{
+ struct wined3d_resource_desc wined3d_desc;
+ unsigned int levels;
+ HRESULT hr;
+
texture->ID3D11Texture1D_iface.lpVtbl = &d3d11_texture1d_vtbl;
texture->ID3D10Texture1D_iface.lpVtbl = &d3d10_texture1d_vtbl;
texture->refcount = 1;
texture->desc = *desc;
+ wined3d_mutex_lock();
+
+ wined3d_desc.resource_type = WINED3D_RTYPE_TEXTURE_1D;
+ 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_d3d11(desc->BindFlags, desc->Usage);
+ wined3d_desc.access = WINED3D_RESOURCE_ACCESS_GPU;
+ wined3d_desc.width = desc->Width;
+ wined3d_desc.height = 1;
+ wined3d_desc.depth = 1;
+ wined3d_desc.size = 0;
+
+ levels = desc->MipLevels ? desc->MipLevels : wined3d_log2i(max(desc->Width, 1)) + 1;
+
+ if (FAILED(hr = wined3d_texture_create(device->wined3d_device, &wined3d_desc,
+ desc->ArraySize, levels, 0, (struct wined3d_sub_resource_data *)data,
+ texture, &d3d_texture1d_wined3d_parent_ops, &texture->wined3d_texture)))
+ {
+ WARN("Failed to create wined3d texture, hr %#x.\n", hr);
+ wined3d_mutex_unlock();
+ if (hr == WINED3DERR_NOTAVAILABLE || hr == WINED3DERR_INVALIDCALL)
+ hr = E_INVALIDARG;
+ return hr;
+ }
+ texture->desc.MipLevels = levels;
+ wined3d_mutex_unlock();
+
texture->device = &device->ID3D11Device_iface;
ID3D11Device_AddRef(texture->device);
diff --git a/dlls/d3d11/utils.c b/dlls/d3d11/utils.c
index 89dbbda..06f2600 100644
--- a/dlls/d3d11/utils.c
+++ b/dlls/d3d11/utils.c
@@ -566,6 +566,10 @@ struct wined3d_resource *wined3d_resource_from_d3d11_resource(ID3D11Resource *re
return wined3d_buffer_get_resource(unsafe_impl_from_ID3D11Buffer(
(ID3D11Buffer *)resource)->wined3d_buffer);
+ case D3D11_RESOURCE_DIMENSION_TEXTURE1D:
+ return wined3d_texture_get_resource(unsafe_impl_from_ID3D11Texture1D(
+ (ID3D11Texture1D *)resource)->wined3d_texture);
+
case D3D11_RESOURCE_DIMENSION_TEXTURE2D:
return wined3d_texture_get_resource(unsafe_impl_from_ID3D11Texture2D(
(ID3D11Texture2D *)resource)->wined3d_texture);
@@ -592,6 +596,10 @@ struct wined3d_resource *wined3d_resource_from_d3d10_resource(ID3D10Resource *re
return wined3d_buffer_get_resource(unsafe_impl_from_ID3D10Buffer(
(ID3D10Buffer *)resource)->wined3d_buffer);
+ case D3D10_RESOURCE_DIMENSION_TEXTURE1D:
+ return wined3d_texture_get_resource(unsafe_impl_from_ID3D10Texture1D(
+ (ID3D10Texture1D *)resource)->wined3d_texture);
+
case D3D10_RESOURCE_DIMENSION_TEXTURE2D:
return wined3d_texture_get_resource(unsafe_impl_from_ID3D10Texture2D(
(ID3D10Texture2D *)resource)->wined3d_texture);
--
2.8.1

View File

@ -1,53 +0,0 @@
From 25be3c1b3ee879ab4dcc4721636042d3bb7c52af Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Wed, 31 Aug 2016 16:23:12 +0200
Subject: d3d11: Create a private store in d3d_texture1d_init.
---
dlls/d3d11/d3d11_private.h | 1 +
dlls/d3d11/texture.c | 3 +++
2 files changed, 4 insertions(+)
diff --git a/dlls/d3d11/d3d11_private.h b/dlls/d3d11/d3d11_private.h
index 73f4196..4a18ca7 100644
--- a/dlls/d3d11/d3d11_private.h
+++ b/dlls/d3d11/d3d11_private.h
@@ -111,6 +111,7 @@ struct d3d_texture1d
ID3D10Texture1D ID3D10Texture1D_iface;
LONG refcount;
+ struct wined3d_private_store private_store;
struct wined3d_texture *wined3d_texture;
D3D11_TEXTURE1D_DESC desc;
ID3D11Device *device;
diff --git a/dlls/d3d11/texture.c b/dlls/d3d11/texture.c
index 55fb265..0c269c1 100644
--- a/dlls/d3d11/texture.c
+++ b/dlls/d3d11/texture.c
@@ -339,6 +339,7 @@ static void STDMETHODCALLTYPE d3d_texture1d_wined3d_object_released(void *parent
{
struct d3d_texture1d *texture = parent;
+ wined3d_private_store_cleanup(&texture->private_store);
HeapFree(GetProcessHeap(), 0, texture);
}
@@ -360,6 +361,7 @@ static HRESULT d3d_texture1d_init(struct d3d_texture1d *texture, struct d3d_devi
texture->desc = *desc;
wined3d_mutex_lock();
+ wined3d_private_store_init(&texture->private_store);
wined3d_desc.resource_type = WINED3D_RTYPE_TEXTURE_1D;
wined3d_desc.format = wined3dformat_from_dxgi_format(desc->Format);
@@ -379,6 +381,7 @@ static HRESULT d3d_texture1d_init(struct d3d_texture1d *texture, struct d3d_devi
texture, &d3d_texture1d_wined3d_parent_ops, &texture->wined3d_texture)))
{
WARN("Failed to create wined3d texture, hr %#x.\n", hr);
+ wined3d_private_store_cleanup(&texture->private_store);
wined3d_mutex_unlock();
if (hr == WINED3DERR_NOTAVAILABLE || hr == WINED3DERR_INVALIDCALL)
hr = E_INVALIDARG;
--
2.8.1

View File

@ -1,83 +0,0 @@
From d29fadf3f80f98f06f955739ede3739dc1425459 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sat, 27 Aug 2016 23:59:20 +0200
Subject: d3d11: Generate dxgi surface in d3d_texture1d_init.
---
dlls/d3d11/d3d11_private.h | 1 +
dlls/d3d11/texture.c | 33 +++++++++++++++++++++++++++++++++
2 files changed, 34 insertions(+)
diff --git a/dlls/d3d11/d3d11_private.h b/dlls/d3d11/d3d11_private.h
index 3bd2dec..edf7217 100644
--- a/dlls/d3d11/d3d11_private.h
+++ b/dlls/d3d11/d3d11_private.h
@@ -112,6 +112,7 @@ struct d3d_texture1d
LONG refcount;
struct wined3d_private_store private_store;
+ IUnknown *dxgi_surface;
struct wined3d_texture *wined3d_texture;
D3D11_TEXTURE1D_DESC desc;
ID3D11Device *device;
diff --git a/dlls/d3d11/texture.c b/dlls/d3d11/texture.c
index 2fe7aa4..94f4c57 100644
--- a/dlls/d3d11/texture.c
+++ b/dlls/d3d11/texture.c
@@ -57,6 +57,12 @@ static HRESULT STDMETHODCALLTYPE d3d11_texture1d_QueryInterface(ID3D11Texture1D
return S_OK;
}
+ if (texture->dxgi_surface)
+ {
+ TRACE("Forwarding to dxgi surface.\n");
+ return IUnknown_QueryInterface(texture->dxgi_surface, riid, object);
+ }
+
WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid));
*object = NULL;
@@ -339,6 +345,7 @@ static void STDMETHODCALLTYPE d3d_texture1d_wined3d_object_released(void *parent
{
struct d3d_texture1d *texture = parent;
+ if (texture->dxgi_surface) IUnknown_Release(texture->dxgi_surface);
wined3d_private_store_cleanup(&texture->private_store);
HeapFree(GetProcessHeap(), 0, texture);
}
@@ -388,6 +395,32 @@ static HRESULT d3d_texture1d_init(struct d3d_texture1d *texture, struct d3d_devi
return hr;
}
texture->desc.MipLevels = levels;
+
+ if (desc->MipLevels == 1 && desc->ArraySize == 1)
+ {
+ IWineDXGIDevice *wine_device;
+
+ if (FAILED(hr = ID3D10Device1_QueryInterface(&device->ID3D10Device1_iface, &IID_IWineDXGIDevice,
+ (void **)&wine_device)))
+ {
+ ERR("Device should implement IWineDXGIDevice.\n");
+ wined3d_texture_decref(texture->wined3d_texture);
+ wined3d_mutex_unlock();
+ return E_FAIL;
+ }
+
+ hr = IWineDXGIDevice_create_surface(wine_device, texture->wined3d_texture, 0, NULL,
+ (IUnknown *)&texture->ID3D10Texture1D_iface, (void **)&texture->dxgi_surface);
+ IWineDXGIDevice_Release(wine_device);
+ if (FAILED(hr))
+ {
+ ERR("Failed to create DXGI surface, returning %#x\n", hr);
+ texture->dxgi_surface = NULL;
+ wined3d_texture_decref(texture->wined3d_texture);
+ wined3d_mutex_unlock();
+ return hr;
+ }
+ }
wined3d_mutex_unlock();
texture->device = &device->ID3D11Device_iface;
--
2.9.0

View File

@ -1,40 +0,0 @@
From 49ab2b28ef9d217479be639dcc89b689bcbf758c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sat, 27 Aug 2016 23:34:24 +0200
Subject: d3d11: Improve d3d11_texture1d_GetDesc by obtaining the current width
and format from wined3d.
---
dlls/d3d11/texture.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/dlls/d3d11/texture.c b/dlls/d3d11/texture.c
index e116994..3336367 100644
--- a/dlls/d3d11/texture.c
+++ b/dlls/d3d11/texture.c
@@ -166,10 +166,21 @@ static UINT STDMETHODCALLTYPE d3d11_texture1d_GetEvictionPriority(ID3D11Texture1
static void STDMETHODCALLTYPE d3d11_texture1d_GetDesc(ID3D11Texture1D *iface, D3D11_TEXTURE1D_DESC *desc)
{
struct d3d_texture1d *texture = impl_from_ID3D11Texture1D(iface);
+ struct wined3d_resource_desc wined3d_desc;
- FIXME("iface %p, desc %p: semi-stub.\n", iface, desc);
+ TRACE("iface %p, desc %p.\n", iface, desc);
*desc = texture->desc;
+
+ wined3d_mutex_lock();
+ wined3d_resource_get_desc(wined3d_texture_get_resource(texture->wined3d_texture), &wined3d_desc);
+ wined3d_mutex_unlock();
+
+ /* FIXME: Resizing swapchain buffers can cause these to change. We'd like
+ * to get everything from wined3d, but e.g. bind flags don't exist as such
+ * there (yet). */
+ desc->Width = wined3d_desc.width;
+ desc->Format = dxgi_format_from_wined3dformat(wined3d_desc.format);
}
static const struct ID3D11Texture1DVtbl d3d11_texture1d_vtbl =
--
2.8.1

View File

@ -1,56 +0,0 @@
From 6709d525107a787f91530b7ffae1e108bd971744 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sat, 27 Aug 2016 23:36:25 +0200
Subject: d3d11: Implement d3d10_texture1d_(Un)map.
---
dlls/d3d11/texture.c | 27 ++++++++++++++++++++++++---
1 file changed, 24 insertions(+), 3 deletions(-)
diff --git a/dlls/d3d11/texture.c b/dlls/d3d11/texture.c
index 3336367..204aa98 100644
--- a/dlls/d3d11/texture.c
+++ b/dlls/d3d11/texture.c
@@ -307,15 +307,36 @@ static UINT STDMETHODCALLTYPE d3d10_texture1d_GetEvictionPriority(ID3D10Texture1
static HRESULT STDMETHODCALLTYPE d3d10_texture1d_Map(ID3D10Texture1D *iface, UINT sub_resource_idx,
D3D10_MAP map_type, UINT map_flags, void **data)
{
- FIXME("iface %p, sub_resource_idx %u, map_type %u, map_flags %#x, mapped_texture %p: stub.\n",
+ struct d3d_texture1d *texture = impl_from_ID3D10Texture1D(iface);
+ struct wined3d_map_desc wined3d_map_desc;
+ HRESULT hr;
+
+ 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, data);
- return E_FAIL;
+ if (map_flags)
+ FIXME("Ignoring map_flags %#x.\n", map_flags);
+
+ wined3d_mutex_lock();
+ if (SUCCEEDED(hr = wined3d_resource_map(wined3d_texture_get_resource(texture->wined3d_texture), sub_resource_idx,
+ &wined3d_map_desc, NULL, wined3d_map_flags_from_d3d11_map_type(map_type))))
+ {
+ *data = wined3d_map_desc.data;
+ }
+ wined3d_mutex_unlock();
+
+ return hr;
}
static void STDMETHODCALLTYPE d3d10_texture1d_Unmap(ID3D10Texture1D *iface, UINT sub_resource_idx)
{
- FIXME("iface %p, sub_resource_idx %u: stub.\n", iface, sub_resource_idx);
+ struct d3d_texture1d *texture = impl_from_ID3D10Texture1D(iface);
+
+ TRACE("iface %p, sub_resource_idx %u.\n", iface, sub_resource_idx);
+
+ wined3d_mutex_lock();
+ wined3d_resource_unmap(wined3d_texture_get_resource(texture->wined3d_texture), sub_resource_idx);
+ wined3d_mutex_unlock();
}
static void STDMETHODCALLTYPE d3d10_texture1d_GetDesc(ID3D10Texture1D *iface, D3D10_TEXTURE1D_DESC *desc)
--
2.8.1

View File

@ -1,39 +0,0 @@
From 94a19771d621239e2a17f94ce89f797fd28877ab Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sat, 27 Aug 2016 23:37:59 +0200
Subject: d3d11: Implement d3d10_texture1d_GetDesc.
---
dlls/d3d11/texture.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/dlls/d3d11/texture.c b/dlls/d3d11/texture.c
index 204aa98..e8b0047 100644
--- a/dlls/d3d11/texture.c
+++ b/dlls/d3d11/texture.c
@@ -341,7 +341,21 @@ static void STDMETHODCALLTYPE d3d10_texture1d_Unmap(ID3D10Texture1D *iface, UINT
static void STDMETHODCALLTYPE d3d10_texture1d_GetDesc(ID3D10Texture1D *iface, D3D10_TEXTURE1D_DESC *desc)
{
- FIXME("iface %p, desc %p: stub\n", iface, desc);
+ struct d3d_texture1d *texture = impl_from_ID3D10Texture1D(iface);
+ D3D11_TEXTURE1D_DESC d3d11_desc;
+
+ TRACE("iface %p, desc %p.\n", iface, desc);
+
+ d3d11_texture1d_GetDesc(&texture->ID3D11Texture1D_iface, &d3d11_desc);
+
+ desc->Width = d3d11_desc.Width;
+ desc->MipLevels = d3d11_desc.MipLevels;
+ desc->ArraySize = d3d11_desc.ArraySize;
+ 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 ID3D10Texture1DVtbl d3d10_texture1d_vtbl =
--
2.8.1

View File

@ -1,62 +0,0 @@
From d204de51fa14b6245cbf4afd0f0ddc01f9aa554b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sat, 27 Aug 2016 23:39:56 +0200
Subject: d3d11: Implement d3d11_texture1d_{G,S}etPrivateData.
---
dlls/d3d11/texture.c | 32 ++++++++++++++++++++++++++++----
1 file changed, 28 insertions(+), 4 deletions(-)
diff --git a/dlls/d3d11/texture.c b/dlls/d3d11/texture.c
index e8b0047..411dca6 100644
--- a/dlls/d3d11/texture.c
+++ b/dlls/d3d11/texture.c
@@ -122,17 +122,41 @@ static void STDMETHODCALLTYPE d3d11_texture1d_GetDevice(ID3D11Texture1D *iface,
static HRESULT STDMETHODCALLTYPE d3d11_texture1d_GetPrivateData(ID3D11Texture1D *iface,
REFGUID guid, UINT *data_size, void *data)
{
- FIXME("iface %p, guid %s, data_size %p, data %p: stub.\n", iface, debugstr_guid(guid), data_size, data);
+ struct d3d_texture1d *texture = impl_from_ID3D11Texture1D(iface);
+ IDXGISurface *dxgi_surface;
+ HRESULT hr;
- return E_FAIL;
+ TRACE("iface %p, guid %s, data_size %p, data %p.\n", iface, debugstr_guid(guid), data_size, data);
+
+ if (texture->dxgi_surface
+ && SUCCEEDED(IUnknown_QueryInterface(texture->dxgi_surface, &IID_IDXGISurface, (void **)&dxgi_surface)))
+ {
+ hr = IDXGISurface_GetPrivateData(dxgi_surface, guid, data_size, data);
+ IDXGISurface_Release(dxgi_surface);
+ return hr;
+ }
+
+ return d3d_get_private_data(&texture->private_store, guid, data_size, data);
}
static HRESULT STDMETHODCALLTYPE d3d11_texture1d_SetPrivateData(ID3D11Texture1D *iface,
REFGUID guid, UINT data_size, const void *data)
{
- FIXME("iface %p, guid %s, data_size %u, data %p: stub.\n", iface, debugstr_guid(guid), data_size, data);
+ struct d3d_texture1d *texture = impl_from_ID3D11Texture1D(iface);
+ IDXGISurface *dxgi_surface;
+ HRESULT hr;
- return E_FAIL;
+ TRACE("iface %p, guid %s, data_size %u, data %p.\n", iface, debugstr_guid(guid), data_size, data);
+
+ if (texture->dxgi_surface
+ && SUCCEEDED(IUnknown_QueryInterface(texture->dxgi_surface, &IID_IDXGISurface, (void **)&dxgi_surface)))
+ {
+ hr = IDXGISurface_SetPrivateData(dxgi_surface, guid, data_size, data);
+ IDXGISurface_Release(dxgi_surface);
+ return hr;
+ }
+
+ return d3d_set_private_data(&texture->private_store, guid, data_size, data);
}
static HRESULT STDMETHODCALLTYPE d3d11_texture1d_SetPrivateDataInterface(ID3D11Texture1D *iface,
--
2.8.1

View File

@ -1,40 +0,0 @@
From 950c6ffc394ca315f5769b04ce5390ce8798949d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sat, 27 Aug 2016 23:42:10 +0200
Subject: d3d11: Add d3d11_texture1d_SetPrivateDataInterface.
---
dlls/d3d11/texture.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/dlls/d3d11/texture.c b/dlls/d3d11/texture.c
index 411dca6..eb39ef8 100644
--- a/dlls/d3d11/texture.c
+++ b/dlls/d3d11/texture.c
@@ -162,9 +162,21 @@ static HRESULT STDMETHODCALLTYPE d3d11_texture1d_SetPrivateData(ID3D11Texture1D
static HRESULT STDMETHODCALLTYPE d3d11_texture1d_SetPrivateDataInterface(ID3D11Texture1D *iface,
REFGUID guid, const IUnknown *data)
{
- FIXME("iface %p, guid %s, data %p: stub.\n", iface, debugstr_guid(guid), data);
+ struct d3d_texture1d *texture = impl_from_ID3D11Texture1D(iface);
+ IDXGISurface *dxgi_surface;
+ HRESULT hr;
+
+ TRACE("iface %p, guid %s, data %p.\n", iface, debugstr_guid(guid), data);
+
+ if (texture->dxgi_surface
+ && SUCCEEDED(IUnknown_QueryInterface(texture->dxgi_surface, &IID_IDXGISurface, (void **)&dxgi_surface)))
+ {
+ hr = IDXGISurface_SetPrivateDataInterface(dxgi_surface, guid, data);
+ IDXGISurface_Release(dxgi_surface);
+ return hr;
+ }
- return E_FAIL;
+ return d3d_set_private_data_interface(&texture->private_store, guid, data);
}
static void STDMETHODCALLTYPE d3d11_texture1d_GetType(ID3D11Texture1D *iface,
--
2.8.1

View File

@ -1,33 +0,0 @@
From 7e3f33623d4ddf7a8fb0bab30b5c9ce18344e0ce Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Thu, 25 Aug 2016 21:23:52 +0200
Subject: d3d11: Add a hack to prevent creation of 1d cube textures
There is already a check in wined3d to prevent this, but it is not triggered
as the request to create a cube texture is currently not forwarded to wined3d.
The correct solution would be to change wined3d_usage_from_d3d11 to translate
the D3D11_RESOURCE_MISC_TEXTURECUBE flag into WINED3DUSAGE_LEGACY_CUBEMAP.
This would also prevent the creation of 2d cube map arrays which are not
supported yet, but some d3d11 tests are based on the fact that wine pretends
to support them by simply using 2d array textues and ignoring the cube map flags.
---
dlls/d3d11/texture.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/dlls/d3d11/texture.c b/dlls/d3d11/texture.c
index eb39ef8..541ed45 100644
--- a/dlls/d3d11/texture.c
+++ b/dlls/d3d11/texture.c
@@ -444,6 +444,9 @@ static HRESULT d3d_texture1d_init(struct d3d_texture1d *texture, struct d3d_devi
unsigned int levels;
HRESULT hr;
+ if (desc->MiscFlags & D3D11_RESOURCE_MISC_TEXTURECUBE)
+ return E_INVALIDARG;
+
texture->ID3D11Texture1D_iface.lpVtbl = &d3d11_texture1d_vtbl;
texture->ID3D10Texture1D_iface.lpVtbl = &d3d10_texture1d_vtbl;
texture->refcount = 1;
--
2.8.1

View File

@ -1,44 +0,0 @@
From 7d92409655346368c6af7c90f8285ec1f1b40a94 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Thu, 25 Aug 2016 19:44:57 +0200
Subject: d3d11: Add support for 1d textures in normalize_srv_desc.
---
dlls/d3d11/view.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/dlls/d3d11/view.c b/dlls/d3d11/view.c
index 205513d..d6974d8 100644
--- a/dlls/d3d11/view.c
+++ b/dlls/d3d11/view.c
@@ -604,6 +604,8 @@ static HRESULT normalize_srv_desc(D3D11_SHADER_RESOURCE_VIEW_DESC *desc, ID3D11R
case D3D11_RESOURCE_DIMENSION_TEXTURE1D:
{
+ const struct d3d_texture1d *texture;
+
if (desc->ViewDimension != D3D11_SRV_DIMENSION_TEXTURE1D
&& desc->ViewDimension != D3D11_SRV_DIMENSION_TEXTURE1DARRAY)
{
@@ -611,8 +613,16 @@ static HRESULT normalize_srv_desc(D3D11_SHADER_RESOURCE_VIEW_DESC *desc, ID3D11R
return E_INVALIDARG;
}
- FIXME("Unhandled 1D texture resource.\n");
- return S_OK;
+ if (!(texture = unsafe_impl_from_ID3D11Texture1D((ID3D11Texture1D *)resource)))
+ {
+ ERR("Cannot get implementation from ID3D11Texture1D.\n");
+ return E_FAIL;
+ }
+
+ format = texture->desc.Format;
+ miplevel_count = texture->desc.MipLevels;
+ layer_count = texture->desc.ArraySize;
+ break;
}
case D3D11_RESOURCE_DIMENSION_TEXTURE2D:
--
2.8.1

View File

@ -1,43 +0,0 @@
From 1cb0fbe3fbec0f3acda805b3a4d44b2afb21419e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Thu, 25 Aug 2016 19:45:05 +0200
Subject: d3d11: Add support for 1d textures in normalize_rtv_desc.
---
dlls/d3d11/view.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/dlls/d3d11/view.c b/dlls/d3d11/view.c
index d6974d8..eb936e3 100644
--- a/dlls/d3d11/view.c
+++ b/dlls/d3d11/view.c
@@ -344,6 +344,8 @@ static HRESULT normalize_rtv_desc(D3D11_RENDER_TARGET_VIEW_DESC *desc, ID3D11Res
case D3D11_RESOURCE_DIMENSION_TEXTURE1D:
{
+ const struct d3d_texture1d *texture;
+
if (desc->ViewDimension != D3D11_RTV_DIMENSION_TEXTURE1D
&& desc->ViewDimension != D3D11_RTV_DIMENSION_TEXTURE1DARRAY)
{
@@ -351,8 +353,15 @@ static HRESULT normalize_rtv_desc(D3D11_RENDER_TARGET_VIEW_DESC *desc, ID3D11Res
return E_INVALIDARG;
}
- FIXME("Unhandled 1D texture resource.\n");
- return S_OK;
+ if (!(texture = unsafe_impl_from_ID3D11Texture1D((ID3D11Texture1D *)resource)))
+ {
+ ERR("Cannot get implementation from ID3D11Texture1D.\n");
+ return E_FAIL;
+ }
+
+ format = texture->desc.Format;
+ layer_count = texture->desc.ArraySize;
+ break;
}
case D3D11_RESOURCE_DIMENSION_TEXTURE2D:
--
2.8.1

View File

@ -1,49 +0,0 @@
From 96b5e1dd2f60a78037c19e6812b97616412da1b9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Thu, 25 Aug 2016 19:47:01 +0200
Subject: d3d11/tests: Add support for 1d textures in check_srv_desc_.
---
dlls/d3d11/tests/d3d11.c | 26 +++++++++++++++++++++++++-
1 file changed, 25 insertions(+), 1 deletion(-)
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c
index c2b2535..c26d6aa 100644
--- a/dlls/d3d11/tests/d3d11.c
+++ b/dlls/d3d11/tests/d3d11.c
@@ -218,7 +218,31 @@ static void check_srv_desc_(unsigned int line, const D3D11_SHADER_RESOURCE_VIEW_
if (desc->ViewDimension != expected_desc->dimension)
return;
- if (desc->ViewDimension == D3D11_SRV_DIMENSION_TEXTURE2D)
+ if (desc->ViewDimension == D3D11_SRV_DIMENSION_TEXTURE1D)
+ {
+ ok_(__FILE__, line)(U(*desc).Texture1D.MostDetailedMip == expected_desc->miplevel_idx,
+ "Got MostDetailedMip %u, expected %u.\n",
+ U(*desc).Texture1D.MostDetailedMip, expected_desc->miplevel_idx);
+ ok_(__FILE__, line)(U(*desc).Texture1D.MipLevels == expected_desc->miplevel_count,
+ "Got MipLevels %u, expected %u.\n",
+ U(*desc).Texture1D.MipLevels, expected_desc->miplevel_count);
+ }
+ else if (desc->ViewDimension == D3D11_SRV_DIMENSION_TEXTURE1DARRAY)
+ {
+ ok_(__FILE__, line)(U(*desc).Texture1DArray.MostDetailedMip == expected_desc->miplevel_idx,
+ "Got MostDetailedMip %u, expected %u.\n",
+ U(*desc).Texture1DArray.MostDetailedMip, expected_desc->miplevel_idx);
+ ok_(__FILE__, line)(U(*desc).Texture1DArray.MipLevels == expected_desc->miplevel_count,
+ "Got MipLevels %u, expected %u.\n",
+ U(*desc).Texture1DArray.MipLevels, expected_desc->miplevel_count);
+ ok_(__FILE__, line)(U(*desc).Texture1DArray.FirstArraySlice == expected_desc->layer_idx,
+ "Got FirstArraySlice %u, expected %u.\n",
+ U(*desc).Texture1DArray.FirstArraySlice, expected_desc->layer_idx);
+ ok_(__FILE__, line)(U(*desc).Texture1DArray.ArraySize == expected_desc->layer_count,
+ "Got ArraySize %u, expected %u.\n",
+ U(*desc).Texture1DArray.ArraySize, expected_desc->layer_count);
+ }
+ else if (desc->ViewDimension == D3D11_SRV_DIMENSION_TEXTURE2D)
{
ok_(__FILE__, line)(U(*desc).Texture2D.MostDetailedMip == expected_desc->miplevel_idx,
"Got MostDetailedMip %u, expected %u.\n",
--
2.8.1

View File

@ -1,43 +0,0 @@
From c0da253595db60baf8174abac5d591223d1b570f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Thu, 25 Aug 2016 19:47:27 +0200
Subject: d3d11/tests: Add support for 1d textures in check_rtv_desc_.
---
dlls/d3d11/tests/d3d11.c | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c
index c26d6aa..639c54f 100644
--- a/dlls/d3d11/tests/d3d11.c
+++ b/dlls/d3d11/tests/d3d11.c
@@ -377,7 +377,25 @@ static void check_rtv_desc_(unsigned int line, const D3D11_RENDER_TARGET_VIEW_DE
if (desc->ViewDimension != expected_desc->dimension)
return;
- if (desc->ViewDimension == D3D11_RTV_DIMENSION_TEXTURE2D)
+ if (desc->ViewDimension == D3D11_RTV_DIMENSION_TEXTURE1D)
+ {
+ ok_(__FILE__, line)(U(*desc).Texture1D.MipSlice == expected_desc->miplevel_idx,
+ "Got MipSlice %u, expected %u.\n",
+ U(*desc).Texture1D.MipSlice, expected_desc->miplevel_idx);
+ }
+ else if (desc->ViewDimension == D3D11_RTV_DIMENSION_TEXTURE1DARRAY)
+ {
+ ok_(__FILE__, line)(U(*desc).Texture1DArray.MipSlice == expected_desc->miplevel_idx,
+ "Got MipSlice %u, expected %u.\n",
+ U(*desc).Texture1DArray.MipSlice, expected_desc->miplevel_idx);
+ ok_(__FILE__, line)(U(*desc).Texture1DArray.FirstArraySlice == expected_desc->layer_idx,
+ "Got FirstArraySlice %u, expected %u.\n",
+ U(*desc).Texture1DArray.FirstArraySlice, expected_desc->layer_idx);
+ ok_(__FILE__, line)(U(*desc).Texture1DArray.ArraySize == expected_desc->layer_count,
+ "Got ArraySize %u, expected %u.\n",
+ U(*desc).Texture1DArray.ArraySize, expected_desc->layer_count);
+ }
+ else if (desc->ViewDimension == D3D11_RTV_DIMENSION_TEXTURE2D)
{
ok_(__FILE__, line)(U(*desc).Texture2D.MipSlice == expected_desc->miplevel_idx,
"Got MipSlice %u, expected %u.\n",
--
2.8.1

View File

@ -1,219 +0,0 @@
From dad1b9f398b041ba706723cc8857fcc2e9cc2669 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Thu, 25 Aug 2016 19:49:52 +0200
Subject: d3d11/tests: Add test for creating 1d textures.
---
dlls/d3d11/tests/d3d11.c | 189 +++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 189 insertions(+)
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c
index 8ad94af..2b0b6f6 100644
--- a/dlls/d3d11/tests/d3d11.c
+++ b/dlls/d3d11/tests/d3d11.c
@@ -1618,6 +1618,194 @@ static void test_get_immediate_context(void)
ok(!refcount, "Device has %u references left.\n", refcount);
}
+static void test_create_texture1d(void)
+{
+ ULONG refcount, expected_refcount;
+ D3D11_SUBRESOURCE_DATA data = {0};
+ D3D_FEATURE_LEVEL feature_level;
+ ID3D11Device *device, *tmp;
+ D3D11_TEXTURE1D_DESC desc;
+ ID3D11Texture1D *texture;
+ IDXGISurface *surface;
+ unsigned int i;
+ HRESULT hr;
+
+ static const struct
+ {
+ DXGI_FORMAT format;
+ UINT array_size;
+ D3D11_BIND_FLAG bind_flags;
+ UINT misc_flags;
+ BOOL succeeds;
+ BOOL todo;
+ }
+ tests[] =
+ {
+ {DXGI_FORMAT_R32G32B32A32_TYPELESS, 1, D3D11_BIND_VERTEX_BUFFER, 0, FALSE, TRUE},
+ {DXGI_FORMAT_R32G32B32A32_TYPELESS, 1, D3D11_BIND_INDEX_BUFFER, 0, FALSE, TRUE},
+ {DXGI_FORMAT_R32G32B32A32_TYPELESS, 1, D3D11_BIND_CONSTANT_BUFFER, 0, FALSE, TRUE},
+ {DXGI_FORMAT_R32G32B32A32_TYPELESS, 0, D3D11_BIND_SHADER_RESOURCE, 0, FALSE, FALSE},
+ {DXGI_FORMAT_R32G32B32A32_TYPELESS, 1, D3D11_BIND_SHADER_RESOURCE, 0, TRUE, FALSE},
+ {DXGI_FORMAT_R32G32B32A32_TYPELESS, 2, D3D11_BIND_SHADER_RESOURCE, 0, TRUE, FALSE},
+ {DXGI_FORMAT_R32G32B32A32_TYPELESS, 3, D3D11_BIND_SHADER_RESOURCE, 0, TRUE, FALSE},
+ {DXGI_FORMAT_R32G32B32A32_TYPELESS, 3, D3D11_BIND_SHADER_RESOURCE, D3D11_RESOURCE_MISC_TEXTURECUBE,
+ FALSE, FALSE},
+ {DXGI_FORMAT_R32G32B32A32_TYPELESS, 1, D3D11_BIND_SHADER_RESOURCE, D3D11_RESOURCE_MISC_TEXTURECUBE,
+ FALSE, FALSE},
+ {DXGI_FORMAT_R32G32B32A32_TYPELESS, 5, D3D11_BIND_SHADER_RESOURCE, D3D11_RESOURCE_MISC_TEXTURECUBE,
+ FALSE, FALSE},
+ {DXGI_FORMAT_R32G32B32A32_TYPELESS, 0, D3D11_BIND_RENDER_TARGET, 0, FALSE, FALSE},
+ {DXGI_FORMAT_R32G32B32A32_TYPELESS, 1, D3D11_BIND_RENDER_TARGET, 0, TRUE, FALSE},
+ {DXGI_FORMAT_R32G32B32A32_TYPELESS, 2, D3D11_BIND_RENDER_TARGET, 0, TRUE, FALSE},
+ {DXGI_FORMAT_R32G32B32A32_TYPELESS, 9, D3D11_BIND_RENDER_TARGET, 0, TRUE, FALSE},
+ {DXGI_FORMAT_R32G32B32A32_TYPELESS, 1, D3D11_BIND_DEPTH_STENCIL, 0, FALSE, FALSE},
+ {DXGI_FORMAT_R32G32B32A32_UINT, 1, D3D11_BIND_RENDER_TARGET, 0, TRUE, FALSE},
+ {DXGI_FORMAT_R32G32B32A32_SINT, 1, D3D11_BIND_RENDER_TARGET, 0, TRUE, FALSE},
+ {DXGI_FORMAT_R32G32B32_TYPELESS, 1, D3D11_BIND_SHADER_RESOURCE, 0, TRUE, FALSE},
+ {DXGI_FORMAT_R16G16B16A16_TYPELESS, 1, D3D11_BIND_SHADER_RESOURCE, 0, TRUE, FALSE},
+ {DXGI_FORMAT_R16G16B16A16_TYPELESS, 1, D3D11_BIND_RENDER_TARGET, 0, TRUE, FALSE},
+ {DXGI_FORMAT_R32G32_TYPELESS, 1, D3D11_BIND_SHADER_RESOURCE, 0, TRUE, FALSE},
+ {DXGI_FORMAT_R32G8X24_TYPELESS, 1, D3D11_BIND_DEPTH_STENCIL, 0, TRUE, FALSE},
+ {DXGI_FORMAT_R10G10B10A2_TYPELESS, 1, D3D11_BIND_SHADER_RESOURCE, 0, TRUE, FALSE},
+ {DXGI_FORMAT_R10G10B10A2_TYPELESS, 1, D3D11_BIND_RENDER_TARGET, 0, TRUE, FALSE},
+ {DXGI_FORMAT_R16G16_TYPELESS, 1, D3D11_BIND_SHADER_RESOURCE, 0, TRUE, FALSE},
+ {DXGI_FORMAT_R16G16_UNORM, 1, D3D11_BIND_RENDER_TARGET, 0, TRUE, FALSE},
+ {DXGI_FORMAT_R16G16_SNORM, 1, D3D11_BIND_RENDER_TARGET, 0, TRUE, FALSE},
+ {DXGI_FORMAT_R32_TYPELESS, 0, D3D11_BIND_SHADER_RESOURCE, 0, FALSE, FALSE},
+ {DXGI_FORMAT_R32_TYPELESS, 1, D3D11_BIND_SHADER_RESOURCE, 0, TRUE, FALSE},
+ {DXGI_FORMAT_R32_TYPELESS, 9, D3D11_BIND_SHADER_RESOURCE, 0, TRUE, FALSE},
+ {DXGI_FORMAT_R32_TYPELESS, 9, D3D11_BIND_SHADER_RESOURCE, D3D11_RESOURCE_MISC_TEXTURECUBE,
+ FALSE, FALSE},
+ {DXGI_FORMAT_R32_TYPELESS, 1, D3D11_BIND_DEPTH_STENCIL, 0, TRUE, FALSE},
+ {DXGI_FORMAT_R24G8_TYPELESS, 1, D3D11_BIND_VERTEX_BUFFER, 0, FALSE, TRUE},
+ {DXGI_FORMAT_R24G8_TYPELESS, 1, D3D11_BIND_INDEX_BUFFER, 0, FALSE, TRUE},
+ {DXGI_FORMAT_R24G8_TYPELESS, 1, D3D11_BIND_CONSTANT_BUFFER, 0, FALSE, TRUE},
+ {DXGI_FORMAT_R24G8_TYPELESS, 1, D3D11_BIND_SHADER_RESOURCE, 0, TRUE, FALSE},
+ {DXGI_FORMAT_R24G8_TYPELESS, 1, D3D11_BIND_DEPTH_STENCIL, 0, TRUE, FALSE},
+ {DXGI_FORMAT_R8G8_TYPELESS, 1, D3D11_BIND_SHADER_RESOURCE, 0, TRUE, FALSE},
+ {DXGI_FORMAT_R8G8_TYPELESS, 1, D3D11_BIND_RENDER_TARGET, 0, TRUE, FALSE},
+ {DXGI_FORMAT_R8G8_UNORM, 1, D3D11_BIND_RENDER_TARGET, 0, TRUE, FALSE},
+ {DXGI_FORMAT_R8G8_SNORM, 1, D3D11_BIND_RENDER_TARGET, 0, TRUE, FALSE},
+ {DXGI_FORMAT_R16_TYPELESS, 1, D3D11_BIND_SHADER_RESOURCE, 0, TRUE, FALSE},
+ {DXGI_FORMAT_R16_TYPELESS, 1, D3D11_BIND_DEPTH_STENCIL, 0, TRUE, FALSE},
+ {DXGI_FORMAT_R16_TYPELESS, 1, D3D11_BIND_RENDER_TARGET, 0, TRUE, FALSE},
+ {DXGI_FORMAT_R16_UINT, 1, D3D11_BIND_RENDER_TARGET, 0, TRUE, FALSE},
+ {DXGI_FORMAT_R16_SINT, 1, D3D11_BIND_RENDER_TARGET, 0, TRUE, FALSE},
+ {DXGI_FORMAT_R8_TYPELESS, 1, D3D11_BIND_SHADER_RESOURCE, 0, TRUE, FALSE},
+ {DXGI_FORMAT_R8G8B8A8_UNORM, 1, D3D11_BIND_RENDER_TARGET, 0, TRUE, FALSE},
+ {DXGI_FORMAT_R8G8B8A8_UNORM, 1, D3D11_BIND_DEPTH_STENCIL, 0, FALSE, FALSE},
+ {DXGI_FORMAT_R8G8B8A8_UINT, 1, D3D11_BIND_RENDER_TARGET, 0, TRUE, FALSE},
+ {DXGI_FORMAT_R8G8B8A8_SNORM, 1, D3D11_BIND_RENDER_TARGET, 0, TRUE, FALSE},
+ {DXGI_FORMAT_R8G8B8A8_SINT, 1, D3D11_BIND_RENDER_TARGET, 0, TRUE, FALSE},
+ {DXGI_FORMAT_D24_UNORM_S8_UINT, 1, D3D11_BIND_RENDER_TARGET, 0, FALSE, FALSE},
+ {DXGI_FORMAT_D32_FLOAT, 1, D3D11_BIND_RENDER_TARGET, 0, FALSE, FALSE},
+ };
+
+ if (!(device = create_device(NULL)))
+ {
+ skip("Failed to create device.\n");
+ return;
+ }
+
+ feature_level = ID3D11Device_GetFeatureLevel(device);
+
+ desc.Width = 512;
+ desc.MipLevels = 1;
+ desc.ArraySize = 1;
+ desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
+ desc.Usage = D3D11_USAGE_DEFAULT;
+ desc.BindFlags = D3D11_BIND_RENDER_TARGET;
+ desc.CPUAccessFlags = 0;
+ desc.MiscFlags = 0;
+
+ hr = ID3D11Device_CreateTexture1D(device, &desc, &data, &texture);
+ ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
+
+ expected_refcount = get_refcount((IUnknown *)device) + 1;
+ hr = ID3D11Device_CreateTexture1D(device, &desc, NULL, &texture);
+ ok(SUCCEEDED(hr), "Failed to create a 1d texture, hr %#x.\n", hr);
+ refcount = get_refcount((IUnknown *)device);
+ ok(refcount >= expected_refcount, "Got unexpected refcount %u, expected >= %u.\n", refcount, expected_refcount);
+ tmp = NULL;
+ expected_refcount = refcount + 1;
+ ID3D11Texture1D_GetDevice(texture, &tmp);
+ ok(tmp == device, "Got unexpected device %p, expected %p.\n", tmp, device);
+ refcount = get_refcount((IUnknown *)device);
+ ok(refcount == expected_refcount, "Got unexpected refcount %u, expected %u.\n", refcount, expected_refcount);
+ ID3D11Device_Release(tmp);
+
+ hr = ID3D11Texture1D_QueryInterface(texture, &IID_IDXGISurface, (void **)&surface);
+ ok(SUCCEEDED(hr), "Texture should implement IDXGISurface.\n");
+ IDXGISurface_Release(surface);
+ ID3D11Texture1D_Release(texture);
+
+ desc.MipLevels = 0;
+ expected_refcount = get_refcount((IUnknown *)device) + 1;
+ hr = ID3D11Device_CreateTexture1D(device, &desc, NULL, &texture);
+ ok(SUCCEEDED(hr), "Failed to create a 1d texture, hr %#x.\n", hr);
+ refcount = get_refcount((IUnknown *)device);
+ ok(refcount >= expected_refcount, "Got unexpected refcount %u, expected >= %u.\n", refcount, expected_refcount);
+ tmp = NULL;
+ expected_refcount = refcount + 1;
+ ID3D11Texture1D_GetDevice(texture, &tmp);
+ ok(tmp == device, "Got unexpected device %p, expected %p.\n", tmp, device);
+ refcount = get_refcount((IUnknown *)device);
+ ok(refcount == expected_refcount, "Got unexpected refcount %u, expected %u.\n", refcount, expected_refcount);
+ ID3D11Device_Release(tmp);
+
+ ID3D11Texture1D_GetDesc(texture, &desc);
+ ok(desc.Width == 512, "Got unexpected Width %u.\n", desc.Width);
+ ok(desc.MipLevels == 10, "Got unexpected MipLevels %u.\n", desc.MipLevels);
+ ok(desc.ArraySize == 1, "Got unexpected ArraySize %u.\n", desc.ArraySize);
+ ok(desc.Format == DXGI_FORMAT_R8G8B8A8_UNORM, "Got unexpected Format %#x.\n", desc.Format);
+ ok(desc.Usage == D3D11_USAGE_DEFAULT, "Got unexpected Usage %u.\n", desc.Usage);
+ ok(desc.BindFlags == D3D11_BIND_RENDER_TARGET, "Got unexpected BindFlags %#x.\n", desc.BindFlags);
+ ok(desc.CPUAccessFlags == 0, "Got unexpected CPUAccessFlags %#x.\n", desc.CPUAccessFlags);
+ ok(desc.MiscFlags == 0, "Got unexpected MiscFlags %#x.\n", desc.MiscFlags);
+
+ hr = ID3D11Texture1D_QueryInterface(texture, &IID_IDXGISurface, (void **)&surface);
+ ok(FAILED(hr), "Texture should not implement IDXGISurface.\n");
+ ID3D11Texture1D_Release(texture);
+
+ desc.MipLevels = 1;
+ desc.ArraySize = 2;
+ hr = ID3D11Device_CreateTexture1D(device, &desc, NULL, &texture);
+ ok(SUCCEEDED(hr), "Failed to create a 1d texture, hr %#x.\n", hr);
+
+ hr = ID3D11Texture1D_QueryInterface(texture, &IID_IDXGISurface, (void **)&surface);
+ ok(FAILED(hr), "Texture should not implement IDXGISurface.\n");
+ ID3D11Texture1D_Release(texture);
+
+ for (i = 0; i < sizeof(tests) / sizeof(*tests); ++i)
+ {
+ HRESULT expected_hr = tests[i].succeeds ? S_OK : E_INVALIDARG;
+ BOOL todo = tests[i].todo;
+
+ if (feature_level < D3D_FEATURE_LEVEL_10_1
+ && (tests[i].misc_flags & D3D11_RESOURCE_MISC_TEXTURECUBE)
+ && tests[i].array_size > 6)
+ {
+ expected_hr = E_INVALIDARG;
+ todo = TRUE;
+ }
+
+ desc.ArraySize = tests[i].array_size;
+ desc.Format = tests[i].format;
+ desc.BindFlags = tests[i].bind_flags;
+ desc.MiscFlags = tests[i].misc_flags;
+ hr = ID3D11Device_CreateTexture1D(device, &desc, NULL, (ID3D11Texture1D **)&texture);
+
+ todo_wine_if(todo)
+ ok(hr == expected_hr, "Test %u: Got unexpected hr %#x.\n", i, hr);
+
+ if (SUCCEEDED(hr))
+ ID3D11Texture1D_Release(texture);
+ }
+
+ refcount = ID3D11Device_Release(device);
+ ok(!refcount, "Device has %u references left.\n", refcount);
+}
+
static void test_create_texture2d(void)
{
ULONG refcount, expected_refcount;
@@ -12282,6 +12470,7 @@ START_TEST(d3d11)
test_create_device();
run_for_each_feature_level(test_device_interfaces);
test_get_immediate_context();
+ test_create_texture1d();
test_create_texture2d();
test_texture2d_interfaces();
test_create_texture3d();
--
2.9.0

View File

@ -1,189 +0,0 @@
From a5f4ae0710b650be91c1b4e0e565fa8e816f75b0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Thu, 25 Aug 2016 19:50:30 +0200
Subject: d3d11/tests: Test 1d texture interfaces.
---
dlls/d3d11/tests/d3d11.c | 159 +++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 159 insertions(+)
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c
index 02eeb88..861e3fc 100644
--- a/dlls/d3d11/tests/d3d11.c
+++ b/dlls/d3d11/tests/d3d11.c
@@ -1801,6 +1801,164 @@ static void test_create_texture1d(void)
ok(!refcount, "Device has %u references left.\n", refcount);
}
+static void test_texture1d_interfaces(void)
+{
+ ID3D10Texture1D *d3d10_texture;
+ D3D11_TEXTURE1D_DESC desc;
+ ID3D11Texture1D *texture;
+ IDXGISurface *surface;
+ ID3D11Device *device;
+ unsigned int i;
+ ULONG refcount;
+ HRESULT hr;
+
+ static const struct test
+ {
+ BOOL implements_d3d10_interfaces;
+ UINT bind_flags;
+ UINT misc_flags;
+ UINT expected_bind_flags;
+ UINT expected_misc_flags;
+ }
+ desc_conversion_tests[] =
+ {
+ {
+ TRUE,
+ D3D11_BIND_SHADER_RESOURCE, 0,
+ D3D10_BIND_SHADER_RESOURCE, 0
+ },
+ {
+ TRUE,
+ D3D11_BIND_UNORDERED_ACCESS, 0,
+ D3D11_BIND_UNORDERED_ACCESS, 0
+ },
+ {
+ FALSE,
+ 0, D3D11_RESOURCE_MISC_RESOURCE_CLAMP,
+ 0, 0
+ },
+ {
+ TRUE,
+ 0, D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX,
+ 0, D3D10_RESOURCE_MISC_SHARED_KEYEDMUTEX
+ },
+ /* Fails on WARP, needs to be verified using real hardware
+ {
+ TRUE,
+ 0, D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX | D3D11_RESOURCE_MISC_SHARED_NTHANDLE,
+ 0, D3D10_RESOURCE_MISC_SHARED_KEYEDMUTEX
+ },
+ */
+ };
+
+ if (!(device = create_device(NULL)))
+ {
+ skip("Failed to create ID3D11Device, skipping tests.\n");
+ return;
+ }
+
+ desc.Width = 512;
+ desc.MipLevels = 0;
+ desc.ArraySize = 1;
+ desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
+ desc.Usage = D3D11_USAGE_DEFAULT;
+ desc.BindFlags = D3D11_BIND_RENDER_TARGET;
+ desc.CPUAccessFlags = 0;
+ desc.MiscFlags = 0;
+
+ hr = ID3D11Device_CreateTexture1D(device, &desc, NULL, &texture);
+ ok(SUCCEEDED(hr), "Failed to create a 2d texture, hr %#x.\n", hr);
+
+ hr = ID3D11Texture1D_QueryInterface(texture, &IID_IDXGISurface, (void **)&surface);
+ ok(hr == E_NOINTERFACE, "Texture should not implement IDXGISurface.\n");
+
+ hr = ID3D11Texture1D_QueryInterface(texture, &IID_ID3D10Texture1D, (void **)&d3d10_texture);
+ ok(SUCCEEDED(hr) || broken(hr == E_NOINTERFACE) /* Not available on all Windows versions. */,
+ "Texture should implement ID3D10Texture1D.\n");
+ if (SUCCEEDED(hr)) ID3D10Texture1D_Release(d3d10_texture);
+ ID3D11Texture1D_Release(texture);
+
+ if (FAILED(hr))
+ {
+ win_skip("2D textures do not implement ID3D10Texture1D, skipping tests.\n");
+ ID3D11Device_Release(device);
+ return;
+ }
+
+ for (i = 0; i < sizeof(desc_conversion_tests) / sizeof(*desc_conversion_tests); ++i)
+ {
+ const struct test *current = &desc_conversion_tests[i];
+ D3D10_TEXTURE1D_DESC d3d10_desc;
+ ID3D10Device *d3d10_device;
+
+ desc.Width = 512;
+ desc.MipLevels = 1;
+ desc.ArraySize = 1;
+ desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
+ desc.Usage = D3D11_USAGE_DEFAULT;
+ desc.BindFlags = current->bind_flags;
+ desc.CPUAccessFlags = 0;
+ desc.MiscFlags = current->misc_flags;
+
+ hr = ID3D11Device_CreateTexture1D(device, &desc, NULL, &texture);
+ /* Shared resources are not supported by REF and WARP devices. */
+ ok(SUCCEEDED(hr) || broken(hr == E_OUTOFMEMORY),
+ "Test %u: Failed to create a 1d texture, hr %#x.\n", i, hr);
+ if (FAILED(hr))
+ {
+ win_skip("Failed to create ID3D11Texture1D, skipping test %u.\n", i);
+ continue;
+ }
+
+ hr = ID3D11Texture1D_QueryInterface(texture, &IID_IDXGISurface, (void **)&surface);
+ ok(SUCCEEDED(hr), "Test %u: Texture should implement IDXGISurface.\n", i);
+ IDXGISurface_Release(surface);
+
+ hr = ID3D11Texture1D_QueryInterface(texture, &IID_ID3D10Texture1D, (void **)&d3d10_texture);
+ ID3D11Texture1D_Release(texture);
+
+ if (current->implements_d3d10_interfaces)
+ {
+ ok(SUCCEEDED(hr), "Test %u: Texture should implement ID3D10Texture1D.\n", i);
+ }
+ else
+ {
+ todo_wine ok(hr == E_NOINTERFACE, "Test %u: Texture should not implement ID3D10Texture1D.\n", i);
+ if (SUCCEEDED(hr)) ID3D10Texture1D_Release(d3d10_texture);
+ continue;
+ }
+
+ ID3D10Texture1D_GetDesc(d3d10_texture, &d3d10_desc);
+
+ ok(d3d10_desc.Width == desc.Width,
+ "Test %u: Got unexpected Width %u.\n", i, d3d10_desc.Width);
+ ok(d3d10_desc.MipLevels == desc.MipLevels,
+ "Test %u: Got unexpected MipLevels %u.\n", i, d3d10_desc.MipLevels);
+ ok(d3d10_desc.ArraySize == desc.ArraySize,
+ "Test %u: Got unexpected ArraySize %u.\n", i, d3d10_desc.ArraySize);
+ ok(d3d10_desc.Format == desc.Format,
+ "Test %u: Got unexpected Format %u.\n", i, d3d10_desc.Format);
+ ok(d3d10_desc.Usage == (D3D10_USAGE)desc.Usage,
+ "Test %u: Got unexpected Usage %u.\n", i, d3d10_desc.Usage);
+ ok(d3d10_desc.BindFlags == current->expected_bind_flags,
+ "Test %u: Got unexpected BindFlags %#x.\n", i, d3d10_desc.BindFlags);
+ ok(d3d10_desc.CPUAccessFlags == desc.CPUAccessFlags,
+ "Test %u: Got unexpected CPUAccessFlags %#x.\n", i, d3d10_desc.CPUAccessFlags);
+ ok(d3d10_desc.MiscFlags == current->expected_misc_flags,
+ "Test %u: Got unexpected MiscFlags %#x.\n", i, d3d10_desc.MiscFlags);
+
+ d3d10_device = (ID3D10Device *)0xdeadbeef;
+ ID3D10Texture1D_GetDevice(d3d10_texture, &d3d10_device);
+ todo_wine ok(!d3d10_device, "Test %u: Got unexpected device pointer %p, expected NULL.\n", i, d3d10_device);
+ if (d3d10_device) ID3D10Device_Release(d3d10_device);
+
+ ID3D10Texture1D_Release(d3d10_texture);
+ }
+
+ refcount = ID3D11Device_Release(device);
+ ok(!refcount, "Device has %u references left.\n", refcount);
+}
+
static void test_create_texture2d(void)
{
ULONG refcount, expected_refcount;
@@ -10990,6 +11148,7 @@ START_TEST(d3d11)
run_for_each_feature_level(test_device_interfaces);
test_get_immediate_context();
test_create_texture1d();
+ test_texture1d_interfaces();
test_create_texture2d();
test_texture2d_interfaces();
test_create_texture3d();
--
2.9.0

View File

@ -1,93 +0,0 @@
From d4e5a58b69c7e8810c811041234134fe5062f931 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Thu, 25 Aug 2016 19:52:23 +0200
Subject: d3d11/tests: Test the creation of 1d render buffers in
test_create_rendertarget_view.
---
dlls/d3d11/tests/d3d11.c | 41 ++++++++++++++++++++++++++++++++++++++++-
1 file changed, 40 insertions(+), 1 deletion(-)
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c
index 9aa21584d8..063b30ebf1 100644
--- a/dlls/d3d11/tests/d3d11.c
+++ b/dlls/d3d11/tests/d3d11.c
@@ -3262,6 +3262,7 @@ static void test_create_rendertarget_view(void)
D3D11_RENDER_TARGET_VIEW_DESC rtv_desc;
D3D11_TEXTURE3D_DESC texture3d_desc;
D3D11_TEXTURE2D_DESC texture2d_desc;
+ D3D11_TEXTURE1D_DESC texture1d_desc;
D3D11_SUBRESOURCE_DATA data = {0};
ULONG refcount, expected_refcount;
D3D11_BUFFER_DESC buffer_desc;
@@ -3269,6 +3270,7 @@ static void test_create_rendertarget_view(void)
ID3D11Device *device, *tmp;
ID3D11Texture3D *texture3d;
ID3D11Texture2D *texture2d;
+ ID3D11Texture1D *texture1d;
ID3D11Resource *texture;
ID3D11Buffer *buffer;
unsigned int i;
@@ -3298,6 +3300,23 @@ static void test_create_rendertarget_view(void)
}
tests[] =
{
+ {{ 1, 1, RGBA8_UNORM}, {0}, {RGBA8_UNORM, TEX_1D, 0}},
+ {{10, 1, RGBA8_UNORM}, {0}, {RGBA8_UNORM, TEX_1D, 0}},
+ {{10, 1, RGBA8_UNORM}, {FMT_UNKNOWN, TEX_1D, 0}, {RGBA8_UNORM, TEX_1D, 0}},
+ {{10, 1, RGBA8_UNORM}, {FMT_UNKNOWN, TEX_1D, 1}, {RGBA8_UNORM, TEX_1D, 1}},
+ {{10, 1, RGBA8_UNORM}, {FMT_UNKNOWN, TEX_1D, 9}, {RGBA8_UNORM, TEX_1D, 9}},
+ {{ 1, 1, RGBA8_TL}, {RGBA8_UNORM, TEX_1D, 0}, {RGBA8_UNORM, TEX_1D, 0}},
+ {{10, 1, RGBA8_TL}, {RGBA8_UNORM, TEX_1D, 0}, {RGBA8_UNORM, TEX_1D, 0}},
+ {{ 1, 4, RGBA8_UNORM}, {0}, {RGBA8_UNORM, TEX_1D_ARRAY, 0, 0, 4}},
+ {{10, 4, RGBA8_UNORM}, {0}, {RGBA8_UNORM, TEX_1D_ARRAY, 0, 0, 4}},
+ {{10, 4, RGBA8_UNORM}, {FMT_UNKNOWN, TEX_1D_ARRAY, 0, 0, ~0u}, {RGBA8_UNORM, TEX_1D_ARRAY, 0, 0, 4}},
+ {{10, 4, RGBA8_UNORM}, {FMT_UNKNOWN, TEX_1D_ARRAY, 1, 0, ~0u}, {RGBA8_UNORM, TEX_1D_ARRAY, 1, 0, 4}},
+ {{10, 4, RGBA8_UNORM}, {FMT_UNKNOWN, TEX_1D_ARRAY, 3, 0, ~0u}, {RGBA8_UNORM, TEX_1D_ARRAY, 3, 0, 4}},
+ {{10, 4, RGBA8_UNORM}, {FMT_UNKNOWN, TEX_1D_ARRAY, 5, 0, ~0u}, {RGBA8_UNORM, TEX_1D_ARRAY, 5, 0, 4}},
+ {{10, 4, RGBA8_UNORM}, {FMT_UNKNOWN, TEX_1D_ARRAY, 9, 0, ~0u}, {RGBA8_UNORM, TEX_1D_ARRAY, 9, 0, 4}},
+ {{10, 4, RGBA8_UNORM}, {FMT_UNKNOWN, TEX_1D_ARRAY, 0, 1, ~0u}, {RGBA8_UNORM, TEX_1D_ARRAY, 0, 1, 3}},
+ {{10, 4, RGBA8_UNORM}, {FMT_UNKNOWN, TEX_1D_ARRAY, 0, 2, ~0u}, {RGBA8_UNORM, TEX_1D_ARRAY, 0, 2, 2}},
+ {{10, 4, RGBA8_UNORM}, {FMT_UNKNOWN, TEX_1D_ARRAY, 0, 3, ~0u}, {RGBA8_UNORM, TEX_1D_ARRAY, 0, 3, 1}},
{{ 1, 1, RGBA8_UNORM}, {0}, {RGBA8_UNORM, TEX_2D, 0}},
{{10, 1, RGBA8_UNORM}, {0}, {RGBA8_UNORM, TEX_2D, 0}},
{{10, 1, RGBA8_UNORM}, {FMT_UNKNOWN, TEX_2D, 0}, {RGBA8_UNORM, TEX_2D, 0}},
@@ -3460,6 +3479,12 @@ static void test_create_rendertarget_view(void)
ID3D11RenderTargetView_Release(rtview);
ID3D11Buffer_Release(buffer);
+ texture1d_desc.Width = 512;
+ texture1d_desc.Usage = D3D11_USAGE_DEFAULT;
+ texture1d_desc.BindFlags = D3D11_BIND_RENDER_TARGET;
+ texture1d_desc.CPUAccessFlags = 0;
+ texture1d_desc.MiscFlags = 0;
+
texture2d_desc.Width = 512;
texture2d_desc.Height = 512;
texture2d_desc.SampleDesc.Count = 1;
@@ -3480,7 +3505,21 @@ static void test_create_rendertarget_view(void)
{
D3D11_RENDER_TARGET_VIEW_DESC *current_desc;
- if (tests[i].expected_rtv_desc.dimension != D3D11_RTV_DIMENSION_TEXTURE3D)
+ if (tests[i].expected_rtv_desc.dimension == D3D11_RTV_DIMENSION_TEXTURE1D ||
+ tests[i].expected_rtv_desc.dimension == D3D11_RTV_DIMENSION_TEXTURE1DARRAY)
+ {
+ texture1d_desc.MipLevels = tests[i].texture.miplevel_count;
+ texture1d_desc.ArraySize = tests[i].texture.depth_or_array_size;
+ texture1d_desc.Format = tests[i].texture.format;
+
+ hr = ID3D11Device_CreateTexture1D(device, &texture1d_desc, NULL, &texture1d);
+ ok(SUCCEEDED(hr), "Test %u: Failed to create 2d texture, hr %#x.\n", i, hr);
+ texture = (ID3D11Resource *)texture1d;
+ }
+ else if (tests[i].expected_rtv_desc.dimension == D3D11_RTV_DIMENSION_TEXTURE2D ||
+ tests[i].expected_rtv_desc.dimension == D3D11_RTV_DIMENSION_TEXTURE2DARRAY ||
+ tests[i].expected_rtv_desc.dimension == D3D11_RTV_DIMENSION_TEXTURE2DMS ||
+ tests[i].expected_rtv_desc.dimension == D3D11_RTV_DIMENSION_TEXTURE2DMSARRAY)
{
texture2d_desc.MipLevels = tests[i].texture.miplevel_count;
texture2d_desc.ArraySize = tests[i].texture.depth_or_array_size;
--
2.12.2

View File

@ -1,93 +0,0 @@
From 2ba57281f31901b2f9ce05947e44b4a6e7035550 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Thu, 25 Aug 2016 19:54:13 +0200
Subject: d3d11/tests: Test the creation of 1d shader resource views in
test_create_shader_resource_view.
---
dlls/d3d11/tests/d3d11.c | 41 ++++++++++++++++++++++++++++++++++++++++-
1 file changed, 40 insertions(+), 1 deletion(-)
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c
index 063b30ebf1..81cced86c3 100644
--- a/dlls/d3d11/tests/d3d11.c
+++ b/dlls/d3d11/tests/d3d11.c
@@ -3609,6 +3609,7 @@ static void test_create_shader_resource_view(void)
D3D11_SHADER_RESOURCE_VIEW_DESC srv_desc;
D3D11_TEXTURE3D_DESC texture3d_desc;
D3D11_TEXTURE2D_DESC texture2d_desc;
+ D3D11_TEXTURE1D_DESC texture1d_desc;
ULONG refcount, expected_refcount;
ID3D11ShaderResourceView *srview;
D3D_FEATURE_LEVEL feature_level;
@@ -3616,6 +3617,7 @@ static void test_create_shader_resource_view(void)
ID3D11Device *device, *tmp;
ID3D11Texture3D *texture3d;
ID3D11Texture2D *texture2d;
+ ID3D11Texture1D *texture1d;
ID3D11Resource *texture;
ID3D11Buffer *buffer;
unsigned int i;
@@ -3647,6 +3649,21 @@ static void test_create_shader_resource_view(void)
}
tests[] =
{
+ {{10, 1, RGBA8_UNORM}, {0}, {RGBA8_UNORM, TEX_1D, 0, 10}},
+ {{10, 1, RGBA8_UNORM}, {FMT_UNKNOWN, TEX_1D, 0, ~0u}, {RGBA8_UNORM, TEX_1D, 0, 10}},
+ {{10, 1, RGBA8_UNORM}, {RGBA8_UNORM, TEX_1D, 0, ~0u}, {RGBA8_UNORM, TEX_1D, 0, 10}},
+ {{10, 1, RGBA8_UNORM}, {FMT_UNKNOWN, TEX_1D, 0, 10}, {RGBA8_UNORM, TEX_1D, 0, 10}},
+ {{ 1, 1, RGBA8_TL}, {RGBA8_UNORM, TEX_1D, 0, ~0u}, {RGBA8_UNORM, TEX_1D, 0, 1}},
+ {{10, 1, RGBA8_TL}, {RGBA8_UNORM, TEX_1D, 0, ~0u}, {RGBA8_UNORM, TEX_1D, 0, 10}},
+ {{10, 4, RGBA8_UNORM}, {0}, {RGBA8_UNORM, TEX_1D_ARRAY, 0, 10, 0, 4}},
+ {{10, 4, RGBA8_UNORM}, {FMT_UNKNOWN, TEX_1D_ARRAY, 0, ~0u, 0, ~0u}, {RGBA8_UNORM, TEX_1D_ARRAY, 0, 10, 0, 4}},
+ {{10, 4, RGBA8_UNORM}, {FMT_UNKNOWN, TEX_1D_ARRAY, 1, ~0u, 0, ~0u}, {RGBA8_UNORM, TEX_1D_ARRAY, 1, 9, 0, 4}},
+ {{10, 4, RGBA8_UNORM}, {FMT_UNKNOWN, TEX_1D_ARRAY, 3, ~0u, 0, ~0u}, {RGBA8_UNORM, TEX_1D_ARRAY, 3, 7, 0, 4}},
+ {{10, 4, RGBA8_UNORM}, {FMT_UNKNOWN, TEX_1D_ARRAY, 5, ~0u, 0, ~0u}, {RGBA8_UNORM, TEX_1D_ARRAY, 5, 5, 0, 4}},
+ {{10, 4, RGBA8_UNORM}, {FMT_UNKNOWN, TEX_1D_ARRAY, 9, ~0u, 0, ~0u}, {RGBA8_UNORM, TEX_1D_ARRAY, 9, 1, 0, 4}},
+ {{10, 4, RGBA8_UNORM}, {FMT_UNKNOWN, TEX_1D_ARRAY, 0, ~0u, 1, ~0u}, {RGBA8_UNORM, TEX_1D_ARRAY, 0, 10, 1, 3}},
+ {{10, 4, RGBA8_UNORM}, {FMT_UNKNOWN, TEX_1D_ARRAY, 0, ~0u, 2, ~0u}, {RGBA8_UNORM, TEX_1D_ARRAY, 0, 10, 2, 2}},
+ {{10, 4, RGBA8_UNORM}, {FMT_UNKNOWN, TEX_1D_ARRAY, 0, ~0u, 3, ~0u}, {RGBA8_UNORM, TEX_1D_ARRAY, 0, 10, 3, 1}},
{{10, 1, RGBA8_UNORM}, {0}, {RGBA8_UNORM, TEX_2D, 0, 10}},
{{10, 1, RGBA8_UNORM}, {FMT_UNKNOWN, TEX_2D, 0, ~0u}, {RGBA8_UNORM, TEX_2D, 0, 10}},
{{10, 1, RGBA8_UNORM}, {RGBA8_UNORM, TEX_2D, 0, ~0u}, {RGBA8_UNORM, TEX_2D, 0, 10}},
@@ -3847,6 +3864,12 @@ static void test_create_shader_resource_view(void)
skip("Structured buffers require feature level 11_0.\n");
}
+ texture1d_desc.Width = 512;
+ texture1d_desc.Usage = D3D11_USAGE_DEFAULT;
+ texture1d_desc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
+ texture1d_desc.CPUAccessFlags = 0;
+ texture1d_desc.MiscFlags = 0;
+
texture2d_desc.Width = 512;
texture2d_desc.Height = 512;
texture2d_desc.SampleDesc.Count = 1;
@@ -3866,7 +3889,23 @@ static void test_create_shader_resource_view(void)
{
D3D11_SHADER_RESOURCE_VIEW_DESC *current_desc;
- if (tests[i].expected_srv_desc.dimension != D3D11_SRV_DIMENSION_TEXTURE3D)
+ if (tests[i].expected_srv_desc.dimension == D3D11_SRV_DIMENSION_TEXTURE1D ||
+ tests[i].expected_srv_desc.dimension == D3D11_SRV_DIMENSION_TEXTURE1DARRAY)
+ {
+ texture1d_desc.MipLevels = tests[i].texture.miplevel_count;
+ texture1d_desc.ArraySize = tests[i].texture.depth_or_array_size;
+ texture1d_desc.Format = tests[i].texture.format;
+
+ hr = ID3D11Device_CreateTexture1D(device, &texture1d_desc, NULL, &texture1d);
+ ok(SUCCEEDED(hr), "Test %u: Failed to create 1d texture, hr %#x.\n", i, hr);
+ texture = (ID3D11Resource *)texture1d;
+ }
+ else if (tests[i].expected_srv_desc.dimension == D3D11_SRV_DIMENSION_TEXTURE2D ||
+ tests[i].expected_srv_desc.dimension == D3D11_SRV_DIMENSION_TEXTURE2DARRAY ||
+ tests[i].expected_srv_desc.dimension == D3D11_SRV_DIMENSION_TEXTURE2DMS ||
+ tests[i].expected_srv_desc.dimension == D3D11_SRV_DIMENSION_TEXTURE2DMSARRAY ||
+ tests[i].expected_srv_desc.dimension == D3D11_SRV_DIMENSION_TEXTURECUBE ||
+ tests[i].expected_srv_desc.dimension == D3D11_SRV_DIMENSION_TEXTURECUBEARRAY)
{
texture2d_desc.MipLevels = tests[i].texture.miplevel_count;
texture2d_desc.ArraySize = tests[i].texture.depth_or_array_size;
--
2.12.2

View File

@ -1,260 +0,0 @@
From 493acad9e14688b4acb817ac1daa59b2f21ef809 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Thu, 25 Aug 2016 20:06:28 +0200
Subject: d3d11/tests: Prepare test_texture for non 2d textures.
---
dlls/d3d11/tests/d3d11.c | 140 +++++++++++++++++++++++++++++------------------
1 file changed, 87 insertions(+), 53 deletions(-)
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c
index a9d03322283..daf5dbdbd55 100644
--- a/dlls/d3d11/tests/d3d11.c
+++ b/dlls/d3d11/tests/d3d11.c
@@ -6245,6 +6245,7 @@ static void test_texture(void)
};
struct texture
{
+ UINT dimension;
UINT width;
UINT height;
UINT miplevel_count;
@@ -6256,7 +6257,7 @@ static void test_texture(void)
D3D11_SHADER_RESOURCE_VIEW_DESC srv_desc;
struct d3d11_test_context test_context;
const struct texture *current_texture;
- D3D11_TEXTURE2D_DESC texture_desc;
+ D3D11_TEXTURE2D_DESC texture2d_desc;
D3D11_SAMPLER_DESC sampler_desc;
const struct shader *current_ps;
D3D_FEATURE_LEVEL feature_level;
@@ -6264,7 +6265,7 @@ static void test_texture(void)
ID3D11DeviceContext *context;
ID3D11SamplerState *sampler;
struct resource_readback rb;
- ID3D11Texture2D *texture;
+ ID3D11Resource *texture;
struct vec4 ps_constant;
ID3D11PixelShader *ps;
ID3D11Device *device;
@@ -6625,6 +6626,7 @@ static void test_texture(void)
};
static const struct texture rgba_texture =
{
+ D3D11_RESOURCE_DIMENSION_TEXTURE2D,
4, 4, 3, 1, DXGI_FORMAT_R8G8B8A8_UNORM,
{
{rgba_level_0, 4 * sizeof(*rgba_level_0), 0},
@@ -6632,33 +6634,51 @@ static void test_texture(void)
{rgba_level_2, sizeof(*rgba_level_2), 0},
}
};
- static const struct texture srgb_texture = {4, 4, 1, 1, DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
- {{srgb_data, 4 * sizeof(*srgb_data)}}};
- static const struct texture srgb_typeless = {4, 4, 1, 1, DXGI_FORMAT_R8G8B8A8_TYPELESS,
- {{srgb_data, 4 * sizeof(*srgb_data)}}};
- static const struct texture a8_texture = {4, 4, 1, 1, DXGI_FORMAT_A8_UNORM,
- {{a8_data, 4 * sizeof(*a8_data)}}};
- static const struct texture bc1_texture = {8, 8, 1, 1, DXGI_FORMAT_BC1_UNORM, {{bc1_data, 2 * 8}}};
- static const struct texture bc2_texture = {8, 8, 1, 1, DXGI_FORMAT_BC2_UNORM, {{bc2_data, 2 * 16}}};
- static const struct texture bc3_texture = {8, 8, 1, 1, DXGI_FORMAT_BC3_UNORM, {{bc3_data, 2 * 16}}};
- static const struct texture bc4_texture = {8, 8, 1, 1, DXGI_FORMAT_BC4_UNORM, {{bc4_data, 2 * 8}}};
- static const struct texture bc5_texture = {8, 8, 1, 1, DXGI_FORMAT_BC5_UNORM, {{bc5_data, 2 * 16}}};
- static const struct texture bc6h_u_texture = {8, 8, 1, 1, DXGI_FORMAT_BC6H_UF16, {{bc6h_u_data, 2 * 16}}};
- static const struct texture bc6h_s_texture = {8, 8, 1, 1, DXGI_FORMAT_BC6H_SF16, {{bc6h_s_data, 2 * 16}}};
- static const struct texture bc7_texture = {8, 8, 1, 1, DXGI_FORMAT_BC7_UNORM, {{bc7_data, 2 * 16}}};
- static const struct texture bc1_texture_srgb = {8, 8, 1, 1, DXGI_FORMAT_BC1_UNORM_SRGB, {{bc1_data, 2 * 8}}};
- static const struct texture bc2_texture_srgb = {8, 8, 1, 1, DXGI_FORMAT_BC2_UNORM_SRGB, {{bc2_data, 2 * 16}}};
- static const struct texture bc3_texture_srgb = {8, 8, 1, 1, DXGI_FORMAT_BC3_UNORM_SRGB, {{bc3_data, 2 * 16}}};
- static const struct texture bc7_texture_srgb = {8, 8, 1, 1, DXGI_FORMAT_BC7_UNORM_SRGB, {{bc7_data, 2 * 16}}};
- static const struct texture bc1_typeless = {8, 8, 1, 1, DXGI_FORMAT_BC1_TYPELESS, {{bc1_data, 2 * 8}}};
- static const struct texture bc2_typeless = {8, 8, 1, 1, DXGI_FORMAT_BC2_TYPELESS, {{bc2_data, 2 * 16}}};
- static const struct texture bc3_typeless = {8, 8, 1, 1, DXGI_FORMAT_BC3_TYPELESS, {{bc3_data, 2 * 16}}};
- static const struct texture sint8_texture = {4, 4, 1, 1, DXGI_FORMAT_R8G8B8A8_SINT,
+ static const struct texture srgb_texture = {D3D11_RESOURCE_DIMENSION_TEXTURE2D,
+ 4, 4, 1, 1, DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, {{srgb_data, 4 * sizeof(*srgb_data)}}};
+ static const struct texture srgb_typeless = {D3D11_RESOURCE_DIMENSION_TEXTURE2D,
+ 4, 4, 1, 1, DXGI_FORMAT_R8G8B8A8_TYPELESS, {{srgb_data, 4 * sizeof(*srgb_data)}}};
+ static const struct texture a8_texture = {D3D11_RESOURCE_DIMENSION_TEXTURE2D,
+ 4, 4, 1, 1, DXGI_FORMAT_A8_UNORM, {{a8_data, 4 * sizeof(*a8_data)}}};
+ static const struct texture bc1_texture = {D3D11_RESOURCE_DIMENSION_TEXTURE2D,
+ 8, 8, 1, 1, DXGI_FORMAT_BC1_UNORM, {{bc1_data, 2 * 8}}};
+ static const struct texture bc2_texture = {D3D11_RESOURCE_DIMENSION_TEXTURE2D,
+ 8, 8, 1, 1, DXGI_FORMAT_BC2_UNORM, {{bc2_data, 2 * 16}}};
+ static const struct texture bc3_texture = {D3D11_RESOURCE_DIMENSION_TEXTURE2D,
+ 8, 8, 1, 1, DXGI_FORMAT_BC3_UNORM, {{bc3_data, 2 * 16}}};
+ static const struct texture bc4_texture = {D3D11_RESOURCE_DIMENSION_TEXTURE2D,
+ 8, 8, 1, 1, DXGI_FORMAT_BC4_UNORM, {{bc4_data, 2 * 8}}};
+ static const struct texture bc5_texture = {D3D11_RESOURCE_DIMENSION_TEXTURE2D,
+ 8, 8, 1, 1, DXGI_FORMAT_BC5_UNORM, {{bc5_data, 2 * 16}}};
+ static const struct texture bc6h_u_texture = {D3D11_RESOURCE_DIMENSION_TEXTURE2D,
+ 8, 8, 1, 1, DXGI_FORMAT_BC6H_UF16, {{bc6h_u_data, 2 * 16}}};
+ static const struct texture bc6h_s_texture = {D3D11_RESOURCE_DIMENSION_TEXTURE2D,
+ 8, 8, 1, 1, DXGI_FORMAT_BC6H_SF16, {{bc6h_s_data, 2 * 16}}};
+ static const struct texture bc7_texture = {D3D11_RESOURCE_DIMENSION_TEXTURE2D,
+ 8, 8, 1, 1, DXGI_FORMAT_BC7_UNORM, {{bc7_data, 2 * 16}}};
+ static const struct texture bc1_texture_srgb = {D3D11_RESOURCE_DIMENSION_TEXTURE2D,
+ 8, 8, 1, 1, DXGI_FORMAT_BC1_UNORM_SRGB, {{bc1_data, 2 * 8}}};
+ static const struct texture bc2_texture_srgb = {D3D11_RESOURCE_DIMENSION_TEXTURE2D,
+ 8, 8, 1, 1, DXGI_FORMAT_BC2_UNORM_SRGB, {{bc2_data, 2 * 16}}};
+ static const struct texture bc3_texture_srgb = {D3D11_RESOURCE_DIMENSION_TEXTURE2D,
+ 8, 8, 1, 1, DXGI_FORMAT_BC3_UNORM_SRGB, {{bc3_data, 2 * 16}}};
+ static const struct texture bc7_texture_srgb = {D3D11_RESOURCE_DIMENSION_TEXTURE2D,
+ 8, 8, 1, 1, DXGI_FORMAT_BC7_UNORM_SRGB, {{bc7_data, 2 * 16}}};
+ static const struct texture bc1_typeless = {D3D11_RESOURCE_DIMENSION_TEXTURE2D,
+ 8, 8, 1, 1, DXGI_FORMAT_BC1_TYPELESS, {{bc1_data, 2 * 8}}};
+ static const struct texture bc2_typeless = {D3D11_RESOURCE_DIMENSION_TEXTURE2D,
+ 8, 8, 1, 1, DXGI_FORMAT_BC2_TYPELESS, {{bc2_data, 2 * 16}}};
+ static const struct texture bc3_typeless = {D3D11_RESOURCE_DIMENSION_TEXTURE2D,
+ 8, 8, 1, 1, DXGI_FORMAT_BC3_TYPELESS, {{bc3_data, 2 * 16}}};
+ static const struct texture sint8_texture = {D3D11_RESOURCE_DIMENSION_TEXTURE2D,
+ 4, 4, 1, 1, DXGI_FORMAT_R8G8B8A8_SINT,
{{rgba_level_0, 4 * sizeof(*rgba_level_0)}}};
- static const struct texture uint8_texture = {4, 4, 1, 1, DXGI_FORMAT_R8G8B8A8_UINT,
+ static const struct texture uint8_texture = {D3D11_RESOURCE_DIMENSION_TEXTURE2D,
+ 4, 4, 1, 1, DXGI_FORMAT_R8G8B8A8_UINT,
{{rgba_level_0, 4 * sizeof(*rgba_level_0)}}};
static const struct texture array_2d_texture =
{
+ D3D11_RESOURCE_DIMENSION_TEXTURE2D,
4, 4, 1, 3, DXGI_FORMAT_R8G8B8A8_UNORM,
{
{red_data, 6 * sizeof(*red_data)},
@@ -6666,11 +6686,14 @@ static void test_texture(void)
{blue_data, 5 * sizeof(*blue_data)},
}
};
- static const struct texture r32f_typeless = {4, 4, 1, 1, DXGI_FORMAT_R32_TYPELESS,
+ static const struct texture r32f_typeless = {D3D11_RESOURCE_DIMENSION_TEXTURE2D,
+ 4, 4, 1, 1, DXGI_FORMAT_R32_TYPELESS,
{{r32_float, 4 * sizeof(*r32_float)}}};
- static const struct texture r32u_typeless = {4, 4, 1, 1, DXGI_FORMAT_R32_TYPELESS,
+ static const struct texture r32u_typeless = {D3D11_RESOURCE_DIMENSION_TEXTURE2D,
+ 4, 4, 1, 1, DXGI_FORMAT_R32_TYPELESS,
{{r32_uint, 4 * sizeof(*r32_uint)}}};
- static const struct texture r9g9b9e5_texture = {4, 4, 1, 1, DXGI_FORMAT_R9G9B9E5_SHAREDEXP,
+ static const struct texture r9g9b9e5_texture = {D3D11_RESOURCE_DIMENSION_TEXTURE2D,
+ 4, 4, 1, 1, DXGI_FORMAT_R9G9B9E5_SHAREDEXP,
{{r9g9b9e5_data, 4 * sizeof(*r9g9b9e5_data)}}};
static const DWORD red_colors[] =
{
@@ -6968,12 +6991,12 @@ static void test_texture(void)
ID3D11DeviceContext_PSSetConstantBuffers(context, 0, 1, &cb);
- texture_desc.SampleDesc.Count = 1;
- texture_desc.SampleDesc.Quality = 0;
- texture_desc.Usage = D3D11_USAGE_DEFAULT;
- texture_desc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
- texture_desc.CPUAccessFlags = 0;
- texture_desc.MiscFlags = 0;
+ texture2d_desc.SampleDesc.Count = 1;
+ texture2d_desc.SampleDesc.Quality = 0;
+ texture2d_desc.Usage = D3D11_USAGE_DEFAULT;
+ texture2d_desc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
+ texture2d_desc.CPUAccessFlags = 0;
+ texture2d_desc.MiscFlags = 0;
sampler_desc.Filter = D3D11_FILTER_MIN_MAG_MIP_POINT;
sampler_desc.AddressU = D3D11_TEXTURE_ADDRESS_CLAMP;
@@ -7031,7 +7054,7 @@ static void test_texture(void)
if (current_texture != test->texture)
{
if (texture)
- ID3D11Texture2D_Release(texture);
+ ID3D11Resource_Release(texture);
if (srv)
ID3D11ShaderResourceView_Release(srv);
@@ -7039,16 +7062,23 @@ static void test_texture(void)
if (current_texture)
{
- texture_desc.Width = current_texture->width;
- texture_desc.Height = current_texture->height;
- texture_desc.MipLevels = current_texture->miplevel_count;
- texture_desc.ArraySize = current_texture->array_size;
- texture_desc.Format = current_texture->format;
+ if (current_texture->dimension == D3D11_RESOURCE_DIMENSION_TEXTURE2D)
+ {
+ ID3D11Texture2D *texture2d;
+
+ texture2d_desc.Width = current_texture->width;
+ texture2d_desc.Height = current_texture->height;
+ texture2d_desc.MipLevels = current_texture->miplevel_count;
+ texture2d_desc.ArraySize = current_texture->array_size;
+ texture2d_desc.Format = current_texture->format;
- hr = ID3D11Device_CreateTexture2D(device, &texture_desc, current_texture->data, &texture);
- ok(SUCCEEDED(hr), "Test %u: Failed to create 2d texture, hr %#x.\n", i, hr);
+ hr = ID3D11Device_CreateTexture2D(device, &texture2d_desc, current_texture->data, &texture2d);
+ ok(SUCCEEDED(hr), "Test %u: Failed to create 2d texture, hr %#x.\n", i, hr);
+ texture = (ID3D11Resource *)texture2d;
+ }
- hr = ID3D11Device_CreateShaderResourceView(device, (ID3D11Resource *)texture, NULL, &srv);
+
+ hr = ID3D11Device_CreateShaderResourceView(device, texture, NULL, &srv);
ok(SUCCEEDED(hr), "Test %u: Failed to create shader resource view, hr %#x.\n", i, hr);
}
else
@@ -7102,7 +7132,7 @@ static void test_texture(void)
ID3D11ShaderResourceView_Release(srv);
ID3D11SamplerState_Release(sampler);
if (texture)
- ID3D11Texture2D_Release(texture);
+ ID3D11Resource_Release(texture);
ID3D11PixelShader_Release(ps);
if (is_warp_device(device) && feature_level < D3D_FEATURE_LEVEL_11_0)
@@ -7147,26 +7177,30 @@ static void test_texture(void)
if (current_texture != test->texture)
{
+ ID3D11Texture2D *texture2d;
+
if (texture)
- ID3D11Texture2D_Release(texture);
+ ID3D11Resource_Release(texture);
current_texture = test->texture;
- texture_desc.Width = current_texture->width;
- texture_desc.Height = current_texture->height;
- texture_desc.MipLevels = current_texture->miplevel_count;
- texture_desc.ArraySize = current_texture->array_size;
- texture_desc.Format = current_texture->format;
+ texture2d_desc.Width = current_texture->width;
+ texture2d_desc.Height = current_texture->height;
+ texture2d_desc.MipLevels = current_texture->miplevel_count;
+ texture2d_desc.ArraySize = current_texture->array_size;
+ texture2d_desc.Format = current_texture->format;
- hr = ID3D11Device_CreateTexture2D(device, &texture_desc, current_texture->data, &texture);
+ hr = ID3D11Device_CreateTexture2D(device, &texture2d_desc, current_texture->data, &texture2d);
ok(SUCCEEDED(hr), "Test %u: Failed to create 2d texture, hr %#x.\n", i, hr);
+
+ texture = (ID3D11Resource *)texture2d;
}
if (srv)
ID3D11ShaderResourceView_Release(srv);
get_srv_desc(&srv_desc, &test->srv_desc);
- hr = ID3D11Device_CreateShaderResourceView(device, (ID3D11Resource *)texture, &srv_desc, &srv);
+ hr = ID3D11Device_CreateShaderResourceView(device, texture, &srv_desc, &srv);
ok(SUCCEEDED(hr), "Test %u: Failed to create shader resource view, hr %#x.\n", i, hr);
ID3D11DeviceContext_PSSetShaderResources(context, 0, 1, &srv);
@@ -7191,7 +7225,7 @@ static void test_texture(void)
release_resource_readback(&rb);
}
ID3D11PixelShader_Release(ps);
- ID3D11Texture2D_Release(texture);
+ ID3D11Resource_Release(texture);
ID3D11ShaderResourceView_Release(srv);
ID3D11SamplerState_Release(sampler);
--
2.14.1

Some files were not shown because too many files have changed in this diff Show More