[PATCH v3 0/1] MR5357: d3dcompiler: Add D3DX11CreateThreadPump stub.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=56176 -- v3: d3dcompiler: Add D3DX11CreateThreadPump stub. https://gitlab.winehq.org/wine/wine/-/merge_requests/5357
From: Vijay Kiran Kamuju <infyquest(a)gmail.com> Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=56176 --- dlls/d3dx11_42/d3dx11_42.spec | 2 +- dlls/d3dx11_43/async.c | 124 ++++++++++++++++++++++++++++++++++ dlls/d3dx11_43/d3dx11_43.spec | 2 +- dlls/d3dx11_43/tests/d3dx11.c | 101 +++++++++++++++++++++++++++ include/d3dx11core.idl | 3 + 5 files changed, 230 insertions(+), 2 deletions(-) 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_43/async.c b/dlls/d3dx11_43/async.c index 074a8529e4e..139561ce46e 100644 --- a/dlls/d3dx11_43/async.c +++ b/dlls/d3dx11_43/async.c @@ -409,3 +409,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/d3dx11.c b/dlls/d3dx11_43/tests/d3dx11.c index c35f12bf836..cb2a98ad526 100644 --- a/dlls/d3dx11_43/tests/d3dx11.c +++ b/dlls/d3dx11_43/tests/d3dx11.c @@ -651,6 +651,106 @@ static void test_D3DX11CompileFromFile(void) delete_directory(L"include"); } +static HRESULT WINAPI D3DX11ThreadPump_QueryInterface(ID3DX11ThreadPump *iface, REFIID riid, void **out) +{ + ok(0, "unexpected call\n"); + return E_NOTIMPL; +} + +static ULONG WINAPI D3DX11ThreadPump_AddRef(ID3DX11ThreadPump *iface) +{ + return 2; +} + +static ULONG WINAPI D3DX11ThreadPump_Release(ID3DX11ThreadPump *iface) +{ + return 1; +} + +static int add_work_item_count = 1; + +static HRESULT WINAPI D3DX11ThreadPump_AddWorkItem(ID3DX11ThreadPump *iface, ID3DX11DataLoader *loader, + ID3DX11DataProcessor *processor, HRESULT *result, void **object) +{ + ok(0, "unexpected call\n"); + return E_NOTIMPL;} + +static UINT WINAPI D3DX11ThreadPump_GetWorkItemCount(ID3DX11ThreadPump *iface) +{ + ok(0, "unexpected call\n"); + return 0; +} + +static HRESULT WINAPI D3DX11ThreadPump_WaitForAllItems(ID3DX11ThreadPump *iface) +{ + ok(0, "unexpected call\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI D3DX11ThreadPump_ProcessDeviceWorkItems(ID3DX11ThreadPump *iface, UINT count) +{ + ok(0, "unexpected call\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI D3DX11ThreadPump_PurgeAllItems(ID3DX11ThreadPump *iface) +{ + ok(0, "unexpected call\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI D3DX11ThreadPump_GetQueueStatus(ID3DX11ThreadPump *iface, UINT *queue, + UINT *processqueue, UINT *devicequeue) +{ + ok(0, "unexpected call\n"); + return E_NOTIMPL; +} + +static ID3DX11ThreadPumpVtbl D3DX11ThreadPumpVtbl = +{ + D3DX11ThreadPump_QueryInterface, + D3DX11ThreadPump_AddRef, + D3DX11ThreadPump_Release, + D3DX11ThreadPump_AddWorkItem, + D3DX11ThreadPump_GetWorkItemCount, + D3DX11ThreadPump_WaitForAllItems, + D3DX11ThreadPump_ProcessDeviceWorkItems, + D3DX11ThreadPump_PurgeAllItems, + D3DX11ThreadPump_GetQueueStatus +}; +static ID3DX11ThreadPump thread_pump = { &D3DX11ThreadPumpVtbl }; + +static void test_D3DX11CreateThreadPump(void) +{ + UINT io_count, process_count, device_count, count; + HRESULT hr; + ID3DX11ThreadPump *pump; + SYSTEM_INFO info; + + 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 +1124,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..66c99f3162b 100644 --- a/include/d3dx11core.idl +++ b/include/d3dx11core.idl @@ -63,3 +63,6 @@ interface ID3DX11ThreadPump : IUnknown HRESULT PurgeAllItems(); HRESULT GetQueueStatus([in] UINT *io_queue, [in] UINT *process_queue, [in] UINT *device_queue); } + +cpp_quote("HRESULT WINAPI D3DX11CheckVersion(UINT, UINT);") +cpp_quote("HRESULT WINAPI D3DX11CreateThreadPump(UINT, UINT, ID3DX11ThreadPump**);") -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/5357
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 full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=144253 Your paranoid android. === build (build log) === ../wine/dlls/d3dx11_43/tests/d3dx11.c:750:5: error: ���ret��� undeclared (first use in this function) ../wine/dlls/d3dx11_43/tests/d3dx11.c:750:5: error: ���ret��� undeclared (first use in this function) Task: The exe32 Wine build failed === debian11 (build log) === ../wine/dlls/d3dx11_43/tests/d3dx11.c:750:5: error: ���ret��� undeclared (first use in this function) ../wine/dlls/d3dx11_43/main.c:36:13: error: conflicting types for ���D3DX11CheckVersion��� ../wine/dlls/d3dx11_43/main.c:36:13: error: conflicting types for ���D3DX11CheckVersion��� ../wine/dlls/d3dx11_43/tests/d3dx11.c:750:5: error: ���ret��� undeclared (first use in this function) Task: The win32 Wine build failed === debian11b (build log) === ../wine/dlls/d3dx11_43/main.c:36:13: error: conflicting types for ���D3DX11CheckVersion��� ../wine/dlls/d3dx11_43/main.c:36:13: error: conflicting types for ���D3DX11CheckVersion��� ../wine/dlls/d3dx11_43/tests/d3dx11.c:750:5: error: ���ret��� undeclared (first use in this function) ../wine/dlls/d3dx11_43/tests/d3dx11.c:750:5: error: ���ret��� undeclared (first use in this function) Task: The wow64 Wine build failed
Also we need to convert d3dx11core.idl to d3dx11core.h as it causes compile issues. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/5357#note_65608
participants (3)
-
Marvin -
Vijay Kiran Kamuju -
Vijay Kiran Kamuju (@infyquest)