This repository has been archived on 2024-09-25. You can view files and clone it, but cannot push or open issues or pull requests.
overlay/app-emulation/dxvk/files/1.5.4-fix_compilation_with_wine-5.2.patch

247 lines
9.6 KiB
Diff
Raw Normal View History

From 74d23c22dea0445d33345de36a1cc7ee531f94d5 Mon Sep 17 00:00:00 2001
From: Joshua Ashton <joshua@froggi.es>
Date: Tue, 18 Feb 2020 19:03:18 +0000
Subject: [PATCH] [build] Use __CRT_UUID_DECL for uuid definitions
Closes #1463
---
src/d3d10/d3d10_interfaces.h | 9 +++++++++
src/d3d10/d3d10_state_block.cpp | 5 +----
src/d3d10/d3d10_state_block.h | 3 +--
src/d3d11/d3d11_interfaces.h | 8 ++------
src/dxgi/dxgi_interfaces.h | 32 ++++++++------------------------
src/util/com/com_guid.cpp | 11 -----------
src/util/com/com_guid.h | 10 ----------
7 files changed, 21 insertions(+), 57 deletions(-)
create mode 100644 src/d3d10/d3d10_interfaces.h
diff --git a/src/d3d10/d3d10_interfaces.h b/src/d3d10/d3d10_interfaces.h
new file mode 100644
index 000000000..aa028ab57
--- /dev/null
+++ b/src/d3d10/d3d10_interfaces.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#include "d3d10_include.h"
+
+#ifdef _MSC_VER
+struct __declspec(uuid("0803425a-57f5-4dd6-9465-a87570834a08")) ID3D10StateBlock;
+#else
+__CRT_UUID_DECL(ID3D10StateBlock, 0x0803425a,0x57f5,0x4dd6,0x94,0x65,0xa8,0x75,0x70,0x83,0x4a,0x08);
+#endif
diff --git a/src/d3d10/d3d10_state_block.cpp b/src/d3d10/d3d10_state_block.cpp
index 028d4e0fb..af628eb46 100644
--- a/src/d3d10/d3d10_state_block.cpp
+++ b/src/d3d10/d3d10_state_block.cpp
@@ -31,9 +31,6 @@ namespace dxvk {
MAKE_STATE_TYPE(Predication, 1),
}};
- // MinGW fails on __uuidof(ID3D10StateBlock), winelib builds fail to link
- const GUID D3D10StateBlock::guid = {0x0803425a,0x57f5,0x4dd6,{0x94,0x65,0xa8,0x75,0x70,0x83,0x4a,0x08}};
-
D3D10StateBlock::D3D10StateBlock(
ID3D10Device* pDevice,
@@ -57,7 +54,7 @@ namespace dxvk {
*ppvObject = nullptr;
if (riid == __uuidof(IUnknown)
- || riid == D3D10StateBlock::guid) {
+ || riid == __uuidof(ID3D10StateBlock)) {
*ppvObject = ref(this);
return S_OK;
}
diff --git a/src/d3d10/d3d10_state_block.h b/src/d3d10/d3d10_state_block.h
index 4f99165e4..b899034d5 100644
--- a/src/d3d10/d3d10_state_block.h
+++ b/src/d3d10/d3d10_state_block.h
@@ -1,6 +1,7 @@
#pragma once
#include "d3d10_include.h"
+#include "d3d10_interfaces.h"
namespace dxvk {
@@ -47,8 +48,6 @@ namespace dxvk {
class D3D10StateBlock : public ComObject<ID3D10StateBlock> {
public:
- static const GUID guid;
-
D3D10StateBlock(
ID3D10Device* pDevice,
const D3D10_STATE_BLOCK_MASK* pMask);
diff --git a/src/d3d11/d3d11_interfaces.h b/src/d3d11/d3d11_interfaces.h
index ba870d160..42b319a78 100644
--- a/src/d3d11/d3d11_interfaces.h
+++ b/src/d3d11/d3d11_interfaces.h
@@ -32,8 +32,6 @@ enum D3D11_VK_BARRIER_CONTROL : uint32_t {
*/
MIDL_INTERFACE("8a6e3c42-f74c-45b7-8265-a231b677ca17")
ID3D11VkExtDevice : public IUnknown {
- static const GUID guid;
-
/**
* \brief Checks whether an extension is supported
*
@@ -54,8 +52,6 @@ ID3D11VkExtDevice : public IUnknown {
*/
MIDL_INTERFACE("fd0bca13-5cb6-4c3a-987e-4750de2ca791")
ID3D11VkExtContext : public IUnknown {
- static const GUID guid;
-
virtual void STDMETHODCALLTYPE MultiDrawIndirect(
UINT DrawCount,
ID3D11Buffer* pBufferForArgs,
@@ -98,6 +94,6 @@ ID3D11VkExtContext : public IUnknown {
struct __declspec(uuid("8a6e3c42-f74c-45b7-8265-a231b677ca17")) ID3D11VkExtDevice;
struct __declspec(uuid("fd0bca13-5cb6-4c3a-987e-4750de2ca791")) ID3D11VkExtContext;
#else
-DXVK_DEFINE_GUID(ID3D11VkExtDevice);
-DXVK_DEFINE_GUID(ID3D11VkExtContext);
+__CRT_UUID_DECL(ID3D11VkExtDevice, 0x8a6e3c42,0xf74c,0x45b7,0x82,0x65,0xa2,0x31,0xb6,0x77,0xca,0x17);
+__CRT_UUID_DECL(ID3D11VkExtContext, 0xfd0bca13,0x5cb6,0x4c3a,0x98,0x7e,0x47,0x50,0xde,0x2c,0xa7,0x91);
#endif
diff --git a/src/dxgi/dxgi_interfaces.h b/src/dxgi/dxgi_interfaces.h
index 06c969574..02cec1fea 100644
--- a/src/dxgi/dxgi_interfaces.h
+++ b/src/dxgi/dxgi_interfaces.h
@@ -36,8 +36,6 @@ struct DXGI_VK_MONITOR_DATA {
*/
MIDL_INTERFACE("104001a6-7f36-4957-b932-86ade9567d91")
IDXGIVkSwapChain : public IUnknown {
- static const GUID guid;
-
virtual HRESULT STDMETHODCALLTYPE GetDesc(
DXGI_SWAP_CHAIN_DESC1* pDesc) = 0;
@@ -89,8 +87,6 @@ IDXGIVkSwapChain : public IUnknown {
*/
MIDL_INTERFACE("907bf281-ea3c-43b4-a8e4-9f231107b4ff")
IDXGIDXVKAdapter : public IDXGIAdapter3 {
- static const GUID guid;
-
virtual dxvk::Rc<dxvk::DxvkAdapter> STDMETHODCALLTYPE GetDXVKAdapter() = 0;
virtual dxvk::Rc<dxvk::DxvkInstance> STDMETHODCALLTYPE GetDXVKInstance() = 0;
@@ -103,8 +99,6 @@ IDXGIDXVKAdapter : public IDXGIAdapter3 {
*/
MIDL_INTERFACE("92a5d77b-b6e1-420a-b260-fdd701272827")
IDXGIDXVKDevice : public IUnknown {
- static const GUID guid;
-
virtual void STDMETHODCALLTYPE SetAPIVersion(
UINT Version) = 0;
@@ -122,8 +116,6 @@ IDXGIDXVKDevice : public IUnknown {
*/
MIDL_INTERFACE("c06a236f-5be3-448a-8943-89c611c0c2c1")
IDXGIVkMonitorInfo : public IUnknown {
- static const GUID guid;
-
/**
* \brief Initializes monitor data
*
@@ -167,8 +159,6 @@ IDXGIVkMonitorInfo : public IUnknown {
*/
MIDL_INTERFACE("5546cf8c-77e7-4341-b05d-8d4d5000e77d")
IDXGIVkInteropSurface : public IUnknown {
- static const GUID guid;
-
/**
* \brief Retrieves device interop interfaceSlots
*
@@ -225,8 +215,6 @@ IDXGIVkInteropSurface : public IUnknown {
*/
MIDL_INTERFACE("e2ef5fa5-dc21-4af7-90c4-f67ef6a09323")
IDXGIVkInteropDevice : public IUnknown {
- static const GUID guid;
-
/**
* \brief Queries Vulkan handles used by DXVK
*
@@ -308,8 +296,6 @@ IDXGIVkInteropDevice : public IUnknown {
*/
MIDL_INTERFACE("3a6d8f2c-b0e8-4ab4-b4dc-4fd24891bfa5")
IDXGIVkInteropAdapter : public IUnknown {
- static const GUID guid;
-
/**
* \brief Queries Vulkan handles used by DXVK
*
@@ -330,8 +316,6 @@ IDXGIVkInteropAdapter : public IUnknown {
*/
MIDL_INTERFACE("53cb4ff0-c25a-4164-a891-0e83db0a7aac")
IWineDXGISwapChainFactory : public IUnknown {
- static const GUID guid;
-
virtual HRESULT STDMETHODCALLTYPE CreateSwapChainForHwnd(
IDXGIFactory* pFactory,
HWND hWnd,
@@ -352,12 +336,12 @@ struct __declspec(uuid("5546cf8c-77e7-4341-b05d-8d4d5000e77d")) IDXGIVkInteropSu
struct __declspec(uuid("104001a6-7f36-4957-b932-86ade9567d91")) IDXGIVkSwapChain;
struct __declspec(uuid("53cb4ff0-c25a-4164-a891-0e83db0a7aac")) IWineDXGISwapChainFactory;
#else
-DXVK_DEFINE_GUID(IDXGIDXVKAdapter);
-DXVK_DEFINE_GUID(IDXGIDXVKDevice);
-DXVK_DEFINE_GUID(IDXGIVkMonitorInfo);
-DXVK_DEFINE_GUID(IDXGIVkInteropAdapter);
-DXVK_DEFINE_GUID(IDXGIVkInteropDevice);
-DXVK_DEFINE_GUID(IDXGIVkInteropSurface);
-DXVK_DEFINE_GUID(IDXGIVkSwapChain);
-DXVK_DEFINE_GUID(IWineDXGISwapChainFactory);
+__CRT_UUID_DECL(IDXGIDXVKAdapter, 0x907bf281,0xea3c,0x43b4,0xa8,0xe4,0x9f,0x23,0x11,0x07,0xb4,0xff);
+__CRT_UUID_DECL(IDXGIDXVKDevice, 0x92a5d77b,0xb6e1,0x420a,0xb2,0x60,0xfd,0xf7,0x01,0x27,0x28,0x27);
+__CRT_UUID_DECL(IDXGIVkMonitorInfo, 0xc06a236f,0x5be3,0x448a,0x89,0x43,0x89,0xc6,0x11,0xc0,0xc2,0xc1);
+__CRT_UUID_DECL(IDXGIVkInteropAdapter, 0x3a6d8f2c,0xb0e8,0x4ab4,0xb4,0xdc,0x4f,0xd2,0x48,0x91,0xbf,0xa5);
+__CRT_UUID_DECL(IDXGIVkInteropDevice, 0xe2ef5fa5,0xdc21,0x4af7,0x90,0xc4,0xf6,0x7e,0xf6,0xa0,0x93,0x23);
+__CRT_UUID_DECL(IDXGIVkInteropSurface, 0x5546cf8c,0x77e7,0x4341,0xb0,0x5d,0x8d,0x4d,0x50,0x00,0xe7,0x7d);
+__CRT_UUID_DECL(IDXGIVkSwapChain, 0x104001a6,0x7f36,0x4957,0xb9,0x32,0x86,0xad,0xe9,0x56,0x7d,0x91);
+__CRT_UUID_DECL(IWineDXGISwapChainFactory, 0x53cb4ff0,0xc25a,0x4164,0xa8,0x91,0x0e,0x83,0xdb,0x0a,0x7a,0xac);
#endif
\ No newline at end of file
diff --git a/src/util/com/com_guid.cpp b/src/util/com/com_guid.cpp
index 0410c4ad5..329d18488 100644
--- a/src/util/com/com_guid.cpp
+++ b/src/util/com/com_guid.cpp
@@ -4,17 +4,6 @@
#include "../../dxgi/dxgi_interfaces.h"
-const GUID ID3D11VkExtDevice::guid = {0x8a6e3c42,0xf74c,0x45b7,{0x82,0x65,0xa2,0x31,0xb6,0x77,0xca,0x17}};
-const GUID ID3D11VkExtContext::guid = {0xfd0bca13,0x5cb6,0x4c3a,{0x98,0x7e,0x47,0x50,0xde,0x2c,0xa7,0x91}};
-const GUID IDXGIDXVKAdapter::guid = {0x907bf281,0xea3c,0x43b4,{0xa8,0xe4,0x9f,0x23,0x11,0x07,0xb4,0xff}};
-const GUID IDXGIDXVKDevice::guid = {0x92a5d77b,0xb6e1,0x420a,{0xb2,0x60,0xfd,0xf7,0x01,0x27,0x28,0x27}};
-const GUID IDXGIVkMonitorInfo::guid = {0xc06a236f,0x5be3,0x448a,{0x89,0x43,0x89,0xc6,0x11,0xc0,0xc2,0xc1}};
-const GUID IDXGIVkInteropAdapter::guid = {0x3a6d8f2c,0xb0e8,0x4ab4,{0xb4,0xdc,0x4f,0xd2,0x48,0x91,0xbf,0xa5}};
-const GUID IDXGIVkInteropDevice::guid = {0xe2ef5fa5,0xdc21,0x4af7,{0x90,0xc4,0xf6,0x7e,0xf6,0xa0,0x93,0x23}};
-const GUID IDXGIVkInteropSurface::guid = {0x5546cf8c,0x77e7,0x4341,{0xb0,0x5d,0x8d,0x4d,0x50,0x00,0xe7,0x7d}};
-const GUID IDXGIVkSwapChain::guid = {0x104001a6,0x7f36,0x4957,{0xb9,0x32,0x86,0xad,0xe9,0x56,0x7d,0x91}};
-const GUID IWineDXGISwapChainFactory::guid = {0x53cb4ff0,0xc25a,0x4164,{0xa8,0x91,0x0e,0x83,0xdb,0x0a,0x7a,0xac}};
-
std::ostream& operator << (std::ostream& os, REFIID guid) {
os << std::hex << std::setfill('0')
<< std::setw(8) << guid.Data1 << '-';
diff --git a/src/util/com/com_guid.h b/src/util/com/com_guid.h
index d1f6b01d1..9a69fc932 100644
--- a/src/util/com/com_guid.h
+++ b/src/util/com/com_guid.h
@@ -5,14 +5,4 @@
#include "com_include.h"
-#ifndef _MSC_VER
-# ifdef __WINE__
-# define DXVK_DEFINE_GUID(iface) \
- template<> inline GUID const& __wine_uuidof<iface> () { return iface::guid; }
-# else
-# define DXVK_DEFINE_GUID(iface) \
- template<> inline GUID const& __mingw_uuidof<iface> () { return iface::guid; }
-# endif
-#endif
-
std::ostream& operator << (std::ostream& os, REFIID guid);