1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-02-10 07:54:38 +01:00
dxvk/src/d3d9/d3d9_include.h

108 lines
3.0 KiB
C
Raw Normal View History

#pragma once
#ifndef _MSC_VER
#ifdef _WIN32_WINNT
#undef _WIN32_WINNT
#endif
#define _WIN32_WINNT 0x0A00
#endif
#include <stdint.h>
#include <d3d9.h>
//for some reason we need to specify __declspec(dllexport) for MinGW
#if defined(__WINE__) || !defined(_WIN32)
build: Disable stdcall alias-ing and use kill-at Disable stdcall aliasing and enable kill-at to ensure our exported functions don't have the @8, @40, etc suffixes. This still keeps `--enable-stdcall-fixup` as otherwise the linker can get confused trying to find exports from the .def. This does not result in aliases being added, just for them to be found to add to the export table. This also switches d3d11 to use the MinGW provided dxgi.lib for linking and d3d10 to use the MinGW provided d3d11.lib for linking. Unfortunately the .a's we output seem to still have the @blah that we killed so we cannot use them for internal linkage since using kill-at. Tested that what we get out of MinGW now is what we want with dllexp. Supercedes: #3590 Exports ``` ➜ build git:(master) ✗ winedump -j export src/dxgi/dxgi.dll Contents of src/dxgi/dxgi.dll: 129505860 bytes Name: DXGI.DLL Characteristics: 00000000 TimeDateStamp: 64C97A2D Tue Aug 1 22:33:33 2023 Version: 0.00 Ordinal base: 9 # of functions: 9 # of Names: 5 Addresses of functions: 00423028 Addresses of name ordinals: 00423060 Addresses of names: 0042304C Entry Pt Ordn Name 00007C17 9 CreateDXGIFactory 00007BF3 10 CreateDXGIFactory1 00007B62 11 CreateDXGIFactory2 00007C3B 16 DXGIDeclareAdapterRemovalSupport 00007CD8 17 DXGIGetDebugInterface1 Done dumping src/dxgi/dxgi.dll ``` ``` ➜ build git:(fix-stdcall-32-bit) winedump -j export src/d3d11/d3d11.dll Contents of src/d3d11/d3d11.dll: 263021637 bytes Name: D3D11.DLL Characteristics: 00000000 TimeDateStamp: 64C97A2E Tue Aug 1 22:33:34 2023 Version: 0.00 Ordinal base: 18 # of functions: 7 # of Names: 4 Addresses of functions: 005E3028 Addresses of name ordinals: 005E3054 Addresses of names: 005E3044 Entry Pt Ordn Name 00020045 18 D3D11CoreCreateDevice 000200AA 22 D3D11CreateDevice 0002010E 23 D3D11CreateDeviceAndSwapChain 0002025F 24 D3D11On12CreateDevice Done dumping src/d3d11/d3d11.dll ``` Import of DXGI in D3D11 ``` offset 005e1014 dxgi.dll Hint/Name Table: 005E408C TimeDateStamp: 00000000 (Thu Jan 1 01:00:00 1970) ForwarderChain: 00000000 First thunk RVA: 005E4300 Thunk Ordn Name 005e4300 4 CreateDXGIFactory1 ```
2023-08-01 22:41:49 +01:00
#define DLLEXPORT __attribute__((visibility("default")))
#else
build: Disable stdcall alias-ing and use kill-at Disable stdcall aliasing and enable kill-at to ensure our exported functions don't have the @8, @40, etc suffixes. This still keeps `--enable-stdcall-fixup` as otherwise the linker can get confused trying to find exports from the .def. This does not result in aliases being added, just for them to be found to add to the export table. This also switches d3d11 to use the MinGW provided dxgi.lib for linking and d3d10 to use the MinGW provided d3d11.lib for linking. Unfortunately the .a's we output seem to still have the @blah that we killed so we cannot use them for internal linkage since using kill-at. Tested that what we get out of MinGW now is what we want with dllexp. Supercedes: #3590 Exports ``` ➜ build git:(master) ✗ winedump -j export src/dxgi/dxgi.dll Contents of src/dxgi/dxgi.dll: 129505860 bytes Name: DXGI.DLL Characteristics: 00000000 TimeDateStamp: 64C97A2D Tue Aug 1 22:33:33 2023 Version: 0.00 Ordinal base: 9 # of functions: 9 # of Names: 5 Addresses of functions: 00423028 Addresses of name ordinals: 00423060 Addresses of names: 0042304C Entry Pt Ordn Name 00007C17 9 CreateDXGIFactory 00007BF3 10 CreateDXGIFactory1 00007B62 11 CreateDXGIFactory2 00007C3B 16 DXGIDeclareAdapterRemovalSupport 00007CD8 17 DXGIGetDebugInterface1 Done dumping src/dxgi/dxgi.dll ``` ``` ➜ build git:(fix-stdcall-32-bit) winedump -j export src/d3d11/d3d11.dll Contents of src/d3d11/d3d11.dll: 263021637 bytes Name: D3D11.DLL Characteristics: 00000000 TimeDateStamp: 64C97A2E Tue Aug 1 22:33:34 2023 Version: 0.00 Ordinal base: 18 # of functions: 7 # of Names: 4 Addresses of functions: 005E3028 Addresses of name ordinals: 005E3054 Addresses of names: 005E3044 Entry Pt Ordn Name 00020045 18 D3D11CoreCreateDevice 000200AA 22 D3D11CreateDevice 0002010E 23 D3D11CreateDeviceAndSwapChain 0002025F 24 D3D11On12CreateDevice Done dumping src/d3d11/d3d11.dll ``` Import of DXGI in D3D11 ``` offset 005e1014 dxgi.dll Hint/Name Table: 005E408C TimeDateStamp: 00000000 (Thu Jan 1 01:00:00 1970) ForwarderChain: 00000000 First thunk RVA: 005E4300 Thunk Ordn Name 005e4300 4 CreateDXGIFactory1 ```
2023-08-01 22:41:49 +01:00
#define DLLEXPORT
#endif
#include "../util/com/com_guid.h"
#include "../util/com/com_object.h"
#include "../util/com/com_pointer.h"
#include "../util/log/log.h"
#include "../util/log/log_debug.h"
#include "../util/rc/util_rc.h"
#include "../util/rc/util_rc_ptr.h"
2020-03-14 22:31:31 +01:00
#include "../util/sync/sync_recursive.h"
#include "../util/util_env.h"
#include "../util/util_enum.h"
#include "../util/util_error.h"
#include "../util/util_flags.h"
#include "../util/util_likely.h"
#include "../util/util_math.h"
#include "../util/util_string.h"
// Missed definitions in Wine/MinGW.
#ifndef D3DPRESENT_FORCEIMMEDIATE
#define D3DPRESENT_FORCEIMMEDIATE 0x00000100L
#endif
#ifndef D3DSWAPEFFECT_COPY_VSYNC
#define D3DSWAPEFFECT_COPY_VSYNC 4
#endif
// MinGW headers are broken. Who'dve guessed?
#ifndef _MSC_VER
typedef struct _D3DDEVINFO_RESOURCEMANAGER
{
char dummy;
} D3DDEVINFO_RESOURCEMANAGER, * LPD3DDEVINFO_RESOURCEMANAGER;
#endif
// This is the managed pool on D3D9Ex, it's just hidden!
#define D3DPOOL_MANAGED_EX D3DPOOL(6)
using D3D9VertexElements = std::vector<D3DVERTEXELEMENT9>;
/////////////////////
// D3D9On12 content
/////////////////////
#include <d3d12.h>
#define MAX_D3D9ON12_QUEUES 2
struct D3D9ON12_ARGS {
BOOL Enable9On12;
IUnknown* pD3D12Device;
IUnknown* ppD3D12Queues[MAX_D3D9ON12_QUEUES];
UINT NumQueues;
UINT NodeMask;
};
extern "C" {
// Ordinal 20
typedef IDirect3D9* (WINAPI* PFN_Direct3DCreate9On12)(UINT sdk_version, D3D9ON12_ARGS* override_list, UINT override_entry_count);
IDirect3D9* WINAPI Direct3DCreate9On12(UINT sdk_version, D3D9ON12_ARGS* override_list, UINT override_entry_count);
// Ordinal 21
typedef HRESULT(WINAPI* PFN_Direct3DCreate9On12Ex)(UINT sdk_version, D3D9ON12_ARGS* override_list, UINT override_entry_count, IDirect3D9Ex** output);
HRESULT WINAPI Direct3DCreate9On12Ex(UINT sdk_version, D3D9ON12_ARGS* override_list, UINT override_entry_count, IDirect3D9Ex** output);
}
MIDL_INTERFACE("e7fda234-b589-4049-940d-8878977531c8")
IDirect3DDevice9On12 : public IUnknown {
virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** object) = 0;
virtual ULONG STDMETHODCALLTYPE AddRef() = 0;
virtual ULONG STDMETHODCALLTYPE Release() = 0;
virtual HRESULT STDMETHODCALLTYPE GetD3D12Device(REFIID riid, void** object) = 0;
virtual HRESULT STDMETHODCALLTYPE UnwrapUnderlyingResource(IDirect3DResource9* resource, ID3D12CommandQueue* command_queue, REFIID riid, void** object) = 0;
virtual HRESULT STDMETHODCALLTYPE ReturnUnderlyingResource(IDirect3DResource9* resource, UINT num_sync, UINT64* signal_values, ID3D12Fence** fences) = 0;
};
#ifndef _MSC_VER
__CRT_UUID_DECL(IDirect3DDevice9On12, 0xe7fda234,0xb589,0x4049,0x94,0x0d,0x88,0x78,0x97,0x75,0x31,0xc8);
#endif