mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-31 14:52:11 +01:00
[d3d10] Separate d3d10core from d3d10
This way we skip compiling and linking unnecessary garbage into the core library.
This commit is contained in:
parent
c1627a1b57
commit
3697583f71
67
src/d3d10/d3d10_core.cpp
Normal file
67
src/d3d10/d3d10_core.cpp
Normal file
@ -0,0 +1,67 @@
|
||||
#include <d3d11.h>
|
||||
#include <d3d10_1.h>
|
||||
|
||||
#include "../dxgi/dxgi_interfaces.h"
|
||||
|
||||
extern "C" {
|
||||
using namespace dxvk;
|
||||
|
||||
HRESULT __stdcall D3D11CoreCreateDevice(
|
||||
IDXGIFactory* pFactory,
|
||||
IDXGIAdapter* pAdapter,
|
||||
UINT Flags,
|
||||
const D3D_FEATURE_LEVEL* pFeatureLevels,
|
||||
UINT FeatureLevels,
|
||||
ID3D11Device** ppDevice);
|
||||
|
||||
|
||||
DLLEXPORT HRESULT __stdcall D3D10CoreCreateDevice(
|
||||
IDXGIFactory* pFactory,
|
||||
IDXGIAdapter* pAdapter,
|
||||
UINT Flags,
|
||||
D3D_FEATURE_LEVEL FeatureLevel,
|
||||
ID3D10Device** ppDevice) {
|
||||
InitReturnPtr(ppDevice);
|
||||
|
||||
Com<ID3D11Device> d3d11Device;
|
||||
|
||||
HRESULT hr = pAdapter->CheckInterfaceSupport(
|
||||
__uuidof(ID3D10Device), nullptr);
|
||||
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
hr = D3D11CoreCreateDevice(pFactory, pAdapter,
|
||||
Flags, &FeatureLevel, 1, &d3d11Device);
|
||||
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
Com<ID3D10Multithread> multithread;
|
||||
d3d11Device->QueryInterface(__uuidof(ID3D10Multithread), reinterpret_cast<void**>(&multithread));
|
||||
multithread->SetMultithreadProtected(!(Flags & D3D10_CREATE_DEVICE_SINGLETHREADED));
|
||||
|
||||
Com<IDXGIDXVKDevice> dxvkDevice;
|
||||
d3d11Device->QueryInterface(__uuidof(IDXGIDXVKDevice), reinterpret_cast<void**>(&dxvkDevice));
|
||||
dxvkDevice->SetAPIVersion(10);
|
||||
|
||||
if (FAILED(d3d11Device->QueryInterface(
|
||||
__uuidof(ID3D10Device), reinterpret_cast<void**>(ppDevice))))
|
||||
return E_FAIL;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
UINT64 STDMETHODCALLTYPE D3D10CoreGetVersion() {
|
||||
// Match the Windows 10 return value, but we
|
||||
// don't know the exact function signature
|
||||
return 0xa000100041770ull;
|
||||
}
|
||||
|
||||
|
||||
HRESULT STDMETHODCALLTYPE D3D10CoreRegisterLayers() {
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
}
|
@ -12,52 +12,12 @@ namespace dxvk {
|
||||
extern "C" {
|
||||
using namespace dxvk;
|
||||
|
||||
HRESULT __stdcall D3D11CoreCreateDevice(
|
||||
IDXGIFactory* pFactory,
|
||||
IDXGIAdapter* pAdapter,
|
||||
UINT Flags,
|
||||
const D3D_FEATURE_LEVEL* pFeatureLevels,
|
||||
UINT FeatureLevels,
|
||||
ID3D11Device** ppDevice);
|
||||
|
||||
|
||||
DLLEXPORT HRESULT __stdcall D3D10CoreCreateDevice(
|
||||
HRESULT __stdcall D3D10CoreCreateDevice(
|
||||
IDXGIFactory* pFactory,
|
||||
IDXGIAdapter* pAdapter,
|
||||
UINT Flags,
|
||||
D3D_FEATURE_LEVEL FeatureLevel,
|
||||
ID3D10Device** ppDevice) {
|
||||
InitReturnPtr(ppDevice);
|
||||
|
||||
Com<ID3D11Device> d3d11Device;
|
||||
|
||||
HRESULT hr = pAdapter->CheckInterfaceSupport(
|
||||
__uuidof(ID3D10Device), nullptr);
|
||||
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
hr = D3D11CoreCreateDevice(pFactory, pAdapter,
|
||||
Flags, &FeatureLevel, 1, &d3d11Device);
|
||||
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
Com<ID3D10Multithread> multithread;
|
||||
d3d11Device->QueryInterface(__uuidof(ID3D10Multithread), reinterpret_cast<void**>(&multithread));
|
||||
multithread->SetMultithreadProtected(!(Flags & D3D10_CREATE_DEVICE_SINGLETHREADED));
|
||||
|
||||
Com<IDXGIDXVKDevice> dxvkDevice;
|
||||
d3d11Device->QueryInterface(__uuidof(IDXGIDXVKDevice), reinterpret_cast<void**>(&dxvkDevice));
|
||||
dxvkDevice->SetAPIVersion(10);
|
||||
|
||||
if (FAILED(d3d11Device->QueryInterface(
|
||||
__uuidof(ID3D10Device), reinterpret_cast<void**>(ppDevice))))
|
||||
return E_FAIL;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
ID3D10Device** ppDevice);
|
||||
|
||||
static HRESULT D3D10InternalCreateDeviceAndSwapChain(
|
||||
IDXGIAdapter* pAdapter,
|
||||
@ -361,13 +321,6 @@ extern "C" {
|
||||
}
|
||||
|
||||
|
||||
UINT64 STDMETHODCALLTYPE D3D10CoreGetVersion() {
|
||||
// Match the Windows 10 return value, but we
|
||||
// don't know the exact function signature
|
||||
return 0xa000100041770ull;
|
||||
}
|
||||
|
||||
|
||||
UINT64 STDMETHODCALLTYPE D3D10GetVersion() {
|
||||
return 0xa000100041770ull;
|
||||
}
|
||||
@ -377,11 +330,6 @@ extern "C" {
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
||||
HRESULT STDMETHODCALLTYPE D3D10CoreRegisterLayers() {
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -2,27 +2,35 @@ d3d10_res = wrc_generator.process('version10.rc')
|
||||
d3d10_1_res = wrc_generator.process('version10_1.rc')
|
||||
d3d10_core_res = wrc_generator.process('version10_core.rc')
|
||||
|
||||
d3d10_core_src = [
|
||||
'd3d10_core.cpp',
|
||||
]
|
||||
|
||||
d3d10_main_src = [
|
||||
'd3d10_main.cpp',
|
||||
'd3d10_reflection.cpp',
|
||||
'd3d10_state_block.cpp',
|
||||
]
|
||||
|
||||
d3d10_deps = [ lib_d3dcompiler_43, lib_dxgi ]
|
||||
d3d10_deps += dxvk_winelib ? lib_d3d11 : d3d11_dep
|
||||
d3d10_d3d11_dep = dxvk_winelib ? lib_d3d11 : d3d11_dep
|
||||
|
||||
d3d10_core_dll = shared_library('d3d10core'+dll_ext, d3d10_main_src, d3d10_core_res,
|
||||
d3d10_core_dll = shared_library('d3d10core'+dll_ext, d3d10_core_src, d3d10_core_res,
|
||||
name_prefix : '',
|
||||
dependencies : [ d3d10_deps, dxbc_dep, dxvk_dep ],
|
||||
dependencies : [ d3d10_d3d11_dep ],
|
||||
include_directories : dxvk_include_path,
|
||||
install : true,
|
||||
objects : not dxvk_msvc ? 'd3d10core'+def_spec_ext : [],
|
||||
vs_module_defs : 'd3d10core'+def_spec_ext,
|
||||
override_options : ['cpp_std='+dxvk_cpp_std])
|
||||
|
||||
d3d10_core_dep = declare_dependency(
|
||||
link_with : [ d3d10_core_dll ])
|
||||
|
||||
d3d10_deps = [ lib_d3dcompiler_43, lib_dxgi, dxbc_dep, dxvk_dep, d3d10_core_dep ]
|
||||
|
||||
d3d10_dll = shared_library('d3d10'+dll_ext, d3d10_main_src, d3d10_res,
|
||||
name_prefix : '',
|
||||
dependencies : [ d3d10_deps, dxbc_dep, dxvk_dep ],
|
||||
dependencies : [ d3d10_deps ],
|
||||
include_directories : dxvk_include_path,
|
||||
install : true,
|
||||
objects : not dxvk_msvc ? 'd3d10'+def_spec_ext : [],
|
||||
@ -31,7 +39,7 @@ d3d10_dll = shared_library('d3d10'+dll_ext, d3d10_main_src, d3d10_res,
|
||||
|
||||
d3d10_1_dll = shared_library('d3d10_1'+dll_ext, d3d10_main_src, d3d10_1_res,
|
||||
name_prefix : '',
|
||||
dependencies : [ d3d10_deps, dxbc_dep, dxvk_dep ],
|
||||
dependencies : [ d3d10_deps ],
|
||||
include_directories : dxvk_include_path,
|
||||
install : true,
|
||||
objects : not dxvk_msvc ? 'd3d10_1'+def_spec_ext : [],
|
||||
|
Loading…
x
Reference in New Issue
Block a user