Forspoken checks for the existence of this DLL.
-- v6: d3d12core: Add stub DLL. include/d3d12: Add DirectX 12 Agility SDK definitions.
From: Mohamad Al-Jaf mohamadaljaf@gmail.com
--- include/d3d12.idl | 53 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+)
diff --git a/include/d3d12.idl b/include/d3d12.idl index 082a436c9ec..462d4b77b64 100644 --- a/include/d3d12.idl +++ b/include/d3d12.idl @@ -66,6 +66,7 @@ const UINT D3D12_CONSTANT_BUFFER_DATA_PLACEMENT_ALIGNMENT = 256; const UINT D3D12_DEFAULT_MSAA_RESOURCE_PLACEMENT_ALIGNMENT = 4194304; const UINT D3D12_DEFAULT_RESOURCE_PLACEMENT_ALIGNMENT = 65536; const UINT D3D12_RAW_UAV_SRV_BYTE_ALIGNMENT = 16; +const UINT D3D12_SDK_VERSION = 4; const UINT D3D12_SMALL_MSAA_RESOURCE_PLACEMENT_ALIGNMENT = 65536; const UINT D3D12_SMALL_RESOURCE_PLACEMENT_ALIGNMENT = 4096; const UINT D3D12_STANDARD_MAXIMUM_ELEMENT_ALIGNMENT_BYTE_MULTIPLE = 4; @@ -2589,3 +2590,55 @@ typedef HRESULT (__stdcall *PFN_D3D12_GET_DEBUG_INTERFACE)(REFIID iid, void **de
[local] HRESULT __stdcall D3D12EnableExperimentalFeatures(UINT feature_count, const IID *iids, void *configurations, UINT *configurations_sizes); + +cpp_quote("DEFINE_GUID(CLSID_D3D12Debug, 0xf2352aeb, 0xdd84, 0x49fe, 0xb9, 0x7b, 0xa9, 0xdc, 0xfd, 0xcc, 0x1b, 0x4f);") +cpp_quote("DEFINE_GUID(CLSID_D3D12Tools, 0xe38216b1, 0x3c8c, 0x4833, 0xaa, 0x09, 0x0a, 0x06, 0xb6, 0x5d, 0x96, 0xc8);") +cpp_quote("DEFINE_GUID(CLSID_D3D12DeviceRemovedExtendedData, 0x4a75bbc4, 0x9ff4, 0x4ad8, 0x9f, 0x18, 0xab, 0xae, 0x84, 0xdc, 0x5f, 0xf2);") +cpp_quote("DEFINE_GUID(CLSID_D3D12SDKConfiguration, 0x7cda6aca, 0xa03e, 0x49c8, 0x94, 0x58, 0x03, 0x34, 0xd2, 0x0e, 0x07, 0xce);") + +typedef enum D3D12_DRED_ENABLEMENT +{ + D3D12_DRED_ENABLEMENT_SYSTEM_CONTROLLED = 0, + D3D12_DRED_ENABLEMENT_FORCED_OFF = 1, + D3D12_DRED_ENABLEMENT_FORCED_ON = 2, +} D3D12_DRED_ENABLEMENT; + +typedef HRESULT (__stdcall *PFN_D3D12_GET_INTERFACE)(REFCLSID clsid, REFIID iid, void **debug); + +[local] HRESULT __stdcall D3D12GetInterface(REFCLSID clsid, REFIID iid, void **debug); + +[ + uuid(7071e1f0-e84b-4b33-974f-12fa49de65c5), + object, + local, + pointer_default(unique) +] +interface ID3D12Tools : IUnknown +{ + void EnableShaderInstrumentation(BOOL enable); + BOOL ShaderInstrumentationEnabled(); +} + +[ + uuid(82BC481C-6B9B-4030-AEDB-7EE3D1DF1E63), + object, + local, + pointer_default(unique) +] +interface ID3D12DeviceRemovedExtendedDataSettings : IUnknown +{ + void SetAutoBreadcrumbsEnablement(D3D12_DRED_ENABLEMENT enablement); + void SetPageFaultEnablement(D3D12_DRED_ENABLEMENT enablement); + void SetWatsonDumpEnablement(D3D12_DRED_ENABLEMENT enablement); +}; + +[ + uuid(e9eb5314-33aa-42b2-a718-d77f58b1f1c7), + object, + local, + pointer_default(unique) +] +interface ID3D12SDKConfiguration : IUnknown +{ + HRESULT SetSDKVersion(UINT version, const char *path); +}
From: Mohamad Al-Jaf mohamadaljaf@gmail.com
Forspoken checks for the existence of this DLL. --- MAINTAINERS | 1 + configure.ac | 2 + dlls/d3d12core/Makefile.in | 8 ++++ dlls/d3d12core/d3d12core.spec | 2 + dlls/d3d12core/main.c | 30 ++++++++++++++ dlls/d3d12core/tests/Makefile.in | 5 +++ dlls/d3d12core/tests/d3d12core.c | 68 ++++++++++++++++++++++++++++++++ dlls/d3d12core/version.rc | 26 ++++++++++++ 8 files changed, 142 insertions(+) create mode 100644 dlls/d3d12core/Makefile.in create mode 100644 dlls/d3d12core/d3d12core.spec create mode 100644 dlls/d3d12core/main.c create mode 100644 dlls/d3d12core/tests/Makefile.in create mode 100644 dlls/d3d12core/tests/d3d12core.c create mode 100644 dlls/d3d12core/version.rc
diff --git a/MAINTAINERS b/MAINTAINERS index 276471287da..49d88dc0cb3 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -72,6 +72,7 @@ P: Matteo Bruni mbruni@codeweavers.com F: dlls/d3d10core/ F: dlls/d3d11/ F: dlls/d3d12/ +F: dlls/d3d12core/ F: dlls/d3d8/ F: dlls/d3d9/ F: dlls/d3drm/ diff --git a/configure.ac b/configure.ac index 9ff7c5e8914..42c5a4f8071 100644 --- a/configure.ac +++ b/configure.ac @@ -2432,6 +2432,8 @@ WINE_CONFIG_MAKEFILE(dlls/d3d11) WINE_CONFIG_MAKEFILE(dlls/d3d11/tests) WINE_CONFIG_MAKEFILE(dlls/d3d12) WINE_CONFIG_MAKEFILE(dlls/d3d12/tests) +WINE_CONFIG_MAKEFILE(dlls/d3d12core) +WINE_CONFIG_MAKEFILE(dlls/d3d12core/tests) WINE_CONFIG_MAKEFILE(dlls/d3d8) WINE_CONFIG_MAKEFILE(dlls/d3d8/tests) WINE_CONFIG_MAKEFILE(dlls/d3d8thk) diff --git a/dlls/d3d12core/Makefile.in b/dlls/d3d12core/Makefile.in new file mode 100644 index 00000000000..61f169c3972 --- /dev/null +++ b/dlls/d3d12core/Makefile.in @@ -0,0 +1,8 @@ +MODULE = d3d12core.dll +IMPORTLIB = d3d12core + +C_SRCS = \ + main.c + +RC_SRCS = \ + version.rc diff --git a/dlls/d3d12core/d3d12core.spec b/dlls/d3d12core/d3d12core.spec new file mode 100644 index 00000000000..7ce10bdf8b5 --- /dev/null +++ b/dlls/d3d12core/d3d12core.spec @@ -0,0 +1,2 @@ +@ stdcall D3D12GetInterface(ptr ptr ptr) +@ extern D3D12SDKVersion diff --git a/dlls/d3d12core/main.c b/dlls/d3d12core/main.c new file mode 100644 index 00000000000..b556e3b4410 --- /dev/null +++ b/dlls/d3d12core/main.c @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2023 Mohamad Al-Jaf + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "wine/debug.h" +#include "d3d12.h" + +WINE_DEFAULT_DEBUG_CHANNEL(d3d12core); + +HRESULT WINAPI D3D12GetInterface( REFCLSID clsid, REFIID iid, void **debug ) +{ + FIXME( "clsid %s, iid %s, debug %p stub!\n", debugstr_guid(clsid), debugstr_guid(iid), debug ); + return DXGI_ERROR_SDK_COMPONENT_MISSING; +} + +const UINT D3D12SDKVersion = D3D12_SDK_VERSION; diff --git a/dlls/d3d12core/tests/Makefile.in b/dlls/d3d12core/tests/Makefile.in new file mode 100644 index 00000000000..a7e83d94dcf --- /dev/null +++ b/dlls/d3d12core/tests/Makefile.in @@ -0,0 +1,5 @@ +TESTDLL = d3d12core.dll +IMPORTS = d3d12core + +C_SRCS = \ + d3d12core.c diff --git a/dlls/d3d12core/tests/d3d12core.c b/dlls/d3d12core/tests/d3d12core.c new file mode 100644 index 00000000000..9e3237207fd --- /dev/null +++ b/dlls/d3d12core/tests/d3d12core.c @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2023 Mohamad Al-Jaf + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "initguid.h" +#include "d3d12.h" +#include "d3d12sdklayers.h" +#include "wine/test.h" + +static void test_D3D12GetInterface(void) +{ + ID3D12DeviceRemovedExtendedDataSettings *settings; + ID3D12SDKConfiguration *config; + ID3D12Tools *tools; + ID3D12Debug *debug; + HRESULT hr; + + /* Error handling */ + + hr = D3D12GetInterface( &CLSID_D3D12Debug, &IID_ID3D12Debug, NULL ); + ok( hr == DXGI_ERROR_SDK_COMPONENT_MISSING, "Unexpected hr %#lx.\n", hr ); + + hr = D3D12GetInterface( &CLSID_D3D12Debug, NULL, (void **)&debug ); + ok( hr == DXGI_ERROR_SDK_COMPONENT_MISSING, "Unexpected hr %#lx.\n", hr ); + + hr = D3D12GetInterface( &CLSID_D3D12DeviceRemovedExtendedData, &IID_ID3D12DeviceRemovedExtendedDataSettings, NULL ); + todo_wine ok( hr == S_FALSE, "Unexpected hr %#lx.\n", hr ); + + if (0) /* Crashes on Windows */ + { + hr = D3D12GetInterface( NULL, &IID_ID3D12Debug, (void **)&debug ); + hr = D3D12GetInterface( &CLSID_D3D12DeviceRemovedExtendedData, NULL, (void **)&settings ); + hr = D3D12GetInterface( &CLSID_D3D12DeviceRemovedExtendedData, &IID_ID3D12DeviceRemovedExtendedDataSettings, (void **)0xdeadbeef ); + } + + /* Expected behavior */ + + hr = D3D12GetInterface( &CLSID_D3D12Debug, &IID_ID3D12Debug, (void **)&debug ); + ok( hr == DXGI_ERROR_SDK_COMPONENT_MISSING, "Unexpected hr %#lx.\n", hr ); + + hr = D3D12GetInterface( &CLSID_D3D12Tools, &IID_ID3D12Tools, (void **)&tools ); + todo_wine ok( hr == E_NOINTERFACE, "Unexpected hr %#lx.\n", hr ); + + hr = D3D12GetInterface( &CLSID_D3D12SDKConfiguration, &IID_ID3D12SDKConfiguration, (void **)&config ); + todo_wine ok( hr == E_NOINTERFACE, "Unexpected hr %#lx.\n", hr ); + + hr = D3D12GetInterface( &CLSID_D3D12DeviceRemovedExtendedData, &IID_ID3D12DeviceRemovedExtendedDataSettings, (void **)&settings ); + todo_wine ok( hr == S_OK, "Unexpected hr %#lx.\n", hr ); +} + +START_TEST(d3d12core) +{ + test_D3D12GetInterface(); +} diff --git a/dlls/d3d12core/version.rc b/dlls/d3d12core/version.rc new file mode 100644 index 00000000000..9e0f540e7d9 --- /dev/null +++ b/dlls/d3d12core/version.rc @@ -0,0 +1,26 @@ +/* + * Copyright (C) 2023 Mohamad Al-Jaf + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#define WINE_FILEDESCRIPTION_STR "Wine Direct3D 12 Core Runtime" +#define WINE_FILENAME_STR "d3d12core.dll" +#define WINE_FILEVERSION 10,0,18363,1350 +#define WINE_FILEVERSION_STR "10.0.18363.1350" +#define WINE_PRODUCTVERSION 10,0,18363,1350 +#define WINE_PRODUCTVERSION_STR "10.0.18363.1350" + +#include "wine/wine_common_ver.rc"
On Wed Feb 1 03:55:40 2023 +0000, Zebediah Figura wrote:
+DECLSPEC_EXPORT const UINT D3D12SDKVersion = D3D12_SDK_VERSION;
We don't use DECLSPEC_EXPORT.
+@ cdecl D3D12SDKVersion()
This is wrong, it should be "@ extern D3D12SDKVersion". This is one reason to avoid implementing features until they're needed.
I didn't know extern was a valid type, is there a list of types that can be used in spec files?
I understand that Wine doesn't implement functions that are not known to be called, but isn't that just for modules which are supposed to be used by applications? To me, it doesn't seem correct to add a completely empty module whose exports are supposed to be used internally. Clarification on this would be appreciated, I'd rather not waste not only my time but also yours with pointless work.