Added patch for d3d11 1d textures.

This commit is contained in:
Michael Müller 2016-08-31 17:42:50 +02:00
parent 8ca9f08b92
commit 6b709dc505
42 changed files with 3858 additions and 203 deletions

View File

@ -0,0 +1,453 @@
From 9dc913d2ae5fca9a46acc67d896cf317389f7d97 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: 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 4af0faa..6bd7282 100644
--- a/dlls/d3d11/d3d11_private.h
+++ b/dlls/d3d11/d3d11_private.h
@@ -104,6 +104,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 9a42c8b..8c2aab6 100644
--- a/dlls/d3d11/device.c
+++ b/dlls/d3d11/device.c
@@ -2106,9 +2106,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,
@@ -4436,9 +4445,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 d7b2af1..d201b23 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 inline struct d3d_texture2d *impl_from_ID3D11Texture2D(ID3D11Texture2D *iface)
--
2.8.1

View File

@ -0,0 +1,135 @@
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.pool = WINED3D_POOL_DEFAULT;
+ 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

@ -0,0 +1,53 @@
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

@ -0,0 +1,83 @@
From ce85a9cdc238c5cbeda3d5f1c4d3841fac3be74e 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 4a18ca7..a9a5df1 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 0c269c1..e116994 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, wined3d_texture_get_resource(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.8.1

View File

@ -0,0 +1,40 @@
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

@ -0,0 +1,56 @@
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

@ -0,0 +1,39 @@
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

@ -0,0 +1,62 @@
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

@ -0,0 +1,40 @@
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

@ -0,0 +1,33 @@
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

@ -0,0 +1,44 @@
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

@ -0,0 +1,43 @@
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

@ -0,0 +1,49 @@
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

@ -0,0 +1,43 @@
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

@ -0,0 +1,219 @@
From 2e2b89474579f3c04ae57974fbf33dcf7ddc5e55 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 639c54f..ac32a05 100644
--- a/dlls/d3d11/tests/d3d11.c
+++ b/dlls/d3d11/tests/d3d11.c
@@ -1616,6 +1616,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, TRUE},
+ {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;
@@ -10584,6 +10772,7 @@ START_TEST(d3d11)
test_create_device();
test_device_interfaces();
test_get_immediate_context();
+ test_create_texture1d();
test_create_texture2d();
test_texture2d_interfaces();
test_create_texture3d();
--
2.8.1

View File

@ -0,0 +1,189 @@
From e33bc9f213f628d563433f4dd27ebba9816b6fca 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 ac32a05..c48ff9a 100644
--- a/dlls/d3d11/tests/d3d11.c
+++ b/dlls/d3d11/tests/d3d11.c
@@ -1804,6 +1804,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;
@@ -10773,6 +10931,7 @@ START_TEST(d3d11)
test_device_interfaces();
test_get_immediate_context();
test_create_texture1d();
+ test_texture1d_interfaces();
test_create_texture2d();
test_texture2d_interfaces();
test_create_texture3d();
--
2.8.1

View File

@ -0,0 +1,93 @@
From d36a6643bbb79dcea3bc39391dc4a129bd940f31 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 c48ff9a..ec5c296 100644
--- a/dlls/d3d11/tests/d3d11.c
+++ b/dlls/d3d11/tests/d3d11.c
@@ -3190,6 +3190,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;
@@ -3197,6 +3198,7 @@ static void test_create_rendertarget_view(void)
ID3D11Device *device, *tmp;
ID3D11Texture3D *texture3d;
ID3D11Texture2D *texture2d;
+ ID3D11Texture1D *texture1d;
ID3D11Resource *texture;
ID3D11Buffer *buffer;
IUnknown *iface;
@@ -3227,6 +3229,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}},
@@ -3388,6 +3407,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;
@@ -3408,7 +3433,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.8.1

View File

@ -0,0 +1,93 @@
From 0fb8cdfad5e55e814f6cb7c61935dc5e25cfd132 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 ec5c296..0dd286d 100644
--- a/dlls/d3d11/tests/d3d11.c
+++ b/dlls/d3d11/tests/d3d11.c
@@ -3536,6 +3536,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;
@@ -3543,6 +3544,7 @@ static void test_create_shader_resource_view(void)
ID3D11Device *device, *tmp;
ID3D11Texture3D *texture3d;
ID3D11Texture2D *texture2d;
+ ID3D11Texture1D *texture1d;
ID3D11Resource *texture;
ID3D11Buffer *buffer;
IUnknown *iface;
@@ -3575,6 +3577,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}},
@@ -3769,6 +3786,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;
@@ -3788,7 +3811,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.8.1

View File

@ -0,0 +1,242 @@
From 6a2fdc55c5d480b3bd0a26d3aaed1b31e4a7f8bb 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 | 131 +++++++++++++++++++++++++++++------------------
1 file changed, 81 insertions(+), 50 deletions(-)
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c
index 0dd286d..7768cdb 100644
--- a/dlls/d3d11/tests/d3d11.c
+++ b/dlls/d3d11/tests/d3d11.c
@@ -5671,6 +5671,7 @@ static void test_texture(void)
};
struct texture
{
+ UINT dimension;
UINT width;
UINT height;
UINT miplevel_count;
@@ -5682,7 +5683,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;
@@ -5690,7 +5691,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;
@@ -6030,6 +6031,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},
@@ -6037,33 +6039,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)},
@@ -6338,12 +6358,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;
@@ -6401,7 +6421,7 @@ static void test_texture(void)
if (current_texture != test->texture)
{
if (texture)
- ID3D11Texture2D_Release(texture);
+ ID3D11Resource_Release(texture);
if (srv)
ID3D11ShaderResourceView_Release(srv);
@@ -6409,16 +6429,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, &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_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_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
@@ -6472,7 +6499,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_10_1)
@@ -6517,26 +6544,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);
@@ -6561,7 +6592,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.8.1

View File

