Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=56176
-- v7: d3dcompiler: Add D3DX11CreateThreadPump stub.
From: Vijay Kiran Kamuju infyquest@gmail.com
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=56176 --- dlls/d3dx11_42/Makefile.in | 2 +- dlls/d3dx11_42/d3dx11_42.spec | 2 +- dlls/d3dx11_42/tests/Makefile.in | 1 + dlls/d3dx11_43/Makefile.in | 2 +- dlls/d3dx11_43/async.c | 126 +++++++++++++++++++++++++++++++ dlls/d3dx11_43/d3dx11_43.spec | 2 +- dlls/d3dx11_43/tests/Makefile.in | 1 + dlls/d3dx11_43/tests/d3dx11.c | 33 ++++++++ include/d3dx11core.idl | 2 + 9 files changed, 167 insertions(+), 4 deletions(-)
diff --git a/dlls/d3dx11_42/Makefile.in b/dlls/d3dx11_42/Makefile.in index 985fc1c59c2..8b9d9482a04 100644 --- a/dlls/d3dx11_42/Makefile.in +++ b/dlls/d3dx11_42/Makefile.in @@ -1,7 +1,7 @@ EXTRADEFS = -DD3DX11_SDK_VERSION=42 MODULE = d3dx11_42.dll IMPORTLIB = d3dx11_42 -IMPORTS = d3dcompiler +IMPORTS = d3dcompiler uuid PARENTSRC = ../d3dx11_43
EXTRADLLFLAGS = -Wb,--prefer-native diff --git a/dlls/d3dx11_42/d3dx11_42.spec b/dlls/d3dx11_42/d3dx11_42.spec index 2d93b8d760a..f8c05089657 100644 --- a/dlls/d3dx11_42/d3dx11_42.spec +++ b/dlls/d3dx11_42/d3dx11_42.spec @@ -25,7 +25,7 @@ @ stdcall D3DX11CreateTextureFromMemory(ptr ptr long ptr ptr ptr ptr) @ stub D3DX11CreateTextureFromResourceA @ stub D3DX11CreateTextureFromResourceW -@ stub D3DX11CreateThreadPump +@ stdcall D3DX11CreateThreadPump(long long ptr) @ stdcall D3DX11FilterTexture(ptr ptr long long) @ stdcall D3DX11GetImageInfoFromFileA(str ptr ptr ptr) @ stdcall D3DX11GetImageInfoFromFileW(wstr ptr ptr ptr) diff --git a/dlls/d3dx11_42/tests/Makefile.in b/dlls/d3dx11_42/tests/Makefile.in index f18be76d9d5..8a0731a2bf6 100644 --- a/dlls/d3dx11_42/tests/Makefile.in +++ b/dlls/d3dx11_42/tests/Makefile.in @@ -1,3 +1,4 @@ +EXTRADEFS = -DD3DX11_SDK_VERSION=42 TESTDLL = d3dx11_42.dll IMPORTS = d3dx11_42 PARENTSRC = ../../d3dx11_43/tests diff --git a/dlls/d3dx11_43/Makefile.in b/dlls/d3dx11_43/Makefile.in index 762987a89ad..7ffeba61f8a 100644 --- a/dlls/d3dx11_43/Makefile.in +++ b/dlls/d3dx11_43/Makefile.in @@ -1,7 +1,7 @@ EXTRADEFS = -DD3DX11_SDK_VERSION=43 MODULE = d3dx11_43.dll IMPORTLIB = d3dx11 -IMPORTS = d3dcompiler +IMPORTS = d3dcompiler uuid
EXTRADLLFLAGS = -Wb,--prefer-native
diff --git a/dlls/d3dx11_43/async.c b/dlls/d3dx11_43/async.c index 074a8529e4e..9ac8c05157e 100644 --- a/dlls/d3dx11_43/async.c +++ b/dlls/d3dx11_43/async.c @@ -16,6 +16,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
+#define COBJMACROS +#include "initguid.h" #include "d3dx11.h" #include "d3dcompiler.h"
@@ -409,3 +411,127 @@ HRESULT WINAPI D3DX11CreateAsyncResourceLoaderW(HMODULE module, const WCHAR *res
return S_OK; } + +struct thread_pump +{ + ID3DX11ThreadPump ID3DX11ThreadPump_iface; + LONG refcount; +}; + +static inline struct thread_pump *impl_from_ID3DX11ThreadPump(ID3DX11ThreadPump *iface) +{ + return CONTAINING_RECORD(iface, struct thread_pump, ID3DX11ThreadPump_iface); +} + +static HRESULT WINAPI thread_pump_QueryInterface(ID3DX11ThreadPump *iface, REFIID riid, void **out) +{ + TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out); + + if (IsEqualGUID(riid, &IID_ID3DX11ThreadPump) + || IsEqualGUID(riid, &IID_IUnknown)) + { + ID3DX11ThreadPump_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(ID3DX11ThreadPump *iface) +{ + struct thread_pump *thread_pump = impl_from_ID3DX11ThreadPump(iface); + ULONG refcount = InterlockedIncrement(&thread_pump->refcount); + + TRACE("%p increasing refcount to %lu.\n", iface, refcount); + + return refcount; +} + +static ULONG WINAPI thread_pump_Release(ID3DX11ThreadPump *iface) +{ + struct thread_pump *thread_pump = impl_from_ID3DX11ThreadPump(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(ID3DX11ThreadPump *iface, ID3DX11DataLoader *loader, + ID3DX11DataProcessor *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(ID3DX11ThreadPump *iface) +{ + FIXME("iface %p stub!\n", iface); + return 0; +} + +static HRESULT WINAPI thread_pump_WaitForAllItems(ID3DX11ThreadPump *iface) +{ + FIXME("iface %p stub!\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI thread_pump_ProcessDeviceWorkItems(ID3DX11ThreadPump *iface, UINT count) +{ + FIXME("iface %p, count %u stub!\n", iface, count); + return E_NOTIMPL; +} + +static HRESULT WINAPI thread_pump_PurgeAllItems(ID3DX11ThreadPump *iface) +{ + FIXME("iface %p stub!\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI thread_pump_GetQueueStatus(ID3DX11ThreadPump *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 ID3DX11ThreadPumpVtbl 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 D3DX11CreateThreadPump(UINT io_threads, UINT proc_threads, ID3DX11ThreadPump **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->ID3DX11ThreadPump_iface.lpVtbl = &thread_pump_vtbl; + object->refcount = 1; + + *pump = &object->ID3DX11ThreadPump_iface; + return S_OK; +} diff --git a/dlls/d3dx11_43/d3dx11_43.spec b/dlls/d3dx11_43/d3dx11_43.spec index 2d93b8d760a..f8c05089657 100644 --- a/dlls/d3dx11_43/d3dx11_43.spec +++ b/dlls/d3dx11_43/d3dx11_43.spec @@ -25,7 +25,7 @@ @ stdcall D3DX11CreateTextureFromMemory(ptr ptr long ptr ptr ptr ptr) @ stub D3DX11CreateTextureFromResourceA @ stub D3DX11CreateTextureFromResourceW -@ stub D3DX11CreateThreadPump +@ stdcall D3DX11CreateThreadPump(long long ptr) @ stdcall D3DX11FilterTexture(ptr ptr long long) @ stdcall D3DX11GetImageInfoFromFileA(str ptr ptr ptr) @ stdcall D3DX11GetImageInfoFromFileW(wstr ptr ptr ptr) diff --git a/dlls/d3dx11_43/tests/Makefile.in b/dlls/d3dx11_43/tests/Makefile.in index 3283e251bdd..f41df92183f 100644 --- a/dlls/d3dx11_43/tests/Makefile.in +++ b/dlls/d3dx11_43/tests/Makefile.in @@ -1,3 +1,4 @@ +EXTRADEFS = -DD3DX11_SDK_VERSION=43 TESTDLL = d3dx11_43.dll IMPORTS = d3dx11
diff --git a/dlls/d3dx11_43/tests/d3dx11.c b/dlls/d3dx11_43/tests/d3dx11.c index 64ee050ec5d..d960d2c749e 100644 --- a/dlls/d3dx11_43/tests/d3dx11.c +++ b/dlls/d3dx11_43/tests/d3dx11.c @@ -651,6 +651,38 @@ static void test_D3DX11CompileFromFile(void) delete_directory(L"include"); }
+static void test_D3DX11CreateThreadPump(void) +{ + UINT io_count, process_count, device_count, count; + HRESULT hr; + ID3DX11ThreadPump *pump; + SYSTEM_INFO info; + DWORD ret; + + hr = D3DX11CreateThreadPump(1024, 0, &pump); + ok(hr == E_FAIL, "Got unexpected hr %#lx.\n", hr); + hr = D3DX11CreateThreadPump(0, 1024, &pump); + ok(hr == E_FAIL, "Got unexpected hr %#lx.\n", hr); + + GetSystemInfo(&info); + if (info.dwNumberOfProcessors > 1) + hr = D3DX11CreateThreadPump(0, 0, &pump); + else + hr = D3DX11CreateThreadPump(0, 2, &pump); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + + count = ID3DX11ThreadPump_GetWorkItemCount(pump); + todo_wine ok(!count, "GetWorkItemCount returned %u.\n", count); + hr = ID3DX11ThreadPump_GetQueueStatus(pump, &io_count, &process_count, &device_count); + todo_wine ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + todo_wine ok(!io_count, "Got unexpected io_count %u.\n", io_count); + todo_wine ok(!process_count, "Got unexpected process_count %u.\n", process_count); + todo_wine ok(!device_count, "Got unexpected device_count %u.\n", device_count); + + ret = ID3DX11ThreadPump_Release(pump); + ok(!ret, "Got unexpected refcount %lu.\n", ret); +} + /* dds_header.flags */ #define DDS_CAPS 0x00000001 #define DDS_HEIGHT 0x00000002 @@ -1024,5 +1056,6 @@ START_TEST(d3dx11) test_D3DX11CreateAsyncFileLoader(); test_D3DX11CreateAsyncResourceLoader(); test_D3DX11CompileFromFile(); + test_D3DX11CreateThreadPump(); test_D3DX11GetImageInfoFromMemory(); } diff --git a/include/d3dx11core.idl b/include/d3dx11core.idl index f619e3b1b02..c1f70a58691 100644 --- a/include/d3dx11core.idl +++ b/include/d3dx11core.idl @@ -63,3 +63,5 @@ interface ID3DX11ThreadPump : IUnknown HRESULT PurgeAllItems(); HRESULT GetQueueStatus([in] UINT *io_queue, [in] UINT *process_queue, [in] UINT *device_queue); } + +cpp_quote("HRESULT WINAPI D3DX11CreateThreadPump(UINT, UINT, ID3DX11ThreadPump**);")
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=149335
Your paranoid android.
=== debian11 (32 bit report) ===
d3dx11_43: d3dx11.c:675: Test succeeded inside todo block: GetWorkItemCount returned 0. d3dx11.c:680: Test succeeded inside todo block: Got unexpected device_count 0.
=== debian11 (32 bit ar:MA report) ===
d3dx11_43: d3dx11.c:675: Test succeeded inside todo block: GetWorkItemCount returned 0. d3dx11.c:680: Test succeeded inside todo block: Got unexpected device_count 0.
=== debian11 (32 bit de report) ===
d3dx11_43: d3dx11.c:675: Test succeeded inside todo block: GetWorkItemCount returned 0. d3dx11.c:680: Test succeeded inside todo block: Got unexpected device_count 0.
=== debian11 (32 bit fr report) ===
d3dx11_43: d3dx11.c:675: Test succeeded inside todo block: GetWorkItemCount returned 0. d3dx11.c:680: Test succeeded inside todo block: Got unexpected device_count 0.
=== debian11 (32 bit he:IL report) ===
d3dx11_43: d3dx11.c:675: Test succeeded inside todo block: GetWorkItemCount returned 0. d3dx11.c:680: Test succeeded inside todo block: Got unexpected device_count 0.
=== debian11 (32 bit hi:IN report) ===
d3dx11_43: d3dx11.c:675: Test succeeded inside todo block: GetWorkItemCount returned 0. d3dx11.c:680: Test succeeded inside todo block: Got unexpected device_count 0.
=== debian11 (32 bit ja:JP report) ===
d3dx11_43: d3dx11.c:675: Test succeeded inside todo block: GetWorkItemCount returned 0. d3dx11.c:680: Test succeeded inside todo block: Got unexpected device_count 0.
=== debian11 (32 bit zh:CN report) ===
d3dx11_43: d3dx11.c:675: Test succeeded inside todo block: GetWorkItemCount returned 0. d3dx11.c:680: Test succeeded inside todo block: Got unexpected device_count 0.
=== debian11b (32 bit WoW report) ===
d3dx11_43: d3dx11.c:675: Test succeeded inside todo block: GetWorkItemCount returned 0. d3dx11.c:680: Test succeeded inside todo block: Got unexpected device_count 0.
=== debian11b (64 bit WoW report) ===
d3dx11_42: d3dx11.c:675: Test succeeded inside todo block: GetWorkItemCount returned 0. d3dx11.c:678: Test succeeded inside todo block: Got unexpected io_count 0. d3dx11.c:680: Test succeeded inside todo block: Got unexpected device_count 0.
d3dx11_43: d3dx11.c:675: Test succeeded inside todo block: GetWorkItemCount returned 0. d3dx11.c:678: Test succeeded inside todo block: Got unexpected io_count 0. d3dx11.c:680: Test succeeded inside todo block: Got unexpected device_count 0.