diff --git a/patches/nvcuda-CUDA_Support/0012-nvcuda-Add-semi-stub-for-cuD3D11GetDevice-and-cuGrap.patch b/patches/nvcuda-CUDA_Support/0012-nvcuda-Add-semi-stub-for-cuD3D11GetDevice-and-cuGrap.patch new file mode 100644 index 00000000..ad1b1b36 --- /dev/null +++ b/patches/nvcuda-CUDA_Support/0012-nvcuda-Add-semi-stub-for-cuD3D11GetDevice-and-cuGrap.patch @@ -0,0 +1,76 @@ +From 807f2b26083148f194dbc90887174a0f70921d88 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Sveinar=20S=C3=B8pler?= +Date: Mon, 26 Jul 2021 14:59:18 +0200 +Subject: [PATCH] nvcuda Add semi-stub for cuD3D11GetDevice and + cuGraphicsD3D11RegisterResource + +This will make Batman Arkham Knight work with interactive smoke/fog +and interactive debris +Requires: Tested with nVidia PhysX 9.19 +--- + dlls/nvcuda/nvcuda.c | 19 +++++++++++++++++++ + dlls/nvcuda/nvcuda.spec | 4 ++-- + 2 files changed, 21 insertions(+), 2 deletions(-) + +diff --git a/dlls/nvcuda/nvcuda.c b/dlls/nvcuda/nvcuda.c +index 1ffcb341518..184784c7004 100644 +--- a/dlls/nvcuda/nvcuda.c ++++ b/dlls/nvcuda/nvcuda.c +@@ -37,6 +37,7 @@ + #include "nvcuda.h" + #include "d3d9.h" + #include "dxgi.h" ++#include "d3d11.h" + + #if defined(__x86_64) || defined(AMD64) || defined(_M_AMD64) + #define DEV_PTR "%llu" +@@ -2941,6 +2942,24 @@ CUresult WINAPI wine_cuD3D10GetDevice(CUdevice *pCudaDevice, IDXGIAdapter *pAdap + return pcuDeviceGet(pCudaDevice, 0); + } + ++CUresult WINAPI wine_cuD3D11GetDevice(CUdevice *pCudaDevice, IDXGIAdapter *pAdapter) ++{ ++ FIXME("(%p, %p) - semi-stub\n", pCudaDevice, pAdapter); ++ /* DXGI adapters don't have an OpenGL context assigned yet, otherwise we could use cuGLGetDevices */ ++ return pcuDeviceGet(pCudaDevice, 0); ++} ++ ++CUresult WINAPI wine_cuGraphicsD3D11RegisterResource(CUgraphicsResource *pCudaResource, ID3D11Resource *pD3DResource, unsigned int Flags) ++{ ++ TRACE("(%p, %p, %u) - semi-stub\n", pCudaResource, pD3DResource, Flags); ++ /* Not able to handle spesific flags at this time */ ++ if(Flags > 0) ++ return CUDA_ERROR_INVALID_VALUE; ++ ++ /* pD3D11Resource is unknown at this time and cannot be "registered" */ ++ return CUDA_ERROR_UNKNOWN; ++} ++ + BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved) + { + TRACE("(%p, %u, %p)\n", instance, reason, reserved); +diff --git a/dlls/nvcuda/nvcuda.spec b/dlls/nvcuda/nvcuda.spec +index 4a06881f0b5..70bcc6db833 100644 +--- a/dlls/nvcuda/nvcuda.spec ++++ b/dlls/nvcuda/nvcuda.spec +@@ -54,7 +54,7 @@ + @ stub cuD3D11CtxCreate + @ stub cuD3D11CtxCreateOnDevice + @ stub cuD3D11CtxCreate_v2 +-@ stub cuD3D11GetDevice ++@ stdcall cuD3D11GetDevice(ptr ptr) wine_cuD3D11GetDevice + @ stub cuD3D11GetDevices + @ stub cuD3D11GetDirect3DDevice + @ stub cuD3D9Begin +@@ -125,7 +125,7 @@ + @ stdcall cuGetErrorString(long ptr) wine_cuGetErrorString + @ stdcall cuGetExportTable(ptr ptr) wine_cuGetExportTable + @ stub cuGraphicsD3D10RegisterResource +-@ stub cuGraphicsD3D11RegisterResource ++@ stdcall cuGraphicsD3D11RegisterResource(ptr ptr long) wine_cuGraphicsD3D11RegisterResource + @ stub cuGraphicsD3D9RegisterResource + @ stdcall cuGraphicsGLRegisterBuffer(ptr long long) wine_cuGraphicsGLRegisterBuffer + @ stdcall cuGraphicsGLRegisterImage(ptr long long long) wine_cuGraphicsGLRegisterImage +-- +2.30.2 + diff --git a/patches/nvcuda-CUDA_Support/definition b/patches/nvcuda-CUDA_Support/definition index 05247b37..fca4b941 100644 --- a/patches/nvcuda-CUDA_Support/definition +++ b/patches/nvcuda-CUDA_Support/definition @@ -1,2 +1,3 @@ Fixes: Basic support for CUDA Fixes: [37664] MediaCoder needs CUDA for video encoding +Fixes: [51523] Add cuD3D11GetDevice and cuGraphicsD3D11RegisterResource stubs diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 3cde2e9e..39b7b896 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -2828,6 +2828,7 @@ fi # | # | This patchset fixes the following Wine bugs: # | * [#37664] MediaCoder needs CUDA for video encoding +# | * [#51523] Add cuD3D11GetDevice and cuGraphicsD3D11RegisterResource stubs # | # | Modified files: # | * configure.ac, dlls/nvcuda/Makefile.in, dlls/nvcuda/internal.c, dlls/nvcuda/nvcuda.c, dlls/nvcuda/nvcuda.h, @@ -2846,6 +2847,7 @@ if test "$enable_nvcuda_CUDA_Support" -eq 1; then patch_apply nvcuda-CUDA_Support/0009-nvcuda-Implement-cuModuleLoad-wrapper-function.patch patch_apply nvcuda-CUDA_Support/0010-nvcuda-Search-for-dylib-library-on-Mac-OS-X.patch patch_apply nvcuda-CUDA_Support/0011-nvcuda-Add-semi-stub-for-cuD3D10GetDevice.patch + patch_apply nvcuda-CUDA_Support/0012-nvcuda-Add-semi-stub-for-cuD3D11GetDevice-and-cuGrap.patch fi # Patchset nvapi-Stub_DLL