[PATCH 1/8] d3dx10: Add D3DX10CreateThreadPump stub.
Piotr Caban
wine at gitlab.winehq.org
Sat Jun 18 06:56:53 CDT 2022
From: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Piotr Caban <piotr at codeweavers.com>
---
dlls/d3dx10_43/d3dx10_43.spec | 2 +-
dlls/d3dx10_43/d3dx10_43_main.c | 123 ++++++++++++++++++++++++++++++++
include/d3dx10core.h | 1 +
3 files changed, 125 insertions(+), 1 deletion(-)
diff --git a/dlls/d3dx10_43/d3dx10_43.spec b/dlls/d3dx10_43/d3dx10_43.spec
index 95160a067c5..2359c7c6f02 100644
--- a/dlls/d3dx10_43/d3dx10_43.spec
+++ b/dlls/d3dx10_43/d3dx10_43.spec
@@ -1,4 +1,4 @@
-@ stub D3DX10CreateThreadPump(long long ptr)
+@ stdcall D3DX10CreateThreadPump(long long ptr)
@ stdcall D3DX10CheckVersion(long long)
@ stub D3DX10CompileFromFileA(str ptr ptr str str long long ptr ptr ptr ptr)
@ stub D3DX10CompileFromFileW(wstr ptr ptr str str long long ptr ptr ptr ptr)
diff --git a/dlls/d3dx10_43/d3dx10_43_main.c b/dlls/d3dx10_43/d3dx10_43_main.c
index ec7407508d3..357b0257496 100644
--- a/dlls/d3dx10_43/d3dx10_43_main.c
+++ b/dlls/d3dx10_43/d3dx10_43_main.c
@@ -176,3 +176,126 @@ HRESULT WINAPI D3DX10LoadTextureFromTexture(ID3D10Resource *src_texture, D3DX10_
return E_NOTIMPL;
}
+
+struct thread_pump
+{
+ ID3DX10ThreadPump ID3DX10ThreadPump_iface;
+ LONG refcount;
+};
+
+static inline struct thread_pump *impl_from_ID3DX10ThreadPump(ID3DX10ThreadPump *iface)
+{
+ return CONTAINING_RECORD(iface, struct thread_pump, ID3DX10ThreadPump_iface);
+}
+
+static HRESULT WINAPI thread_pump_QueryInterface(ID3DX10ThreadPump *iface, REFIID riid, void **out)
+{
+ TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out);
+
+ if (IsEqualGUID(riid, &IID_ID3DX10ThreadPump)
+ || IsEqualGUID(riid, &IID_IUnknown))
+ {
+ ID3DX10ThreadPump_AddRef(iface);
+ *out = iface;
+ return S_OK;
+ }
+
+ WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid));
+ *out = NULL;
+ return E_NOINTERFACE;
+}
+
+static ULONG WINAPI thread_pump_AddRef(ID3DX10ThreadPump *iface)
+{
+ struct thread_pump *thread_pump = impl_from_ID3DX10ThreadPump(iface);
+ ULONG refcount = InterlockedIncrement(&thread_pump->refcount);
+
+ TRACE("%p increasing refcount to %lu.\n", iface, refcount);
+
+ return refcount;
+}
+
+static ULONG WINAPI thread_pump_Release(ID3DX10ThreadPump *iface)
+{
+ struct thread_pump *thread_pump = impl_from_ID3DX10ThreadPump(iface);
+ ULONG refcount = InterlockedDecrement(&thread_pump->refcount);
+
+ TRACE("%p decreasing refcount to %lu.\n", iface, refcount);
+
+ if (!refcount)
+ free(thread_pump);
+
+ return refcount;
+}
+
+static HRESULT WINAPI thread_pump_AddWorkItem(ID3DX10ThreadPump *iface, ID3DX10DataLoader *loader,
+ ID3DX10DataProcessor *processor, HRESULT *result, void **object)
+{
+ FIXME("iface %p, loader %p, processor %p, result %p, object %p stub!\n",
+ iface, loader, processor, result, object);
+ return E_NOTIMPL;
+}
+
+static UINT WINAPI thread_pump_GetWorkItemCount(ID3DX10ThreadPump *iface)
+{
+ FIXME("iface %p stub!\n", iface);
+ return 0;
+}
+
+static HRESULT WINAPI thread_pump_WaitForAllItems(ID3DX10ThreadPump *iface)
+{
+ FIXME("iface %p stub!\n", iface);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI thread_pump_ProcessDeviceWorkItems(ID3DX10ThreadPump *iface, UINT count)
+{
+ FIXME("iface %p, count %u stub!\n", iface, count);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI thread_pump_PurgeAllItems(ID3DX10ThreadPump *iface)
+{
+ FIXME("iface %p stub!\n", iface);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI thread_pump_GetQueueStatus(ID3DX10ThreadPump *iface,
+ UINT *io_queue, UINT *process_queue, UINT *device_queue)
+{
+ FIXME("iface %p, io_queue %p, process_queue %p, device_queue %p stub!\n",
+ iface, io_queue, process_queue, device_queue);
+ return E_NOTIMPL;
+}
+
+static const ID3DX10ThreadPumpVtbl thread_pump_vtbl =
+{
+ thread_pump_QueryInterface,
+ thread_pump_AddRef,
+ thread_pump_Release,
+ thread_pump_AddWorkItem,
+ thread_pump_GetWorkItemCount,
+ thread_pump_WaitForAllItems,
+ thread_pump_ProcessDeviceWorkItems,
+ thread_pump_PurgeAllItems,
+ thread_pump_GetQueueStatus
+};
+
+HRESULT WINAPI D3DX10CreateThreadPump(UINT io_threads, UINT proc_threads, ID3DX10ThreadPump **pump)
+{
+ struct thread_pump *object;
+
+ TRACE("io_threads %u, proc_threads %u, pump %p.\n", io_threads, proc_threads, pump);
+
+ if (io_threads >= 1024 || proc_threads >= 1024)
+ return E_FAIL;
+
+ if (!(object = calloc(1, sizeof(*object))))
+ return E_OUTOFMEMORY;
+
+ object->ID3DX10ThreadPump_iface.lpVtbl = &thread_pump_vtbl;
+ object->refcount = 1;
+
+ *pump = &object->ID3DX10ThreadPump_iface;
+ return S_OK;
+}
diff --git a/include/d3dx10core.h b/include/d3dx10core.h
index a9ba7854e90..cca9052cc13 100644
--- a/include/d3dx10core.h
+++ b/include/d3dx10core.h
@@ -298,3 +298,4 @@ HRESULT WINAPI D3DX10CreateFontW(ID3D10Device *device, INT height, UINT width, U
UINT miplevels, BOOL italic, UINT charset, UINT precision, UINT quality,
UINT pitchandfamily, const WCHAR *facename, ID3DX10Font **font);
HRESULT WINAPI D3DX10CreateSprite(ID3D10Device *device, UINT size, ID3DX10Sprite **sprite);
+HRESULT WINAPI D3DX10CreateThreadPump(UINT io_threads, UINT proc_threads, ID3DX10ThreadPump **pump);
--
GitLab
https://gitlab.winehq.org/wine/wine/-/merge_requests/272
More information about the wine-devel
mailing list