@ -0,0 +1,72 @@
From f37e1685852b44f4ecb3a6d20a1aa54adfeb2c6d 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:08:56 +0200
Subject: d3d11/tests: Prepare test_texture for 1d textures.
---
dlls/d3d11/tests/d3d11.c | 24 +++++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c
index 7768cdb..50dc3b9 100644
--- a/dlls/d3d11/tests/d3d11.c
+++ b/dlls/d3d11/tests/d3d11.c
@@ -5684,6 +5684,7 @@ static void test_texture(void)
struct d3d11_test_context test_context;
const struct texture *current_texture;
D3D11_TEXTURE2D_DESC texture2d_desc;
+ D3D11_TEXTURE1D_DESC texture1d_desc;
D3D11_SAMPLER_DESC sampler_desc;
const struct shader *current_ps;
D3D_FEATURE_LEVEL feature_level;
@@ -6365,6 +6366,11 @@ static void test_texture(void)
texture2d_desc.CPUAccessFlags = 0;
texture2d_desc.MiscFlags = 0;
+ texture1d_desc.Usage = D3D11_USAGE_DEFAULT;
+ texture1d_desc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
+ texture1d_desc.CPUAccessFlags = 0;
+ texture1d_desc.MiscFlags = 0;
+
sampler_desc.Filter = D3D11_FILTER_MIN_MAG_MIP_POINT;
sampler_desc.AddressU = D3D11_TEXTURE_ADDRESS_CLAMP;
sampler_desc.AddressV = D3D11_TEXTURE_ADDRESS_CLAMP;
@@ -6443,7 +6449,19 @@ static void test_texture(void)
ok(SUCCEEDED(hr), "Test %u: Failed to create 2d texture, hr %#x.\n", i, hr);
texture = (ID3D11Resource *)texture2d;
}
+ else if (current_texture->dimension == D3D11_RESOURCE_DIMENSION_TEXTURE1D)
+ {
+ ID3D11Texture1D *texture1d;
+ texture1d_desc.Width = current_texture->width;
+ texture1d_desc.MipLevels = current_texture->miplevel_count;
+ texture1d_desc.ArraySize = current_texture->array_size;
+ texture1d_desc.Format = current_texture->format;
+
+ hr = ID3D11Device_CreateTexture1D(device, &texture1d_desc, current_texture->data, &texture1d);
+ ok(SUCCEEDED(hr), "Test %u: Failed to create 2d texture, hr %#x.\n", i, hr);
+ texture = (ID3D11Resource *)texture1d;
+ }
hr = ID3D11Device_CreateShaderResourceView(device, texture, NULL, &srv);
ok(SUCCEEDED(hr), "Test %u: Failed to create shader resource view, hr %#x.\n", i, hr);
@@ -6486,10 +6504,14 @@ static void test_texture(void)
get_texture_readback(test_context.backbuffer, 0, &rb);
for (y = 0; y < 4; ++y)
{
+ int row = y;
+ if (test->texture && test->texture->dimension == D3D11_RESOURCE_DIMENSION_TEXTURE1D)
+ row = 0;
+
for (x = 0; x < 4; ++x)
{
color = get_readback_color(&rb, 80 + x * 160, 60 + y * 120);
- ok(compare_color(color, test->expected_colors[y * 4 + x], 2),
+ ok(compare_color(color, test->expected_colors[row * 4 + x], 2),
"Test %u: Got unexpected color 0x%08x at (%u, %u).\n", i, color, x, y);
}
}
--
2.8.1

View File

@ -0,0 +1,176 @@
From 90cf55bb0be99d5e1244e4c5ec2ff0b7aecb39ef 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:15:54 +0200
Subject: d3d11/tests: Add some basic 1d texture tests in test_texture.
---
dlls/d3d11/tests/d3d11.c | 109 +++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 109 insertions(+)
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c
index 50dc3b9..f5279ea 100644
--- a/dlls/d3d11/tests/d3d11.c
+++ b/dlls/d3d11/tests/d3d11.c
@@ -5732,6 +5732,37 @@ static void test_texture(void)
0x00000000, 0x00100e46, 0x00000000, 0x0700002d, 0x001020f2, 0x00000000, 0x00100e46, 0x00000000,
0x00107e46, 0x00000000, 0x0100003e,
};
+ static const DWORD ps_ld_1d_code[] =
+ {
+#if 0
+ Texture1D t;
+
+ float miplevel;
+
+ float4 main(float4 position : SV_POSITION) : SV_TARGET
+ {
+ float2 p;
+ t.GetDimensions(miplevel, p.x, p.y);
+ p.y = miplevel;
+ p *= float2(position.x / 640.0f, 1.0f);
+ return t.Load(int2(p));
+ }
+#endif
+ 0x43425844, 0x7b0c6359, 0x598178f6, 0xef2ddbdb, 0x88fc794c, 0x00000001, 0x000001ac, 0x00000003,
+ 0x0000002c, 0x00000060, 0x00000094, 0x4e475349, 0x0000002c, 0x00000001, 0x00000008, 0x00000020,
+ 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000010f, 0x505f5653, 0x5449534f, 0x004e4f49,
+ 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003,
+ 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054, 0x52444853, 0x00000110, 0x00000040,
+ 0x00000044, 0x04000059, 0x00208e46, 0x00000000, 0x00000001, 0x04001058, 0x00107000, 0x00000000,
+ 0x00005555, 0x04002064, 0x00101012, 0x00000000, 0x00000001, 0x03000065, 0x001020f2, 0x00000000,
+ 0x02000068, 0x00000001, 0x0600001c, 0x00100012, 0x00000000, 0x0020800a, 0x00000000, 0x00000000,
+ 0x0700003d, 0x001000f2, 0x00000000, 0x0010000a, 0x00000000, 0x00107e46, 0x00000000, 0x07000038,
+ 0x00100012, 0x00000000, 0x0010000a, 0x00000000, 0x0010100a, 0x00000000, 0x06000036, 0x001000e2,
+ 0x00000000, 0x00208006, 0x00000000, 0x00000000, 0x0a000038, 0x001000f2, 0x00000000, 0x00100e46,
+ 0x00000000, 0x00004002, 0x3acccccd, 0x3f800000, 0x3f800000, 0x3f800000, 0x0500001b, 0x001000f2,
+ 0x00000000, 0x00100e46, 0x00000000, 0x0700002d, 0x001020f2, 0x00000000, 0x00100e46, 0x00000000,
+ 0x00107e46, 0x00000000, 0x0100003e,
+ };
static const DWORD ps_ld_sint8_code[] =
{
#if 0
@@ -5916,13 +5947,46 @@ static void test_texture(void)
0x0020800a, 0x00000000, 0x00000000, 0x09000045, 0x001020f2, 0x00000000, 0x00100246, 0x00000000,
0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x0100003e,
};
+ static const DWORD ps_sample_1d_array_code[] =
+ {
+#if 0
+ Texture1DArray t;
+ SamplerState s;
+
+ float layer;
+
+ float4 main(float4 position : SV_POSITION) : SV_TARGET
+ {
+ float2 d;
+ float2 p = float2(position.x / 640.0f, 1.0f);
+ t.GetDimensions(d.x, d.y);
+ d.y = layer;
+ return t.Sample(s, p * d);
+ }
+#endif
+ 0x43425844, 0xea01b174, 0x353dc8ae, 0x8723fd43, 0x7c530e08, 0x00000001, 0x00000188, 0x00000003,
+ 0x0000002c, 0x00000060, 0x00000094, 0x4e475349, 0x0000002c, 0x00000001, 0x00000008, 0x00000020,
+ 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000010f, 0x505f5653, 0x5449534f, 0x004e4f49,
+ 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003,
+ 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054, 0x52444853, 0x000000ec, 0x00000040,
+ 0x0000003b, 0x04000059, 0x00208e46, 0x00000000, 0x00000001, 0x0300005a, 0x00106000, 0x00000000,
+ 0x04003858, 0x00107000, 0x00000000, 0x00005555, 0x04002064, 0x00101012, 0x00000000, 0x00000001,
+ 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000001, 0x0700003d, 0x001000f2, 0x00000000,
+ 0x00004001, 0x00000000, 0x00107e46, 0x00000000, 0x07000038, 0x00100022, 0x00000000, 0x0010100a,
+ 0x00000000, 0x00004001, 0x3acccccd, 0x07000038, 0x00100012, 0x00000000, 0x0010000a, 0x00000000,
+ 0x0010001a, 0x00000000, 0x06000036, 0x00100022, 0x00000000, 0x0020800a, 0x00000000, 0x00000000,
+ 0x09000045, 0x001020f2, 0x00000000, 0x00100046, 0x00000000, 0x00107e46, 0x00000000, 0x00106000,
+ 0x00000000, 0x0100003e,
+ };
static const struct shader ps_ld = {ps_ld_code, sizeof(ps_ld_code)};
+ static const struct shader ps_ld_1d = {ps_ld_1d_code, sizeof(ps_ld_1d_code)};
static const struct shader ps_ld_sint8 = {ps_ld_sint8_code, sizeof(ps_ld_sint8_code)};
static const struct shader ps_ld_uint8 = {ps_ld_uint8_code, sizeof(ps_ld_uint8_code)};
static const struct shader ps_sample = {ps_sample_code, sizeof(ps_sample_code)};
static const struct shader ps_sample_b = {ps_sample_b_code, sizeof(ps_sample_b_code)};
static const struct shader ps_sample_l = {ps_sample_l_code, sizeof(ps_sample_l_code)};
static const struct shader ps_sample_2d_array = {ps_sample_2d_array_code, sizeof(ps_sample_2d_array_code)};
+ static const struct shader ps_sample_1d_array = {ps_sample_1d_array_code, sizeof(ps_sample_1d_array_code)};
static const DWORD red_data[] =
{
0xff0000ff, 0xff0000ff, 0xff0000ff, 0xff0000ff, 0x00000000, 0x00000000,
@@ -6040,8 +6104,20 @@ static void test_texture(void)
{rgba_level_2, sizeof(*rgba_level_2), 0},
}
};
+ static const struct texture rgba_texture_1d =
+ {
+ D3D11_RESOURCE_DIMENSION_TEXTURE1D,
+ 4, 1, 3, 1, DXGI_FORMAT_R8G8B8A8_UNORM,
+ {
+ {rgba_level_0, 0, 0},
+ {rgba_level_1, 0, 0},
+ {rgba_level_2, 0, 0},
+ }
+ };
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_texture_1d = {D3D11_RESOURCE_DIMENSION_TEXTURE1D,
+ 4, 1, 1, 1, DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, {{srgb_data, 0}}};
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,
@@ -6092,6 +6168,16 @@ static void test_texture(void)
{blue_data, 5 * sizeof(*blue_data)},
}
};
+ static const struct texture array_1d_texture =
+ {
+ D3D11_RESOURCE_DIMENSION_TEXTURE1D,
+ 4, 1, 1, 3, DXGI_FORMAT_R8G8B8A8_UNORM,
+ {
+ {red_data, 0},
+ {green_data, 0},
+ {blue_data, 0},
+ }
+ };
static const DWORD red_colors[] =
{
0xff0000ff, 0xff0000ff, 0xff0000ff, 0xff0000ff,
@@ -6195,6 +6281,11 @@ static void test_texture(void)
#define POINT D3D11_FILTER_MIN_MAG_MIP_POINT
#define POINT_LINEAR D3D11_FILTER_MIN_MAG_POINT_MIP_LINEAR
#define MIP_MAX D3D11_FLOAT32_MAX
+ {&ps_ld_1d, &rgba_texture_1d, POINT, 0.0f, 0.0f, 0.0f, 0.0f, rgba_level_0},
+ {&ps_ld_1d, &rgba_texture_1d, POINT, 0.0f, 0.0f, 0.0f, 1.0f, level_1_colors},
+ {&ps_ld_1d, &rgba_texture_1d, POINT, 0.0f, 0.0f, 0.0f, 2.0f, level_2_colors},
+ {&ps_ld_1d, &rgba_texture_1d, POINT, 0.0f, 0.0f, 0.0f, 3.0f, zero_colors},
+ {&ps_ld_1d, &srgb_texture_1d, POINT, 0.0f, 0.0f, 0.0f, 0.0f, srgb_colors},
{&ps_ld, &rgba_texture, POINT, 0.0f, 0.0f, 0.0f, 0.0f, rgba_level_0},
{&ps_ld, &rgba_texture, POINT, 0.0f, 0.0f, 0.0f, 1.0f, level_1_colors},
{&ps_ld, &rgba_texture, POINT, 0.0f, 0.0f, 0.0f, 2.0f, level_2_colors},
@@ -6280,6 +6371,24 @@ static void test_texture(void)
{&ps_sample_l, NULL, POINT, 2.0f, 2.0f, 0.0f, 1.0f, zero_colors},
{&ps_sample_l, NULL, POINT, 2.0f, 2.0f, MIP_MAX, 0.0f, zero_colors},
{&ps_sample_l, NULL, POINT, 2.0f, 2.0f, MIP_MAX, 1.0f, zero_colors},
+ {&ps_sample_1d_array, &array_1d_texture, POINT, 0.0f, 0.0f, MIP_MAX, -9.0f, red_colors},
+ {&ps_sample_1d_array, &array_1d_texture, POINT, 0.0f, 0.0f, MIP_MAX, -1.0f, red_colors},
+ {&ps_sample_1d_array, &array_1d_texture, POINT, 0.0f, 0.0f, MIP_MAX, 0.0f, red_colors},
+ {&ps_sample_1d_array, &array_1d_texture, POINT, 0.0f, 0.0f, MIP_MAX, 0.4f, red_colors},
+ {&ps_sample_1d_array, &array_1d_texture, POINT, 0.0f, 0.0f, MIP_MAX, 0.5f, red_colors},
+ {&ps_sample_1d_array, &array_1d_texture, POINT, 0.0f, 0.0f, MIP_MAX, 1.0f, green_data},
+ {&ps_sample_1d_array, &array_1d_texture, POINT, 0.0f, 0.0f, MIP_MAX, 1.4f, green_data},
+ {&ps_sample_1d_array, &array_1d_texture, POINT, 0.0f, 0.0f, MIP_MAX, 2.0f, blue_colors},
+ {&ps_sample_1d_array, &array_1d_texture, POINT, 0.0f, 0.0f, MIP_MAX, 2.1f, blue_colors},
+ {&ps_sample_1d_array, &array_1d_texture, POINT, 0.0f, 0.0f, MIP_MAX, 3.0f, blue_colors},
+ {&ps_sample_1d_array, &array_1d_texture, POINT, 0.0f, 0.0f, MIP_MAX, 3.1f, blue_colors},
+ {&ps_sample_1d_array, &array_1d_texture, POINT, 0.0f, 0.0f, MIP_MAX, 9.0f, blue_colors},
+ {&ps_sample_1d_array, NULL, POINT, 0.0f, 0.0f, 0.0f, 0.0f, zero_colors},
+ {&ps_sample_1d_array, NULL, POINT, 0.0f, 0.0f, 0.0f, 1.0f, zero_colors},
+ {&ps_sample_1d_array, NULL, POINT, 0.0f, 0.0f, 0.0f, 2.0f, zero_colors},
+ {&ps_sample_1d_array, NULL, POINT, 0.0f, 0.0f, MIP_MAX, 0.0f, zero_colors},
+ {&ps_sample_1d_array, NULL, POINT, 0.0f, 0.0f, MIP_MAX, 1.0f, zero_colors},
+ {&ps_sample_1d_array, NULL, POINT, 0.0f, 0.0f, MIP_MAX, 2.0f, zero_colors},
{&ps_sample_2d_array, &array_2d_texture, POINT, 0.0f, 0.0f, MIP_MAX, -9.0f, red_colors},
{&ps_sample_2d_array, &array_2d_texture, POINT, 0.0f, 0.0f, MIP_MAX, -1.0f, red_colors},
{&ps_sample_2d_array, &array_2d_texture, POINT, 0.0f, 0.0f, MIP_MAX, 0.0f, red_colors},
--
2.8.1

View File

@ -0,0 +1,2 @@
Depends: wined3d-1DTextures
Fixes: [40976] Implement support for ID3D11Texture1D

View File

@ -105,6 +105,7 @@ patch_enable_all ()
enable_crypt32_CryptUnprotectMemory="$1"
enable_d2d1_Tests="$1"
enable_d3d10_1_Forwards="$1"
enable_d3d11_ID3D11Texture1D="$1"
enable_d3d9_DesktopWindow="$1"
enable_d3d9_Surface_Refcount="$1"
enable_d3d9_Tests="$1"
@ -361,6 +362,7 @@ patch_enable_all ()
enable_winecfg_Libraries="$1"
enable_winecfg_Staging="$1"
enable_winecfg_Unmounted_Devices="$1"
enable_wined3d_1DTextures="$1"
enable_wined3d_Accounting="$1"
enable_wined3d_CSMT_Helper="$1"
enable_wined3d_CSMT_Main="$1"
@ -491,6 +493,9 @@ patch_enable ()
d3d10_1-Forwards)
enable_d3d10_1_Forwards="$2"
;;
d3d11-ID3D11Texture1D)
enable_d3d11_ID3D11Texture1D="$2"
;;
d3d9-DesktopWindow)
enable_d3d9_DesktopWindow="$2"
;;
@ -1259,6 +1264,9 @@ patch_enable ()
winecfg-Unmounted_Devices)
enable_winecfg_Unmounted_Devices="$2"
;;
wined3d-1DTextures)
enable_wined3d_1DTextures="$2"
;;
wined3d-Accounting)
enable_wined3d_Accounting="$2"
;;
@ -1996,6 +2004,9 @@ if test "$enable_wined3d_CSMT_Helper" -eq 1; then
if test "$enable_ntdll_DllRedirects" -gt 1; then
abort "Patchset ntdll-DllRedirects disabled, but wined3d-CSMT_Helper depends on that."
fi
if test "$enable_wined3d_1DTextures" -gt 1; then
abort "Patchset wined3d-1DTextures disabled, but wined3d-CSMT_Helper depends on that."
fi
if test "$enable_wined3d_Accounting" -gt 1; then
abort "Patchset wined3d-Accounting disabled, but wined3d-CSMT_Helper depends on that."
fi
@ -2010,6 +2021,7 @@ if test "$enable_wined3d_CSMT_Helper" -eq 1; then
fi
enable_makedep_PARENTSPEC=1
enable_ntdll_DllRedirects=1
enable_wined3d_1DTextures=1
enable_wined3d_Accounting=1
enable_wined3d_DXTn=1
enable_wined3d_QUERY_Stubs=1
@ -2299,6 +2311,13 @@ if test "$enable_d3dx9_36_CloneEffect" -eq 1; then
enable_d3dx9_25_ID3DXEffect=1
fi
if test "$enable_d3d11_ID3D11Texture1D" -eq 1; then
if test "$enable_wined3d_1DTextures" -gt 1; then
abort "Patchset wined3d-1DTextures disabled, but d3d11-ID3D11Texture1D depends on that."
fi
enable_wined3d_1DTextures=1
fi
if test "$enable_api_ms_win_Stub_DLLs" -eq 1; then
if test "$enable_combase_RoApi" -gt 1; then
abort "Patchset combase-RoApi disabled, but api-ms-win-Stub_DLLs depends on that."
@ -2884,6 +2903,107 @@ if test "$enable_d3d10_1_Forwards" -eq 1; then
) >> "$patchlist"
fi
# Patchset wined3d-1DTextures
# |
# | Modified files:
# | * dlls/wined3d/context.c, dlls/wined3d/device.c, dlls/wined3d/glsl_shader.c, dlls/wined3d/resource.c,
# | dlls/wined3d/texture.c, dlls/wined3d/utils.c, dlls/wined3d/view.c, dlls/wined3d/wined3d_private.h,
# | include/wine/wined3d.h
# |
if test "$enable_wined3d_1DTextures" -eq 1; then
patch_apply wined3d-1DTextures/0001-wined3d-Create-dummy-1d-textures.patch
patch_apply wined3d-1DTextures/0002-wined3d-Add-1d-texture-resource-type.patch
patch_apply wined3d-1DTextures/0003-wined3d-Add-is_power_of_two-helper-function.patch
patch_apply wined3d-1DTextures/0004-wined3d-Create-dummy-1d-textures-and-surfaces.patch
patch_apply wined3d-1DTextures/0005-wined3d-Implement-preparation-for-1d-textures.patch
patch_apply wined3d-1DTextures/0006-wined3d-Implement-uploading-for-1d-textures.patch
patch_apply wined3d-1DTextures/0007-wined3d-Implement-loading-from-system-memory-and-buf.patch
patch_apply wined3d-1DTextures/0008-wined3d-Implement-downloading-from-s-rgb-1d-textures.patch
patch_apply wined3d-1DTextures/0009-wined3d-Implement-converting-between-s-rgb-1d-textur.patch
patch_apply wined3d-1DTextures/0010-wined3d-Check-for-1d-textures-in-wined3d_texture_upd.patch
patch_apply wined3d-1DTextures/0011-wined3d-Check-if-1d-teture-is-still-in-use-before-re.patch
patch_apply wined3d-1DTextures/0012-wined3d-Generate-glsl-samplers-for-1d-texture-arrays.patch
patch_apply wined3d-1DTextures/0013-wined3d-Add-support-for-1d-textures-in-context_attac.patch
patch_apply wined3d-1DTextures/0014-wined3d-Handle-1d-textures-in-texture_activate_dimen.patch
patch_apply wined3d-1DTextures/0015-wined3d-Allow-creation-of-1d-shader-views.patch
(
echo '+ { "Michael Müller", "wined3d: Create dummy 1d textures.", 1 },';
echo '+ { "Michael Müller", "wined3d: Add 1d texture resource type.", 1 },';
echo '+ { "Michael Müller", "wined3d: Add is_power_of_two helper function.", 1 },';
echo '+ { "Michael Müller", "wined3d: Create dummy 1d textures and surfaces.", 1 },';
echo '+ { "Michael Müller", "wined3d: Implement preparation for 1d textures.", 1 },';
echo '+ { "Michael Müller", "wined3d: Implement uploading for 1d textures.", 1 },';
echo '+ { "Michael Müller", "wined3d: Implement loading from system memory and buffers to (s)rgb 1d textures.", 1 },';
echo '+ { "Michael Müller", "wined3d: Implement downloading from (s)rgb 1d textures to system memory.", 1 },';
echo '+ { "Michael Müller", "wined3d: Implement converting between (s)rgb 1d textures.", 1 },';
echo '+ { "Michael Müller", "wined3d: Check for 1d textures in wined3d_texture_update_desc.", 1 },';
echo '+ { "Michael Müller", "wined3d: Check if 1d teture is still in use before releasing.", 1 },';
echo '+ { "Michael Müller", "wined3d: Generate glsl samplers for 1d texture arrays.", 1 },';
echo '+ { "Michael Müller", "wined3d: Add support for 1d textures in context_attach_gl_texture_fbo.", 1 },';
echo '+ { "Michael Müller", "wined3d: Handle 1d textures in texture_activate_dimensions.", 1 },';
echo '+ { "Michael Müller", "wined3d: Allow creation of 1d shader views.", 1 },';
) >> "$patchlist"
fi
# Patchset d3d11-ID3D11Texture1D
# |
# | This patchset has the following (direct or indirect) dependencies:
# | * wined3d-1DTextures
# |
# | This patchset fixes the following Wine bugs:
# | * [#40976] Implement support for ID3D11Texture1D
# |
# | Modified files:
# | * dlls/d3d11/d3d11_private.h, dlls/d3d11/device.c, dlls/d3d11/tests/d3d11.c, dlls/d3d11/texture.c, dlls/d3d11/utils.c,
# | dlls/d3d11/view.c
# |
if test "$enable_d3d11_ID3D11Texture1D" -eq 1; then
patch_apply d3d11-ID3D11Texture1D/0001-d3d11-Add-stub-ID3D11Texture2D-and-ID3D10Texture2D-i.patch
patch_apply d3d11-ID3D11Texture1D/0002-d3d11-Create-a-texture-in-d3d_texture1d_init.patch
patch_apply d3d11-ID3D11Texture1D/0003-d3d11-Create-a-private-store-in-d3d_texture1d_init.patch
patch_apply d3d11-ID3D11Texture1D/0004-d3d11-Generate-dxgi-surface-in-d3d_texture1d_init.patch
patch_apply d3d11-ID3D11Texture1D/0005-d3d11-Improve-d3d11_texture1d_GetDesc-by-obtaining-t.patch
patch_apply d3d11-ID3D11Texture1D/0006-d3d11-Implement-d3d10_texture1d_-Un-map.patch
patch_apply d3d11-ID3D11Texture1D/0007-d3d11-Implement-d3d10_texture1d_GetDesc.patch
patch_apply d3d11-ID3D11Texture1D/0008-d3d11-Implement-d3d11_texture1d_-G-S-etPrivateData.patch
patch_apply d3d11-ID3D11Texture1D/0009-d3d11-Add-d3d11_texture1d_SetPrivateDataInterface.patch
patch_apply d3d11-ID3D11Texture1D/0010-d3d11-Add-a-hack-to-prevent-creation-of-1d-cube-text.patch
patch_apply d3d11-ID3D11Texture1D/0011-d3d11-Add-support-for-1d-textures-in-normalize_srv_d.patch
patch_apply d3d11-ID3D11Texture1D/0012-d3d11-Add-support-for-1d-textures-in-normalize_rtv_d.patch
patch_apply d3d11-ID3D11Texture1D/0013-d3d11-tests-Add-support-for-1d-textures-in-check_srv.patch
patch_apply d3d11-ID3D11Texture1D/0014-d3d11-tests-Add-support-for-1d-textures-in-check_rtv.patch
patch_apply d3d11-ID3D11Texture1D/0015-d3d11-tests-Add-test-for-creating-1d-textures.patch
patch_apply d3d11-ID3D11Texture1D/0016-d3d11-tests-Test-1d-texture-interfaces.patch
patch_apply d3d11-ID3D11Texture1D/0017-d3d11-tests-Test-the-creation-of-1d-render-buffers-i.patch
patch_apply d3d11-ID3D11Texture1D/0018-d3d11-tests-Test-the-creation-of-1d-shader-resource-.patch
patch_apply d3d11-ID3D11Texture1D/0019-d3d11-tests-Prepare-test_texture-for-non-2d-textures.patch
patch_apply d3d11-ID3D11Texture1D/0020-d3d11-tests-Prepare-test_texture-for-1d-textures.patch
patch_apply d3d11-ID3D11Texture1D/0021-d3d11-tests-Add-some-basic-1d-texture-tests-in-test_.patch
(
echo '+ { "Michael Müller", "d3d11: Add stub ID3D11Texture2D and ID3D10Texture2D interfaces.", 1 },';
echo '+ { "Michael Müller", "d3d11: Create a texture in d3d_texture1d_init.", 1 },';
echo '+ { "Michael Müller", "d3d11: Create a private store in d3d_texture1d_init.", 1 },';
echo '+ { "Michael Müller", "d3d11: Generate dxgi surface in d3d_texture1d_init.", 1 },';
echo '+ { "Michael Müller", "d3d11: Improve d3d11_texture1d_GetDesc by obtaining the current width and format from wined3d.", 1 },';
echo '+ { "Michael Müller", "d3d11: Implement d3d10_texture1d_(Un)map.", 1 },';
echo '+ { "Michael Müller", "d3d11: Implement d3d10_texture1d_GetDesc.", 1 },';
echo '+ { "Michael Müller", "d3d11: Implement d3d11_texture1d_{G,S}etPrivateData.", 1 },';
echo '+ { "Michael Müller", "d3d11: Add d3d11_texture1d_SetPrivateDataInterface.", 1 },';
echo '+ { "Michael Müller", "d3d11: Add a hack to prevent creation of 1d cube textures.", 1 },';
echo '+ { "Michael Müller", "d3d11: Add support for 1d textures in normalize_srv_desc.", 1 },';
echo '+ { "Michael Müller", "d3d11: Add support for 1d textures in normalize_rtv_desc.", 1 },';
echo '+ { "Michael Müller", "d3d11/tests: Add support for 1d textures in check_srv_desc_.", 1 },';
echo '+ { "Michael Müller", "d3d11/tests: Add support for 1d textures in check_rtv_desc_.", 1 },';
echo '+ { "Michael Müller", "d3d11/tests: Add test for creating 1d textures.", 1 },';
echo '+ { "Michael Müller", "d3d11/tests: Test 1d texture interfaces.", 1 },';
echo '+ { "Michael Müller", "d3d11/tests: Test the creation of 1d render buffers in test_create_rendertarget_view.", 1 },';
echo '+ { "Michael Müller", "d3d11/tests: Test the creation of 1d shader resource views in test_create_shader_resource_view.", 1 },';
echo '+ { "Michael Müller", "d3d11/tests: Prepare test_texture for non 2d textures.", 1 },';
echo '+ { "Michael Müller", "d3d11/tests: Prepare test_texture for 1d textures.", 1 },';
echo '+ { "Michael Müller", "d3d11/tests: Add some basic 1d texture tests in test_texture.", 1 },';
) >> "$patchlist"
fi
# Patchset d3d9-DesktopWindow
# |
# | Modified files:
@ -7261,7 +7381,7 @@ fi
# |
# | This patchset has the following (direct or indirect) dependencies:
# | * makedep-PARENTSPEC, ntdll-Attach_Process_DLLs, ntdll-DllOverrides_WOW64, ntdll-Loader_Machine_Type, ntdll-DllRedirects,
# | wined3d-Accounting, wined3d-DXTn, wined3d-QUERY_Stubs, wined3d-Silence_FIXMEs
# | wined3d-1DTextures, wined3d-Accounting, wined3d-DXTn, wined3d-QUERY_Stubs, wined3d-Silence_FIXMEs
# |
# | Modified files:
# | * configure.ac, dlls/wined3d-csmt/Makefile.in, dlls/wined3d-csmt/version.rc
@ -7315,7 +7435,7 @@ fi
# |
# | This patchset has the following (direct or indirect) dependencies:
# | * makedep-PARENTSPEC, ntdll-Attach_Process_DLLs, ntdll-DllOverrides_WOW64, ntdll-Loader_Machine_Type, ntdll-DllRedirects,
# | wined3d-Accounting, wined3d-DXTn, wined3d-QUERY_Stubs, wined3d-Silence_FIXMEs, wined3d-CSMT_Helper
# | wined3d-1DTextures, wined3d-Accounting, wined3d-DXTn, wined3d-QUERY_Stubs, wined3d-Silence_FIXMEs, wined3d-CSMT_Helper
# |
# | This patchset fixes the following Wine bugs:
# | * [#11674] Support for CSMT (command stream) to increase graphic performance

View File

@ -0,0 +1,130 @@
From 880bec01dc7a6eac676233e4c3817371f6145f56 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Tue, 23 Aug 2016 22:54:14 +0200
Subject: wined3d: Create dummy 1d textures.
---
dlls/wined3d/context.c | 14 ++++++++++++++
dlls/wined3d/device.c | 28 ++++++++++++++++++++++++++++
dlls/wined3d/wined3d_private.h | 2 ++
3 files changed, 44 insertions(+)
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index f5311af..74c3a49 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -1521,6 +1521,9 @@ static void bind_dummy_textures(const struct wined3d_device *device, const struc
GL_EXTCALL(glActiveTexture(GL_TEXTURE0 + i));
checkGLcall("glActiveTexture");
+ gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_1D, device->dummy_texture_1d[i]);
+ checkGLcall("glBindTexture");
+
gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D, device->dummy_texture_2d[i]);
checkGLcall("glBindTexture");
@@ -1544,6 +1547,9 @@ static void bind_dummy_textures(const struct wined3d_device *device, const struc
if (gl_info->supported[EXT_TEXTURE_ARRAY])
{
+ gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_1D_ARRAY, device->dummy_texture_1d_array[i]);
+ checkGLcall("glBindTexture");
+
gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D_ARRAY, device->dummy_texture_2d_array[i]);
checkGLcall("glBindTexture");
}
@@ -2392,6 +2398,14 @@ void context_bind_texture(struct wined3d_context *context, GLenum target, GLuint
case GL_NONE:
/* nothing to do */
break;
+ case GL_TEXTURE_1D:
+ gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_1D, device->dummy_texture_1d[unit]);
+ checkGLcall("glBindTexture");
+ break;
+ case GL_TEXTURE_1D_ARRAY:
+ gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_1D_ARRAY, device->dummy_texture_1d_array[unit]);
+ checkGLcall("glBindTexture");
+ break;
case GL_TEXTURE_2D:
gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D, device->dummy_texture_2d[unit]);
checkGLcall("glBindTexture");
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index c2a8c55..1445399 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -702,6 +702,17 @@ static void create_dummy_textures(struct wined3d_device *device, struct wined3d_
/* Make appropriate texture active */
context_active_texture(context, gl_info, i);
+ gl_info->gl_ops.gl.p_glGenTextures(1, &device->dummy_texture_1d[i]);
+ checkGLcall("glGenTextures");
+ TRACE("Dummy 1D texture %u given name %u.\n", i, device->dummy_texture_1d[i]);
+
+ gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_1D, device->dummy_texture_1d[i]);
+ checkGLcall("glBindTexture");
+
+ gl_info->gl_ops.gl.p_glTexImage1D(GL_TEXTURE_1D, 0, GL_RGBA8, 1, 0,
+ GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, &color);
+ checkGLcall("glTexImage1D");
+
gl_info->gl_ops.gl.p_glGenTextures(1, &device->dummy_texture_2d[i]);
checkGLcall("glGenTextures");
TRACE("Dummy 2D texture %u given name %u.\n", i, device->dummy_texture_2d[i]);
@@ -760,6 +771,17 @@ static void create_dummy_textures(struct wined3d_device *device, struct wined3d_
if (gl_info->supported[EXT_TEXTURE_ARRAY])
{
+ gl_info->gl_ops.gl.p_glGenTextures(1, &device->dummy_texture_1d_array[i]);
+ checkGLcall("glGenTextures");
+ TRACE("Dummy 1D array texture %u given name %u.\n", i, device->dummy_texture_1d_array[i]);
+
+ gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_1D_ARRAY, device->dummy_texture_1d_array[i]);
+ checkGLcall("glBindTexture");
+
+ gl_info->gl_ops.gl.p_glTexImage2D(GL_TEXTURE_1D_ARRAY, 0, GL_RGBA8, 1, 1, 0,
+ GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, &color);
+ checkGLcall("glTexImage2D");
+
gl_info->gl_ops.gl.p_glGenTextures(1, &device->dummy_texture_2d_array[i]);
checkGLcall("glGenTextures");
TRACE("Dummy 2D array texture %u given name %u.\n", i, device->dummy_texture_2d_array[i]);
@@ -783,6 +805,9 @@ static void destroy_dummy_textures(struct wined3d_device *device, const struct w
{
gl_info->gl_ops.gl.p_glDeleteTextures(count, device->dummy_texture_2d_array);
checkGLcall("glDeleteTextures(count, device->dummy_texture_2d_array)");
+
+ gl_info->gl_ops.gl.p_glDeleteTextures(count, device->dummy_texture_1d_array);
+ checkGLcall("glDeleteTextures(count, device->dummy_texture_1d_array)");
}
if (gl_info->supported[ARB_TEXTURE_CUBE_MAP])
@@ -806,6 +831,9 @@ static void destroy_dummy_textures(struct wined3d_device *device, const struct w
gl_info->gl_ops.gl.p_glDeleteTextures(count, device->dummy_texture_2d);
checkGLcall("glDeleteTextures(count, device->dummy_texture_2d)");
+ gl_info->gl_ops.gl.p_glDeleteTextures(count, device->dummy_texture_1d);
+ checkGLcall("glDeleteTextures(count, device->dummy_texture_1d)");
+
memset(device->dummy_texture_2d_array, 0, count * sizeof(*device->dummy_texture_2d_array));
memset(device->dummy_texture_cube, 0, count * sizeof(*device->dummy_texture_cube));
memset(device->dummy_texture_3d, 0, count * sizeof(*device->dummy_texture_3d));
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index e329962..dbb0a47 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2481,10 +2481,12 @@ struct wined3d_device
struct wined3d_texture *logo_texture;
/* Textures for when no other textures are mapped */
+ GLuint dummy_texture_1d[MAX_COMBINED_SAMPLERS];
GLuint dummy_texture_2d[MAX_COMBINED_SAMPLERS];
GLuint dummy_texture_rect[MAX_COMBINED_SAMPLERS];
GLuint dummy_texture_3d[MAX_COMBINED_SAMPLERS];
GLuint dummy_texture_cube[MAX_COMBINED_SAMPLERS];
+ GLuint dummy_texture_1d_array[MAX_COMBINED_SAMPLERS];
GLuint dummy_texture_2d_array[MAX_COMBINED_SAMPLERS];
/* Default sampler used to emulate the direct resource access without using wined3d_sampler */
--
2.8.1

View File

@ -0,0 +1,41 @@
From 487882af653cb228767391dd106d74f75f39f621 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Tue, 23 Aug 2016 22:47:56 +0200
Subject: wined3d: Add 1d texture resource type.
---
dlls/wined3d/utils.c | 1 +
include/wine/wined3d.h | 5 +++--
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c
index ee3af83..4e00aad 100644
--- a/dlls/wined3d/utils.c
+++ b/dlls/wined3d/utils.c
@@ -3926,6 +3926,7 @@ const char *debug_d3dresourcetype(enum wined3d_resource_type resource_type)
{
#define WINED3D_TO_STR(x) case x: return #x
WINED3D_TO_STR(WINED3D_RTYPE_BUFFER);
+ WINED3D_TO_STR(WINED3D_RTYPE_TEXTURE_1D);
WINED3D_TO_STR(WINED3D_RTYPE_TEXTURE_2D);
WINED3D_TO_STR(WINED3D_RTYPE_TEXTURE_3D);
#undef WINED3D_TO_STR
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index 81dffea..1cf927a 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -667,8 +667,9 @@ enum wined3d_texture_filter_type
enum wined3d_resource_type
{
WINED3D_RTYPE_BUFFER = 1,
- WINED3D_RTYPE_TEXTURE_2D = 2,
- WINED3D_RTYPE_TEXTURE_3D = 3,
+ WINED3D_RTYPE_TEXTURE_1D = 2,
+ WINED3D_RTYPE_TEXTURE_2D = 3,
+ WINED3D_RTYPE_TEXTURE_3D = 4,
};
enum wined3d_pool
--
2.8.1

View File

@ -0,0 +1,57 @@
From ff312baa8a0e884b148cba79f8a56f33312108dc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sat, 27 Aug 2016 22:19:25 +0200
Subject: wined3d: Add is_power_of_two helper function.
---
dlls/wined3d/texture.c | 20 +++++++-------------
1 file changed, 7 insertions(+), 13 deletions(-)
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index d2b1be5..7ab894b 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -101,6 +101,11 @@ static DWORD wined3d_resource_access_from_location(DWORD location)
}
}
+static BOOL is_power_of_two(UINT x)
+{
+ return (x != 0) && !(x & (x - 1));
+}
+
static void wined3d_texture_evict_sysmem(struct wined3d_texture *texture)
{
struct wined3d_texture_sub_resource *sub_resource;
@@ -1156,7 +1161,7 @@ HRESULT CDECL wined3d_texture_update_desc(struct wined3d_texture *texture, UINT
sub_resource->size = texture->slice_pitch;
sub_resource->locations = WINED3D_LOCATION_DISCARDED;
- if (((width & (width - 1)) || (height & (height - 1))) && !gl_info->supported[ARB_TEXTURE_NON_POWER_OF_TWO]
+ if ((!is_power_of_two(width) || !is_power_of_two(height)) && !gl_info->supported[ARB_TEXTURE_NON_POWER_OF_TWO]
&& !gl_info->supported[ARB_TEXTURE_RECTANGLE] && !gl_info->supported[WINED3D_GL_NORMALIZED_TEXRECT])
{
texture->flags |= WINED3D_TEXTURE_COND_NP2_EMULATED;
@@ -2460,18 +2465,7 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct
if (!gl_info->supported[ARB_TEXTURE_NON_POWER_OF_TWO])
{
- UINT pow2_w, pow2_h, pow2_d;
- pow2_w = 1;
- while (pow2_w < desc->width)
- pow2_w <<= 1;
- pow2_h = 1;
- while (pow2_h < desc->height)
- pow2_h <<= 1;
- pow2_d = 1;
- while (pow2_d < desc->depth)
- pow2_d <<= 1;
-
- if (pow2_w != desc->width || pow2_h != desc->height || pow2_d != desc->depth)
+ if (!is_power_of_two(desc->width) || !is_power_of_two(desc->height) || !is_power_of_two(desc->depth))
{
if (desc->pool == WINED3D_POOL_SCRATCH)
{
--
2.8.1

View File

@ -0,0 +1,224 @@
From ff813bcf8c68aab5828a012d5242a72b8cdb6bc3 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:24:47 +0200
Subject: wined3d: Create dummy 1d textures and surfaces.
---
dlls/wined3d/resource.c | 1 +
dlls/wined3d/texture.c | 174 ++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 175 insertions(+)
diff --git a/dlls/wined3d/resource.c b/dlls/wined3d/resource.c
index 70474c6..4c6cc59 100644
--- a/dlls/wined3d/resource.c
+++ b/dlls/wined3d/resource.c
@@ -94,6 +94,7 @@ HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device *
resource_types[] =
{
{WINED3D_RTYPE_BUFFER, 0, WINED3D_GL_RES_TYPE_BUFFER},
+ {WINED3D_RTYPE_TEXTURE_1D, 0, WINED3D_GL_RES_TYPE_TEX_1D},
{WINED3D_RTYPE_TEXTURE_2D, 0, WINED3D_GL_RES_TYPE_TEX_2D},
{WINED3D_RTYPE_TEXTURE_2D, 0, WINED3D_GL_RES_TYPE_TEX_RECT},
{WINED3D_RTYPE_TEXTURE_2D, 0, WINED3D_GL_RES_TYPE_RB},
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index 7ab894b..e4ca54b 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -1439,6 +1439,45 @@ void wined3d_texture_upload_data(struct wined3d_texture *texture, unsigned int s
context, data, row_pitch, slice_pitch);
}
+
+/* This call just uploads data, the caller is responsible for binding the
+ * correct texture. */
+/* Context activation is done by the caller. */
+static void texture1d_upload_data(struct wined3d_texture *texture, unsigned int sub_resource_idx,
+ const struct wined3d_context *context, const struct wined3d_const_bo_address *data,
+ unsigned int row_pitch, unsigned int slice_pitch)
+{
+ FIXME("texture %p, sub_resource_idx %u, context %p, data {%#x:%p}, row_pitch %#x, slice_pitch %#x: stub.\n",
+ texture, sub_resource_idx, context, data->buffer_object, data->addr, row_pitch, slice_pitch);
+}
+
+/* Context activation is done by the caller. */
+static BOOL texture1d_load_location(struct wined3d_texture *texture, unsigned int sub_resource_idx,
+ struct wined3d_context *context, DWORD location)
+{
+ FIXME("texture %p, sub_resource_idx %u, context %p, location %s: stub.\n",
+ texture, sub_resource_idx, context, wined3d_debug_location(location));
+
+ return FALSE;
+}
+
+static void texture1d_prepare_texture(struct wined3d_texture *texture, struct wined3d_context *context, BOOL srgb)
+{
+ FIXME("stub.\n");
+}
+
+static void texture1d_cleanup_sub_resources(struct wined3d_texture *texture)
+{
+}
+
+static const struct wined3d_texture_ops texture1d_ops =
+{
+ texture1d_upload_data,
+ texture1d_load_location,
+ texture1d_prepare_texture,
+ texture1d_cleanup_sub_resources,
+};
+
static void texture2d_upload_data(struct wined3d_texture *texture, unsigned int sub_resource_idx,
const struct wined3d_context *context, const struct wined3d_const_bo_address *data,
unsigned int row_pitch, unsigned int slice_pitch)
@@ -1862,6 +1901,137 @@ static const struct wined3d_resource_ops texture_resource_ops =
texture_resource_sub_resource_unmap,
};
+static HRESULT texture1d_init(struct wined3d_texture *texture, const struct wined3d_resource_desc *desc,
+ UINT layer_count, UINT level_count, struct wined3d_device *device, void *parent,
+ const struct wined3d_parent_ops *parent_ops)
+{
+ struct wined3d_device_parent *device_parent = device->device_parent;
+ const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
+ struct wined3d_surface *surfaces;
+ unsigned int i, j;
+ HRESULT hr;
+
+ if (layer_count > 1 && !gl_info->supported[EXT_TEXTURE_ARRAY])
+ {
+ WARN("OpenGL implementation does not support array textures.\n");
+ return WINED3DERR_INVALIDCALL;
+ }
+
+ /* TODO: It should only be possible to create textures for formats
+ * that are reported as supported. */
+ if (WINED3DFMT_UNKNOWN >= desc->format)
+ {
+ WARN("(%p) : Texture cannot be created with a format of WINED3DFMT_UNKNOWN.\n", texture);
+ return WINED3DERR_INVALIDCALL;
+ }
+
+ if (desc->usage & WINED3DUSAGE_LEGACY_CUBEMAP)
+ {
+ WARN("1d textures can not be used for cube mapping, returning D3DERR_INVALIDCALL.\n");
+ return WINED3DERR_INVALIDCALL;
+ }
+
+ if (desc->usage & WINED3DUSAGE_DYNAMIC && (desc->pool == WINED3D_POOL_MANAGED
+ || desc->pool == WINED3D_POOL_SCRATCH))
+ {
+ WARN("Attempted to create a DYNAMIC texture in pool %s.\n", debug_d3dpool(desc->pool));
+ return WINED3DERR_INVALIDCALL;
+ }
+
+ if (!gl_info->supported[ARB_TEXTURE_NON_POWER_OF_TWO] && !is_power_of_two(desc->width))
+ {
+ if (desc->pool == WINED3D_POOL_SCRATCH)
+ {
+ WARN("Creating a scratch NPOT 1d texture despite lack of HW support.\n");
+ }
+ else
+ {
+ WARN("Attempted to create a NPOT 1d texture (%u, %u, %u) without GL support.\n",
+ desc->width, desc->height, desc->depth);
+ return WINED3DERR_INVALIDCALL;
+ }
+ }
+
+ if (desc->usage & WINED3DUSAGE_AUTOGENMIPMAP)
+ {
+ if (!gl_info->supported[SGIS_GENERATE_MIPMAP])
+ {
+ WARN("No mipmap generation support, returning WINED3DERR_INVALIDCALL.\n");
+ return WINED3DERR_INVALIDCALL;
+ }
+
+ if (level_count != 1)
+ {
+ WARN("WINED3DUSAGE_AUTOGENMIPMAP is set, and level count != 1, returning WINED3DERR_INVALIDCALL.\n");
+ return WINED3DERR_INVALIDCALL;
+ }
+ }
+
+ if (FAILED(hr = wined3d_texture_init(texture, &texture1d_ops, layer_count, level_count, desc,
+ 0, device, parent, parent_ops, &texture_resource_ops)))
+ {
+ WARN("Failed to initialize texture, returning %#x.\n", hr);
+ return hr;
+ }
+
+ texture->pow2_matrix[0] = 1.0f;
+ texture->pow2_matrix[5] = 1.0f;
+ texture->pow2_matrix[10] = 1.0f;
+ texture->pow2_matrix[15] = 1.0f;
+ texture->target = (layer_count > 1) ? GL_TEXTURE_1D_ARRAY : GL_TEXTURE_1D;
+
+ if (wined3d_texture_use_pbo(texture, gl_info))
+ {
+ wined3d_resource_free_sysmem(&texture->resource);
+ texture->resource.map_binding = WINED3D_LOCATION_BUFFER;
+ }
+
+ if (level_count > ~(SIZE_T)0 / layer_count
+ || !(surfaces = wined3d_calloc(level_count * layer_count, sizeof(*surfaces))))
+ {
+ wined3d_texture_cleanup_sync(texture);
+ return E_OUTOFMEMORY;
+ }
+
+ /* Generate all the surfaces. */
+ for (i = 0; i < texture->level_count; ++i)
+ {
+ for (j = 0; j < texture->layer_count; ++j)
+ {
+ struct wined3d_texture_sub_resource *sub_resource;
+ unsigned int idx = j * texture->level_count + i;
+ struct wined3d_surface *surface;
+
+ surface = &surfaces[idx];
+ surface->container = texture;
+ surface->texture_target = texture->target;
+ surface->texture_level = i;
+ surface->texture_layer = j;
+ list_init(&surface->renderbuffers);
+ list_init(&surface->overlays);
+
+ sub_resource = &texture->sub_resources[idx];
+ sub_resource->locations = WINED3D_LOCATION_DISCARDED;
+ sub_resource->u.surface = surface;
+
+ if (FAILED(hr = device_parent->ops->surface_created(device_parent,
+ texture, idx, &sub_resource->parent, &sub_resource->parent_ops)))
+ {
+ WARN("Failed to create texture1d parent, hr %#x.\n", hr);
+ sub_resource->parent = NULL;
+ wined3d_texture_cleanup_sync(texture);
+ return hr;
+ }
+
+ TRACE("parent %p, parent_ops %p.\n", parent, parent_ops);
+
+ TRACE("Created 1d texture surface level %u, layer %u @ %p.\n", i, j, surface);
+ }
+ }
+
+ return WINED3D_OK;
+}
+
static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3d_resource_desc *desc,
unsigned int layer_count, unsigned int level_count, DWORD flags, struct wined3d_device *device,
void *parent, const struct wined3d_parent_ops *parent_ops)
@@ -2789,6 +2959,10 @@ HRESULT CDECL wined3d_texture_create(struct wined3d_device *device, const struct
switch (desc->resource_type)
{
+ case WINED3D_RTYPE_TEXTURE_1D:
+ hr = texture1d_init(object, desc, layer_count, level_count, device, parent, parent_ops);
+ break;
+
case WINED3D_RTYPE_TEXTURE_2D:
hr = texture_init(object, desc, layer_count, level_count, flags, device, parent, parent_ops);
break;
--
2.8.1

View File

@ -0,0 +1,78 @@
From 5011cd6f4e78bb9d00c5264e3b5033e36fe6b986 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sat, 27 Aug 2016 22:22:26 +0200
Subject: wined3d: Implement preparation for 1d textures.
---
dlls/wined3d/texture.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 54 insertions(+), 1 deletion(-)
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index e4ca54b..942337b 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -1463,7 +1463,60 @@ static BOOL texture1d_load_location(struct wined3d_texture *texture, unsigned in
static void texture1d_prepare_texture(struct wined3d_texture *texture, struct wined3d_context *context, BOOL srgb)
{
- FIXME("stub.\n");
+ const struct wined3d_format *format = texture->resource.format;
+ unsigned int sub_count = texture->level_count * texture->layer_count;
+ const struct wined3d_gl_info *gl_info = context->gl_info;
+ unsigned int width;
+ GLenum internal;
+
+ wined3d_texture_bind_and_dirtify(texture, context, srgb);
+
+ if (srgb)
+ internal = format->glGammaInternal;
+ else if (texture->resource.usage & WINED3DUSAGE_RENDERTARGET
+ && wined3d_resource_is_offscreen(&texture->resource))
+ internal = format->rtInternal;
+ else
+ internal = format->glInternal;
+
+ if (wined3d_texture_use_immutable_storage(texture, gl_info))
+ {
+ width = wined3d_texture_get_level_width(texture, 0);
+
+ if (texture->target == GL_TEXTURE_1D_ARRAY)
+ {
+ GL_EXTCALL(glTexStorage2D(texture->target, texture->level_count, internal, width, texture->layer_count));
+ checkGLcall("glTexStorage2D");
+ }
+ else
+ {
+ GL_EXTCALL(glTexStorage1D(texture->target, texture->level_count, internal, width));
+ checkGLcall("glTexStorage1D");
+ }
+ }
+ else
+ {
+ unsigned int i;
+
+ for (i = 0; i < sub_count; ++i)
+ {
+ struct wined3d_surface *surface = texture->sub_resources[i].u.surface;
+ width = wined3d_texture_get_level_width(texture, surface->texture_level);
+
+ if (texture->target == GL_TEXTURE_1D_ARRAY)
+ {
+ gl_info->gl_ops.gl.p_glTexImage2D(surface->texture_target, surface->texture_level,
+ internal, width, texture->layer_count, 0, format->glFormat, format->glType, NULL);
+ checkGLcall("glTexImage2D");
+ }
+ else
+ {
+ gl_info->gl_ops.gl.p_glTexImage1D(surface->texture_target, surface->texture_level,
+ internal, width, 0, format->glFormat, format->glType, NULL);
+ checkGLcall("glTexImage1D");
+ }
+ }
+ }
}
static void texture1d_cleanup_sub_resources(struct wined3d_texture *texture)
--
2.8.1

View File

@ -0,0 +1,81 @@
From c80bcc9a789842075b2f68178a00525ac0cabcf7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sat, 27 Aug 2016 22:25:20 +0200
Subject: wined3d: Implement uploading for 1d textures.
---
dlls/wined3d/texture.c | 57 +++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 56 insertions(+), 1 deletion(-)
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index 942337b..442ec27 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -1447,8 +1447,63 @@ static void texture1d_upload_data(struct wined3d_texture *texture, unsigned int
const struct wined3d_context *context, const struct wined3d_const_bo_address *data,
unsigned int row_pitch, unsigned int slice_pitch)
{
- FIXME("texture %p, sub_resource_idx %u, context %p, data {%#x:%p}, row_pitch %#x, slice_pitch %#x: stub.\n",
+ struct wined3d_surface *surface = texture->sub_resources[sub_resource_idx].u.surface;
+ const struct wined3d_format *format = texture->resource.format;
+ unsigned int level = sub_resource_idx % texture->level_count;
+ const struct wined3d_gl_info *gl_info = context->gl_info;
+ const void *mem = data->addr;
+ void *converted_mem = NULL;
+ unsigned int width;
+
+ TRACE("texture %p, sub_resource_idx %u, context %p, data {%#x:%p}, row_pitch %#x, slice_pitch %#x.\n",
texture, sub_resource_idx, context, data->buffer_object, data->addr, row_pitch, slice_pitch);
+
+ width = wined3d_texture_get_level_width(texture, level);
+
+ if (format->convert)
+ {
+ unsigned int dst_row_pitch;
+
+ if (data->buffer_object)
+ ERR("Loading a converted texture from a PBO.\n");
+ if (texture->resource.format_flags & WINED3DFMT_FLAG_BLOCKS)
+ ERR("Converting a block-based format.\n");
+
+ dst_row_pitch = width * format->conv_byte_count;
+
+ converted_mem = HeapAlloc(GetProcessHeap(), 0, dst_row_pitch);
+ format->convert(data->addr, converted_mem, row_pitch, slice_pitch, dst_row_pitch, dst_row_pitch, width, 1, 1);
+ mem = converted_mem;
+ }
+
+ if (data->buffer_object)
+ {
+ GL_EXTCALL(glBindBuffer(GL_PIXEL_UNPACK_BUFFER, data->buffer_object));
+ checkGLcall("glBindBuffer");
+ }
+
+ if (surface->texture_target == GL_TEXTURE_1D_ARRAY)
+ {
+ gl_info->gl_ops.gl.p_glPixelStorei(GL_UNPACK_ROW_LENGTH, row_pitch / format->byte_count);
+
+ gl_info->gl_ops.gl.p_glTexSubImage2D(surface->texture_target, level, 0, surface->texture_layer, width, 1, format->glFormat, format->glType, mem);
+ checkGLcall("glTexSubImage2D");
+
+ gl_info->gl_ops.gl.p_glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
+ }
+ else
+ {
+ gl_info->gl_ops.gl.p_glTexSubImage1D(surface->texture_target, level, 0, width, format->glFormat, format->glType, mem);
+ checkGLcall("glTexSubImage1D");
+ }
+
+ if (data->buffer_object)
+ {
+ GL_EXTCALL(glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0));
+ checkGLcall("glBindBuffer");
+ }
+
+ HeapFree(GetProcessHeap(), 0, converted_mem);
}
/* Context activation is done by the caller. */
--
2.8.1

View File

@ -0,0 +1,95 @@
From e73e778d3e02e0f4ce14f2f28811e14955d6fe9d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sat, 27 Aug 2016 22:38:47 +0200
Subject: wined3d: Implement loading from system memory and buffers to (s)rgb
1d textures.
---
dlls/wined3d/texture.c | 69 ++++++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 67 insertions(+), 2 deletions(-)
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index 442ec27..72e2baf 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -1510,10 +1510,75 @@ static void texture1d_upload_data(struct wined3d_texture *texture, unsigned int
static BOOL texture1d_load_location(struct wined3d_texture *texture, unsigned int sub_resource_idx,
struct wined3d_context *context, DWORD location)
{
- FIXME("texture %p, sub_resource_idx %u, context %p, location %s: stub.\n",
+ struct wined3d_texture_sub_resource *sub_resource = &texture->sub_resources[sub_resource_idx];
+ DWORD required_access = wined3d_resource_access_from_location(location);
+ unsigned int row_pitch, slice_pitch;
+
+ TRACE("texture %p, sub_resource_idx %u, context %p, location %s.\n",
texture, sub_resource_idx, context, wined3d_debug_location(location));
- return FALSE;
+ TRACE("Current resource location %s.\n", wined3d_debug_location(sub_resource->locations));
+
+ if ((sub_resource->locations & location) == location)
+ {
+ TRACE("Location(s) already up to date.\n");
+ return TRUE;
+ }
+
+ if ((texture->resource.access_flags & required_access) != required_access)
+ {
+ ERR("Operation requires %#x access, but 1d texture only has %#x.\n",
+ required_access, texture->resource.access_flags);
+ return FALSE;
+ }
+
+ if (!wined3d_texture_prepare_location(texture, sub_resource_idx, context, location))
+ return FALSE;
+
+ if (sub_resource->locations & WINED3D_LOCATION_DISCARDED)
+ {
+ TRACE("1d texture previously discarded, nothing to do.\n");
+ wined3d_texture_validate_location(texture, sub_resource_idx, location);
+ wined3d_texture_invalidate_location(texture, sub_resource_idx, WINED3D_LOCATION_DISCARDED);
+ goto done;
+ }
+
+ switch (location)
+ {
+ case WINED3D_LOCATION_TEXTURE_RGB:
+ case WINED3D_LOCATION_TEXTURE_SRGB:
+ if (sub_resource->locations & WINED3D_LOCATION_SYSMEM)
+ {
+ struct wined3d_const_bo_address data = {0, texture->resource.heap_memory};
+ data.addr += sub_resource->offset;
+ wined3d_texture_bind_and_dirtify(texture, context, location == WINED3D_LOCATION_TEXTURE_SRGB);
+ wined3d_texture_get_pitch(texture, sub_resource_idx, &row_pitch, &slice_pitch);
+ texture1d_upload_data(texture, sub_resource_idx, context, &data, row_pitch, slice_pitch);
+ }
+ else if (sub_resource->locations & WINED3D_LOCATION_BUFFER)
+ {
+ struct wined3d_const_bo_address data = {sub_resource->buffer_object, NULL};
+ wined3d_texture_bind_and_dirtify(texture, context, location == WINED3D_LOCATION_TEXTURE_SRGB);
+ wined3d_texture_get_pitch(texture, sub_resource_idx, &row_pitch, &slice_pitch);
+ texture1d_upload_data(texture, sub_resource_idx, context, &data, row_pitch, slice_pitch);
+ }
+ else
+ {
+ FIXME("Implement 1d texture loading from %s.\n", wined3d_debug_location(sub_resource->locations));
+ return FALSE;
+ }
+ break;
+
+ default:
+ FIXME("Implement %s loading from %s.\n", wined3d_debug_location(location),
+ wined3d_debug_location(sub_resource->locations));
+ return FALSE;
+ }
+
+done:
+ wined3d_texture_validate_location(texture, sub_resource_idx, location);
+
+ return TRUE;
}
static void texture1d_prepare_texture(struct wined3d_texture *texture, struct wined3d_context *context, BOOL srgb)
--
2.8.1

View File

@ -0,0 +1,143 @@
From 17119e7e24b0d78fa85945afba9e92349c69c03c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sat, 27 Aug 2016 22:41:05 +0200
Subject: wined3d: Implement downloading from (s)rgb 1d textures to system
memory.
---
dlls/wined3d/texture.c | 112 +++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 112 insertions(+)
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index 72e2baf..48f3cde 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -1507,6 +1507,76 @@ static void texture1d_upload_data(struct wined3d_texture *texture, unsigned int
}
/* Context activation is done by the caller. */
+static void texture1d_download_data(struct wined3d_texture *texture, unsigned int sub_resource_idx,
+ const struct wined3d_context *context, const struct wined3d_bo_address *data)
+{
+ struct wined3d_surface *surface = texture->sub_resources[sub_resource_idx].u.surface;
+ const struct wined3d_format *format = texture->resource.format;
+ const struct wined3d_gl_info *gl_info = context->gl_info;
+ struct wined3d_texture_sub_resource *sub_resource;
+ BYTE *temporary_mem = NULL;
+ void *mem;
+
+ sub_resource = &texture->sub_resources[sub_resource_idx];
+
+ if (format->convert)
+ {
+ FIXME("Attempting to download a converted 1d texture, format %s.\n",
+ debug_d3dformat(format->id));
+ return;
+ }
+
+ if (surface->texture_target == GL_TEXTURE_1D_ARRAY)
+ {
+ WARN_(d3d_perf)("Downloading all miplevel layers to get the surface data for a single sub-resource.\n");
+
+ if (!(temporary_mem = wined3d_calloc(texture->layer_count, sub_resource->size)))
+ {
+ ERR("Out of memory.\n");
+ return;
+ }
+
+ mem = temporary_mem;
+ }
+ else if (data->buffer_object)
+ {
+ GL_EXTCALL(glBindBuffer(GL_PIXEL_PACK_BUFFER, data->buffer_object));
+ checkGLcall("glBindBuffer");
+ mem = data->addr;
+ }
+ else
+ mem = data->addr;
+
+ gl_info->gl_ops.gl.p_glGetTexImage(surface->texture_target, sub_resource_idx,
+ format->glFormat, format->glType, mem);
+ checkGLcall("glGetTexImage");
+
+ if (temporary_mem)
+ {
+ void *src_data = temporary_mem + surface->texture_layer * sub_resource->size;
+ if (data->buffer_object)
+ {
+ GL_EXTCALL(glBindBuffer(GL_PIXEL_PACK_BUFFER, data->buffer_object));
+ checkGLcall("glBindBuffer");
+ GL_EXTCALL(glBufferSubData(GL_PIXEL_PACK_BUFFER, 0, sub_resource->size, src_data));
+ checkGLcall("glBufferSubData");
+ }
+ else
+ {
+ memcpy(data->addr, src_data, sub_resource->size);
+ }
+ }
+
+ if (data->buffer_object)
+ {
+ GL_EXTCALL(glBindBuffer(GL_PIXEL_PACK_BUFFER, 0));
+ checkGLcall("glBindBuffer");
+ }
+
+ HeapFree(GetProcessHeap(), 0, temporary_mem);
+}
+
+/* Context activation is done by the caller. */
static BOOL texture1d_load_location(struct wined3d_texture *texture, unsigned int sub_resource_idx,
struct wined3d_context *context, DWORD location)
{
@@ -1569,6 +1639,48 @@ static BOOL texture1d_load_location(struct wined3d_texture *texture, unsigned in
}
break;
+ case WINED3D_LOCATION_SYSMEM:
+ if (sub_resource->locations & (WINED3D_LOCATION_TEXTURE_RGB | WINED3D_LOCATION_TEXTURE_SRGB))
+ {
+ struct wined3d_bo_address data = {0, texture->resource.heap_memory};
+
+ data.addr += sub_resource->offset;
+ if (sub_resource->locations & WINED3D_LOCATION_TEXTURE_RGB)
+ wined3d_texture_bind_and_dirtify(texture, context, FALSE);
+ else
+ wined3d_texture_bind_and_dirtify(texture, context, TRUE);
+
+ texture1d_download_data(texture, sub_resource_idx, context, &data);
+ ++texture->download_count;
+ }
+ else
+ {
+ FIXME("Implement WINED3D_LOCATION_SYSMEM loading from %s.\n",
+ wined3d_debug_location(sub_resource->locations));
+ return FALSE;
+ }
+ break;
+
+ case WINED3D_LOCATION_BUFFER:
+ if (sub_resource->locations & (WINED3D_LOCATION_TEXTURE_RGB | WINED3D_LOCATION_TEXTURE_SRGB))
+ {
+ struct wined3d_bo_address data = {sub_resource->buffer_object, NULL};
+
+ if (sub_resource->locations & WINED3D_LOCATION_TEXTURE_RGB)
+ wined3d_texture_bind_and_dirtify(texture, context, FALSE);
+ else
+ wined3d_texture_bind_and_dirtify(texture, context, TRUE);
+
+ texture1d_download_data(texture, sub_resource_idx, context, &data);
+ }
+ else
+ {
+ FIXME("Implement WINED3D_LOCATION_BUFFER loading from %s.\n",
+ wined3d_debug_location(sub_resource->locations));
+ return FALSE;
+ }
+ break;
+
default:
FIXME("Implement %s loading from %s.\n", wined3d_debug_location(location),
wined3d_debug_location(sub_resource->locations));
--
2.8.1

View File

@ -0,0 +1,61 @@
From 20fbaad604f6b979154d7b8d5b1e43a7f10f1d8d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sat, 27 Aug 2016 22:44:14 +0200
Subject: wined3d: Implement converting between (s)rgb 1d textures.
---
dlls/wined3d/texture.c | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index 48f3cde..9c17b45 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -1577,6 +1577,29 @@ static void texture1d_download_data(struct wined3d_texture *texture, unsigned in
}
/* Context activation is done by the caller. */
+static void texture1d_srgb_transfer(struct wined3d_texture *texture, unsigned int sub_resource_idx,
+ struct wined3d_context *context, BOOL dest_is_srgb)
+{
+ struct wined3d_texture_sub_resource *sub_resource = &texture->sub_resources[sub_resource_idx];
+ unsigned int row_pitch, slice_pitch;
+ struct wined3d_bo_address data;
+
+ WARN_(d3d_perf)("Performing slow rgb/srgb 1d texture transfer.\n");
+ data.buffer_object = 0;
+ if (!(data.addr = HeapAlloc(GetProcessHeap(), 0, sub_resource->size)))
+ return;
+
+ wined3d_texture_get_pitch(texture, sub_resource_idx, &row_pitch, &slice_pitch);
+ wined3d_texture_bind_and_dirtify(texture, context, !dest_is_srgb);
+ texture1d_download_data(texture, sub_resource_idx, context, &data);
+ wined3d_texture_bind_and_dirtify(texture, context, dest_is_srgb);
+ texture1d_upload_data(texture, sub_resource_idx, context,
+ wined3d_const_bo_address(&data), row_pitch, slice_pitch);
+
+ HeapFree(GetProcessHeap(), 0, data.addr);
+}
+
+/* Context activation is done by the caller. */
static BOOL texture1d_load_location(struct wined3d_texture *texture, unsigned int sub_resource_idx,
struct wined3d_context *context, DWORD location)
{
@@ -1632,6 +1655,14 @@ static BOOL texture1d_load_location(struct wined3d_texture *texture, unsigned in
wined3d_texture_get_pitch(texture, sub_resource_idx, &row_pitch, &slice_pitch);
texture1d_upload_data(texture, sub_resource_idx, context, &data, row_pitch, slice_pitch);
}
+ else if (sub_resource->locations & WINED3D_LOCATION_TEXTURE_RGB)
+ {
+ texture1d_srgb_transfer(texture, sub_resource_idx, context, TRUE);
+ }
+ else if (sub_resource->locations & WINED3D_LOCATION_TEXTURE_SRGB)
+ {
+ texture1d_srgb_transfer(texture, sub_resource_idx, context, FALSE);
+ }
else
{
FIXME("Implement 1d texture loading from %s.\n", wined3d_debug_location(sub_resource->locations));
--
2.8.1

View File

@ -0,0 +1,29 @@
From d2b758c7547d63af92250da595967923b1c4ecca 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:11:03 +0200
Subject: wined3d: Check for 1d textures in wined3d_texture_update_desc.
---
dlls/wined3d/texture.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index 9c17b45..4703bc8 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -1113,6 +1113,12 @@ HRESULT CDECL wined3d_texture_update_desc(struct wined3d_texture *texture, UINT
return WINED3DERR_INVALIDCALL;
}
+ if (texture->resource.type == WINED3D_RTYPE_TEXTURE_1D)
+ {
+ FIXME("Not yet supported for 1D textures.\n");
+ return WINED3DERR_INVALIDCALL;
+ }
+
if (texture->resource.map_count)
{
WARN("Texture is mapped.\n");
--
2.8.1

View File

@ -0,0 +1,24 @@
From d11ec46eaaa4f0cd22684502ea9513198cc7f1c0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Thu, 25 Aug 2016 17:00:12 +0200
Subject: wined3d: Check if 1d teture is still in use before releasing.
---
dlls/wined3d/device.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 1445399..f67627a 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -5000,6 +5000,7 @@ void device_resource_released(struct wined3d_device *device, struct wined3d_reso
switch (type)
{
+ case WINED3D_RTYPE_TEXTURE_1D:
case WINED3D_RTYPE_TEXTURE_2D:
case WINED3D_RTYPE_TEXTURE_3D:
for (i = 0; i < MAX_COMBINED_SAMPLERS; ++i)
--
2.8.1

View File

@ -0,0 +1,30 @@
From d899bbed65bd73ee3c18a55bda617b96d19c126e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Thu, 25 Aug 2016 17:06:41 +0200
Subject: wined3d: Generate glsl samplers for 1d texture arrays.
---
dlls/wined3d/glsl_shader.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index 5ccb027..654a988 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -2005,6 +2005,13 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont
sampler_type = "samplerCube";
break;
+ case WINED3D_SHADER_RESOURCE_TEXTURE_1DARRAY:
+ if (shadow_sampler)
+ sampler_type = "sampler1DArrayShadow";
+ else
+ sampler_type = "sampler1DArray";
+ break;
+
case WINED3D_SHADER_RESOURCE_TEXTURE_2DARRAY:
if (shadow_sampler)
sampler_type = "sampler2DArrayShadow";
--
2.8.1

View File

@ -0,0 +1,39 @@
From 628042ee68362bf3d57801084143e9e7d724b262 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:09:41 +0200
Subject: wined3d: Add support for 1d textures in
context_attach_gl_texture_fbo.
---
dlls/wined3d/context.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index 74c3a49..1cd2463 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -128,7 +128,7 @@ static void context_attach_gl_texture_fbo(struct wined3d_context *context,
gl_info->fbo_ops.glFramebufferTexture2D(fbo_target, attachment, GL_TEXTURE_2D, 0, 0);
checkGLcall("glFramebufferTexture2D()");
}
- else if (resource->target == GL_TEXTURE_2D_ARRAY)
+ else if (resource->target == GL_TEXTURE_2D_ARRAY || resource->target == GL_TEXTURE_1D_ARRAY)
{
if (!gl_info->fbo_ops.glFramebufferTextureLayer)
{
@@ -140,6 +140,12 @@ static void context_attach_gl_texture_fbo(struct wined3d_context *context,
resource->object, resource->level, resource->layer);
checkGLcall("glFramebufferTextureLayer()");
}
+ else if (resource->target == GL_TEXTURE_1D)
+ {
+ gl_info->fbo_ops.glFramebufferTexture1D(fbo_target, attachment,
+ resource->target, resource->object, resource->level);
+ checkGLcall("glFramebufferTexture1D()");
+ }
else
{
gl_info->fbo_ops.glFramebufferTexture2D(fbo_target, attachment,
--
2.8.1

View File

@ -0,0 +1,79 @@
From 2fa42aeeeeafb6eb2da908b43ee8137249fcfeb4 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:21:20 +0200
Subject: wined3d: Handle 1d textures in texture_activate_dimensions.
---
dlls/wined3d/utils.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c
index 4e00aad..b903bb6 100644
--- a/dlls/wined3d/utils.c
+++ b/dlls/wined3d/utils.c
@@ -5425,7 +5425,27 @@ void texture_activate_dimensions(const struct wined3d_texture *texture, const st
{
switch (texture->target)
{
+ case GL_TEXTURE_1D:
+ gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_2D);
+ checkGLcall("glDisable(GL_TEXTURE_2D)");
+ gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_3D);
+ checkGLcall("glDisable(GL_TEXTURE_3D)");
+ if (gl_info->supported[ARB_TEXTURE_CUBE_MAP])
+ {
+ gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_CUBE_MAP_ARB);
+ checkGLcall("glDisable(GL_TEXTURE_CUBE_MAP_ARB)");
+ }
+ if (gl_info->supported[ARB_TEXTURE_RECTANGLE])
+ {
+ gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_RECTANGLE_ARB);
+ checkGLcall("glDisable(GL_TEXTURE_RECTANGLE_ARB)");
+ }
+ gl_info->gl_ops.gl.p_glEnable(GL_TEXTURE_1D);
+ checkGLcall("glEnable(GL_TEXTURE_1D)");
+ break;
case GL_TEXTURE_2D:
+ gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_1D);
+ checkGLcall("glDisable(GL_TEXTURE_1D)");
gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_3D);
checkGLcall("glDisable(GL_TEXTURE_3D)");
if (gl_info->supported[ARB_TEXTURE_CUBE_MAP])
@@ -5442,6 +5462,8 @@ void texture_activate_dimensions(const struct wined3d_texture *texture, const st
checkGLcall("glEnable(GL_TEXTURE_2D)");
break;
case GL_TEXTURE_RECTANGLE_ARB:
+ gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_1D);
+ checkGLcall("glDisable(GL_TEXTURE_1D)");
gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_2D);
checkGLcall("glDisable(GL_TEXTURE_2D)");
gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_3D);
@@ -5465,12 +5487,16 @@ void texture_activate_dimensions(const struct wined3d_texture *texture, const st
gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_RECTANGLE_ARB);
checkGLcall("glDisable(GL_TEXTURE_RECTANGLE_ARB)");
}
+ gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_1D);
+ checkGLcall("glDisable(GL_TEXTURE_1D)");
gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_2D);
checkGLcall("glDisable(GL_TEXTURE_2D)");
gl_info->gl_ops.gl.p_glEnable(GL_TEXTURE_3D);
checkGLcall("glEnable(GL_TEXTURE_3D)");
break;
case GL_TEXTURE_CUBE_MAP_ARB:
+ gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_1D);
+ checkGLcall("glDisable(GL_TEXTURE_1D)");
gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_2D);
checkGLcall("glDisable(GL_TEXTURE_2D)");
gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_3D);
@@ -5487,6 +5513,8 @@ void texture_activate_dimensions(const struct wined3d_texture *texture, const st
}
else
{
+ gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_1D);
+ checkGLcall("glDisable(GL_TEXTURE_1D)");
gl_info->gl_ops.gl.p_glEnable(GL_TEXTURE_2D);
checkGLcall("glEnable(GL_TEXTURE_2D)");
gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_3D);
--
2.8.1

View File

@ -0,0 +1,27 @@
From 403ca5c3b1f87c94c800e2a40480083eec09ebf5 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:26:07 +0200
Subject: wined3d: Allow creation of 1d shader views.
---
dlls/wined3d/view.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/dlls/wined3d/view.c b/dlls/wined3d/view.c
index 7f07d57..97cc11e 100644
--- a/dlls/wined3d/view.c
+++ b/dlls/wined3d/view.c
@@ -291,6 +291,10 @@ static HRESULT wined3d_shader_resource_view_init(struct wined3d_shader_resource_
}
view_types[] =
{
+ {GL_TEXTURE_1D, 0, GL_TEXTURE_1D},
+ {GL_TEXTURE_1D, WINED3D_VIEW_TEXTURE_ARRAY, GL_TEXTURE_1D_ARRAY},
+ {GL_TEXTURE_1D_ARRAY, 0, GL_TEXTURE_1D},
+ {GL_TEXTURE_1D_ARRAY, WINED3D_VIEW_TEXTURE_ARRAY, GL_TEXTURE_1D_ARRAY},
{GL_TEXTURE_2D, 0, GL_TEXTURE_2D},
{GL_TEXTURE_2D, WINED3D_VIEW_TEXTURE_ARRAY, GL_TEXTURE_2D_ARRAY},
{GL_TEXTURE_2D_ARRAY, 0, GL_TEXTURE_2D},
--
2.8.1

View File

@ -1,6 +1,7 @@
Depends: wined3d-Accounting
Depends: wined3d-DXTn
Depends: wined3d-QUERY_Stubs
Depends: wined3d-1DTextures
Depends: wined3d-Silence_FIXMEs
Depends: makedep-PARENTSPEC
Depends: ntdll-DllRedirects

View File

@ -1,18 +1,18 @@
From 8aa63bc1c917384f24353625459d8381d2474e54 Mon Sep 17 00:00:00 2001
From 3b8bb25493ee434d987b8768a4e0187b29d9f342 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Wed, 18 Nov 2015 08:31:14 +0000
Subject: wined3d: Share surface and volume system memory loading code.
---
dlls/wined3d/surface.c | 110 --------------------------------
dlls/wined3d/texture.c | 169 ++++++++++++++++++++++++++++++++++++-------------
2 files changed, 124 insertions(+), 155 deletions(-)
dlls/wined3d/surface.c | 110 ----------------------------
dlls/wined3d/texture.c | 192 +++++++++++++++++++++++++++++++------------------
2 files changed, 124 insertions(+), 178 deletions(-)
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 6d5b22b..5805557 100644
index 5118429..59effac 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -2865,67 +2865,6 @@ static void surface_load_ds_location(struct wined3d_surface *surface, struct win
@@ -2867,67 +2867,6 @@ static void surface_load_ds_location(struct wined3d_surface *surface, struct win
}
}
@ -80,7 +80,7 @@ index 6d5b22b..5805557 100644
/* Context activation is done by the caller. */
static void surface_load_sysmem(struct wined3d_surface *surface,
struct wined3d_context *context, DWORD dst_location)
@@ -2938,12 +2877,6 @@ static void surface_load_sysmem(struct wined3d_surface *surface,
@@ -2940,12 +2879,6 @@ static void surface_load_sysmem(struct wined3d_surface *surface,
wined3d_texture_prepare_location(texture, sub_resource_idx, context, dst_location);
sub_resource = &texture->sub_resources[sub_resource_idx];
@ -93,7 +93,7 @@ index 6d5b22b..5805557 100644
if (sub_resource->locations & (WINED3D_LOCATION_RB_MULTISAMPLE | WINED3D_LOCATION_RB_RESOLVED))
wined3d_texture_load_location(texture, sub_resource_idx, context, WINED3D_LOCATION_TEXTURE_RGB);
@@ -3188,46 +3121,11 @@ void surface_load_location(struct wined3d_surface *surface, struct wined3d_conte
@@ -3190,46 +3123,11 @@ void surface_load_location(struct wined3d_surface *surface, struct wined3d_conte
unsigned int sub_resource_idx = surface_get_sub_resource_idx(surface);
struct wined3d_texture *texture = surface->container;
struct wined3d_texture_sub_resource *sub_resource;
@ -140,7 +140,7 @@ index 6d5b22b..5805557 100644
if (texture->resource.usage & WINED3DUSAGE_DEPTHSTENCIL)
{
@@ -3274,14 +3172,6 @@ void surface_load_location(struct wined3d_surface *surface, struct wined3d_conte
@@ -3276,14 +3174,6 @@ void surface_load_location(struct wined3d_surface *surface, struct wined3d_conte
}
done:
@ -156,7 +156,7 @@ index 6d5b22b..5805557 100644
}
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index 2d155cb..40d333f 100644
index 4ec5501..c8b181b 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -80,27 +80,6 @@ GLenum wined3d_texture_get_gl_buffer(const struct wined3d_texture *texture)
@ -184,10 +184,10 @@ index 2d155cb..40d333f 100644
- }
-}
-
static void wined3d_texture_evict_sysmem(struct wined3d_texture *texture)
static BOOL is_power_of_two(UINT x)
{
struct wined3d_texture_sub_resource *sub_resource;
@@ -174,12 +153,135 @@ void wined3d_texture_invalidate_location(struct wined3d_texture *texture,
return (x != 0) && !(x & (x - 1));
@@ -179,12 +158,135 @@ void wined3d_texture_invalidate_location(struct wined3d_texture *texture,
sub_resource_idx, texture);
}
@ -324,7 +324,7 @@ index 2d155cb..40d333f 100644
}
/* Context activation is done by the caller. */
@@ -2209,7 +2311,6 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in
@@ -1610,7 +1712,6 @@ static BOOL texture1d_load_location(struct wined3d_texture *texture, unsigned in
struct wined3d_context *context, DWORD location)
{
struct wined3d_texture_sub_resource *sub_resource = &texture->sub_resources[sub_resource_idx];
@ -332,7 +332,54 @@ index 2d155cb..40d333f 100644
unsigned int row_pitch, slice_pitch;
TRACE("texture %p, sub_resource_idx %u, context %p, location %s.\n",
@@ -2217,30 +2318,9 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in
@@ -1618,30 +1719,9 @@ static BOOL texture1d_load_location(struct wined3d_texture *texture, unsigned in
TRACE("Current resource location %s.\n", wined3d_debug_location(sub_resource->locations));
- if ((sub_resource->locations & location) == location)
- {
- TRACE("Location(s) already up to date.\n");
- return TRUE;
- }
-
- if ((texture->resource.access_flags & required_access) != required_access)
- {
- ERR("Operation requires %#x access, but 1d texture only has %#x.\n",
- required_access, texture->resource.access_flags);
- return FALSE;
- }
-
if (!wined3d_texture_prepare_location(texture, sub_resource_idx, context, location))
return FALSE;
- if (sub_resource->locations & WINED3D_LOCATION_DISCARDED)
- {
- TRACE("1d texture previously discarded, nothing to do.\n");
- wined3d_texture_validate_location(texture, sub_resource_idx, location);
- wined3d_texture_invalidate_location(texture, sub_resource_idx, WINED3D_LOCATION_DISCARDED);
- goto done;
- }
-
switch (location)
{
case WINED3D_LOCATION_TEXTURE_RGB:
@@ -1724,7 +1804,6 @@ static BOOL texture1d_load_location(struct wined3d_texture *texture, unsigned in
return FALSE;
}
-done:
wined3d_texture_validate_location(texture, sub_resource_idx, location);
return TRUE;
@@ -2709,7 +2788,6 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in
struct wined3d_context *context, DWORD location)
{
struct wined3d_texture_sub_resource *sub_resource = &texture->sub_resources[sub_resource_idx];
- DWORD required_access = wined3d_resource_access_from_location(location);
unsigned int row_pitch, slice_pitch;
TRACE("texture %p, sub_resource_idx %u, context %p, location %s.\n",
@@ -2717,30 +2795,9 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in
TRACE("Current resource location %s.\n", wined3d_debug_location(sub_resource->locations));
@ -363,7 +410,7 @@ index 2d155cb..40d333f 100644
switch (location)
{
case WINED3D_LOCATION_TEXTURE_RGB:
@@ -2325,7 +2405,6 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in
@@ -2825,7 +2882,6 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in
return FALSE;
}
@ -372,5 +419,5 @@ index 2d155cb..40d333f 100644
return TRUE;
--
2.9.0
2.8.1

View File

@ -1,4 +1,4 @@
From ef8df8ff00cb4cc235b01ee452f806824ef00b3a Mon Sep 17 00:00:00 2001
From 67f6c320ba0d32d73a7cde737a1ecea30f627cca Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Fri, 30 Aug 2013 17:00:35 +0200
Subject: wined3d: Wrap GL BOs in a structure
@ -6,17 +6,17 @@ Subject: wined3d: Wrap GL BOs in a structure
The idea is to use those structures for mapping through the command stream and caching
them for DISCARD maps.
---
dlls/wined3d/device.c | 53 ++++++++++++++++++++++++++++++++++++++++++
dlls/wined3d/device.c | 53 +++++++++++++++++++++++++++++++++++++++
dlls/wined3d/surface.c | 2 +-
dlls/wined3d/texture.c | 53 ++++++++++++++++++------------------------
dlls/wined3d/wined3d_private.h | 15 +++++++++++-
4 files changed, 91 insertions(+), 32 deletions(-)
dlls/wined3d/texture.c | 57 ++++++++++++++++++------------------------
dlls/wined3d/wined3d_private.h | 15 ++++++++++-
4 files changed, 93 insertions(+), 34 deletions(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 5562b31..928fcda 100644
index 56d45e5..824fa89 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -5270,3 +5270,56 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL
@@ -5241,3 +5241,56 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL
else
return CallWindowProcA(proc, window, message, wparam, lparam);
}
@ -74,10 +74,10 @@ index 5562b31..928fcda 100644
+ wined3d_device_destroy_bo(device, context, bo);
+}
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 444237e..46f79db 100644
index a0b6d62..e187742 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -3080,7 +3080,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface,
@@ -3075,7 +3075,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface,
/* Don't use PBOs for converted surfaces. During PBO conversion we look at
* WINED3D_TEXTURE_CONVERTED but it isn't set (yet) in all cases it is
* getting called. */
@ -87,10 +87,10 @@ index 444237e..46f79db 100644
TRACE("Removing the pbo attached to surface %p.\n", surface);
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index d98503d..d0acd74 100644
index 6ca00ce..06ae160 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -206,7 +206,7 @@ void wined3d_texture_get_memory(struct wined3d_texture *texture, unsigned int su
@@ -342,7 +342,7 @@ void wined3d_texture_get_memory(struct wined3d_texture *texture, unsigned int su
if (locations & WINED3D_LOCATION_BUFFER)
{
data->addr = NULL;
@ -99,7 +99,7 @@ index d98503d..d0acd74 100644
return;
}
if (locations & WINED3D_LOCATION_USER_MEMORY)
@@ -303,18 +303,17 @@ static HRESULT wined3d_texture_init(struct wined3d_texture *texture, const struc
@@ -439,18 +439,17 @@ static HRESULT wined3d_texture_init(struct wined3d_texture *texture, const struc
/* Context activation is done by the caller. */
static void wined3d_texture_remove_buffer_object(struct wined3d_texture *texture,
@ -124,7 +124,7 @@ index d98503d..d0acd74 100644
}
static void wined3d_texture_update_map_binding(struct wined3d_texture *texture)
@@ -334,7 +333,7 @@ static void wined3d_texture_update_map_binding(struct wined3d_texture *texture)
@@ -470,7 +469,7 @@ static void wined3d_texture_update_map_binding(struct wined3d_texture *texture)
&& !wined3d_texture_load_location(texture, i, context, map_binding))
ERR("Failed to load location %s.\n", wined3d_debug_location(map_binding));
if (texture->resource.map_binding == WINED3D_LOCATION_BUFFER)
@ -133,7 +133,7 @@ index d98503d..d0acd74 100644
}
if (context)
@@ -491,28 +490,25 @@ static void wined3d_texture_cleanup(struct wined3d_texture *texture)
@@ -627,28 +626,25 @@ static void wined3d_texture_cleanup(struct wined3d_texture *texture)
unsigned int sub_count = texture->level_count * texture->layer_count;
struct wined3d_device *device = texture->resource.device;
struct wined3d_context *context = NULL;
@ -167,7 +167,7 @@ index d98503d..d0acd74 100644
}
if (context)
context_release(context);
@@ -1185,22 +1181,19 @@ HRESULT CDECL wined3d_texture_update_desc(struct wined3d_texture *texture, UINT
@@ -1321,22 +1317,19 @@ HRESULT CDECL wined3d_texture_update_desc(struct wined3d_texture *texture, UINT
/* Context activation is done by the caller. */
static void wined3d_texture_prepare_buffer_object(struct wined3d_texture *texture,
@ -195,7 +195,7 @@ index d98503d..d0acd74 100644
}
static void wined3d_texture_force_reload(struct wined3d_texture *texture)
@@ -1326,7 +1319,7 @@ BOOL wined3d_texture_prepare_location(struct wined3d_texture *texture, unsigned
@@ -1462,7 +1455,7 @@ BOOL wined3d_texture_prepare_location(struct wined3d_texture *texture, unsigned
return TRUE;
case WINED3D_LOCATION_BUFFER:
@ -204,7 +204,25 @@ index d98503d..d0acd74 100644
return TRUE;
case WINED3D_LOCATION_TEXTURE_RGB:
@@ -1592,8 +1585,8 @@ static void wined3d_texture_unload(struct wined3d_resource *resource)
@@ -1742,7 +1735,7 @@ static BOOL texture1d_load_location(struct wined3d_texture *texture, unsigned in
}
else if (sub_resource->locations & WINED3D_LOCATION_BUFFER)
{
- struct wined3d_const_bo_address data = {sub_resource->buffer_object, NULL};
+ struct wined3d_const_bo_address data = {sub_resource->buffer->name, NULL};
wined3d_texture_bind_and_dirtify(texture, context, location == WINED3D_LOCATION_TEXTURE_SRGB);
wined3d_texture_get_pitch(texture, sub_resource_idx, &row_pitch, &slice_pitch);
texture1d_upload_data(texture, sub_resource_idx, context, &data, row_pitch, slice_pitch);
@@ -1787,7 +1780,7 @@ static BOOL texture1d_load_location(struct wined3d_texture *texture, unsigned in
case WINED3D_LOCATION_BUFFER:
if (sub_resource->locations & (WINED3D_LOCATION_TEXTURE_RGB | WINED3D_LOCATION_TEXTURE_SRGB))
{
- struct wined3d_bo_address data = {sub_resource->buffer_object, NULL};
+ struct wined3d_bo_address data = {sub_resource->buffer->name, NULL};
if (sub_resource->locations & WINED3D_LOCATION_TEXTURE_RGB)
wined3d_texture_bind_and_dirtify(texture, context, FALSE);
@@ -2068,8 +2061,8 @@ static void wined3d_texture_unload(struct wined3d_resource *resource)
wined3d_texture_invalidate_location(texture, i, ~WINED3D_LOCATION_DISCARDED);
}
@ -215,7 +233,7 @@ index d98503d..d0acd74 100644
if (resource->type == WINED3D_RTYPE_TEXTURE_2D)
{
@@ -2188,7 +2181,7 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in
@@ -2845,7 +2838,7 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in
}
else if (sub_resource->locations & WINED3D_LOCATION_BUFFER)
{
@ -224,7 +242,7 @@ index d98503d..d0acd74 100644
wined3d_texture_bind_and_dirtify(texture, context,
location == WINED3D_LOCATION_TEXTURE_SRGB);
wined3d_texture_get_pitch(texture, sub_resource_idx, &row_pitch, &slice_pitch);
@@ -2234,7 +2227,7 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in
@@ -2891,7 +2884,7 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in
case WINED3D_LOCATION_BUFFER:
if (sub_resource->locations & (WINED3D_LOCATION_TEXTURE_RGB | WINED3D_LOCATION_TEXTURE_SRGB))
{
@ -234,10 +252,10 @@ index d98503d..d0acd74 100644
if (sub_resource->locations & WINED3D_LOCATION_TEXTURE_RGB)
wined3d_texture_bind_and_dirtify(texture, context, FALSE);
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index f84b267..76be9c5 100644
index e6d6647..3796ebb 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2427,6 +2427,14 @@ struct wined3d_state
@@ -2433,6 +2433,14 @@ struct wined3d_state
struct wined3d_rasterizer_state *rasterizer_state;
};
@ -252,7 +270,7 @@ index f84b267..76be9c5 100644
#define WINED3D_UNMAPPED_STAGE ~0U
/* Multithreaded flag. Removed from the public header to signal that
@@ -2535,6 +2543,11 @@ void device_invalidate_state(const struct wined3d_device *device, DWORD state) D
@@ -2543,6 +2551,11 @@ void device_invalidate_state(const struct wined3d_device *device, DWORD state) D
void device_invalidate_shader_constants(const struct wined3d_device *device, DWORD mask) DECLSPEC_HIDDEN;
void device_exec_update_texture(struct wined3d_context *context, struct wined3d_texture *src_texture,
struct wined3d_texture *dst_texture) DECLSPEC_HIDDEN;
@ -264,7 +282,7 @@ index f84b267..76be9c5 100644
static inline BOOL isStateDirty(const struct wined3d_context *context, DWORD state)
{
@@ -2722,7 +2735,7 @@ struct wined3d_texture
@@ -2731,7 +2744,7 @@ struct wined3d_texture
unsigned int map_count;
DWORD locations;
@ -274,5 +292,5 @@ index f84b267..76be9c5 100644
} sub_resources[1];
};
--
2.9.0
2.8.1

File diff suppressed because it is too large Load Diff