mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-19 05:52:11 +01:00
[dxvk] Add Vulkan instance flag for D3D9 apps
This commit is contained in:
parent
22c2abb9b7
commit
a427d22cde
@ -38,7 +38,7 @@ extern "C" {
|
||||
DXGI_ADAPTER_DESC desc;
|
||||
pAdapter->GetDesc(&desc);
|
||||
|
||||
dxvkInstance = new DxvkInstance();
|
||||
dxvkInstance = new DxvkInstance(0);
|
||||
dxvkAdapter = dxvkInstance->findAdapterByLuid(&desc.AdapterLuid);
|
||||
|
||||
if (dxvkAdapter == nullptr)
|
||||
@ -376,7 +376,7 @@ extern "C" {
|
||||
instanceInfo.extensionCount = instanceExtensions.size();
|
||||
instanceInfo.extensionNames = instanceExtensions.data();
|
||||
|
||||
Rc<DxvkInstance> dxvkInstance = new DxvkInstance(instanceInfo);
|
||||
Rc<DxvkInstance> dxvkInstance = new DxvkInstance(instanceInfo, 0);
|
||||
|
||||
// Find adapter by physical device handle
|
||||
Rc<DxvkAdapter> dxvkAdapter;
|
||||
|
@ -14,7 +14,7 @@ namespace dxvk {
|
||||
Singleton<DxvkInstance> g_dxvkInstance;
|
||||
|
||||
D3D9InterfaceEx::D3D9InterfaceEx(bool bExtended)
|
||||
: m_instance ( g_dxvkInstance.acquire() )
|
||||
: m_instance ( g_dxvkInstance.acquire(DxvkInstanceFlag::ClientApiIsD3D9) )
|
||||
, m_d3d8Bridge ( this )
|
||||
, m_extended ( bExtended )
|
||||
, m_d3d9Options ( nullptr, m_instance->config() )
|
||||
|
@ -79,7 +79,7 @@ namespace dxvk {
|
||||
|
||||
|
||||
DxgiFactory::DxgiFactory(UINT Flags)
|
||||
: m_instance (g_dxvkInstance.acquire()),
|
||||
: m_instance (g_dxvkInstance.acquire(0)),
|
||||
m_interop (this),
|
||||
m_options (m_instance->config()),
|
||||
m_monitorInfo (this, m_options),
|
||||
|
@ -10,13 +10,13 @@
|
||||
|
||||
namespace dxvk {
|
||||
|
||||
DxvkInstance::DxvkInstance()
|
||||
: DxvkInstance(DxvkInstanceImportInfo()) {
|
||||
DxvkInstance::DxvkInstance(DxvkInstanceFlags flags)
|
||||
: DxvkInstance(DxvkInstanceImportInfo(), flags) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
DxvkInstance::DxvkInstance(const DxvkInstanceImportInfo& args) {
|
||||
DxvkInstance::DxvkInstance(const DxvkInstanceImportInfo& args, DxvkInstanceFlags flags) {
|
||||
Logger::info(str::format("Game: ", env::getExeName()));
|
||||
Logger::info(str::format("DXVK: ", DXVK_VERSION));
|
||||
|
||||
@ -46,7 +46,7 @@ namespace dxvk {
|
||||
for (const auto& provider : m_extProviders)
|
||||
provider->initInstanceExtensions();
|
||||
|
||||
createInstanceLoader(args);
|
||||
createInstanceLoader(args, flags);
|
||||
m_adapters = this->queryAdapters();
|
||||
|
||||
for (const auto& provider : m_extProviders)
|
||||
@ -106,7 +106,7 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
void DxvkInstance::createInstanceLoader(const DxvkInstanceImportInfo& args) {
|
||||
void DxvkInstance::createInstanceLoader(const DxvkInstanceImportInfo& args, DxvkInstanceFlags flags) {
|
||||
DxvkNameList layerList;
|
||||
DxvkNameList extensionList;
|
||||
DxvkNameSet extensionSet;
|
||||
@ -175,6 +175,7 @@ namespace dxvk {
|
||||
|
||||
VkApplicationInfo appInfo = { VK_STRUCTURE_TYPE_APPLICATION_INFO };
|
||||
appInfo.pApplicationName = appName.c_str();
|
||||
appInfo.applicationVersion = flags.raw();
|
||||
appInfo.pEngineName = "DXVK";
|
||||
appInfo.engineVersion = VK_MAKE_VERSION(2, 3, 0);
|
||||
appInfo.apiVersion = VK_MAKE_VERSION(1, 3, 0);
|
||||
|
@ -20,6 +20,21 @@ namespace dxvk {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* \brief Instance creation flags
|
||||
*
|
||||
* These flags will be passed to the app version field of the Vulkan
|
||||
* instance, so that drivers can adjust behaviour for some edge cases
|
||||
* that are not implementable with Vulkan itself.
|
||||
*/
|
||||
enum class DxvkInstanceFlag : uint32_t {
|
||||
/** Enforce D3D9 behaviour for texture coordinate snapping */
|
||||
ClientApiIsD3D9,
|
||||
};
|
||||
|
||||
using DxvkInstanceFlags = Flags<DxvkInstanceFlag>;
|
||||
|
||||
|
||||
/**
|
||||
* \brief DXVK instance
|
||||
*
|
||||
@ -33,14 +48,17 @@ namespace dxvk {
|
||||
|
||||
/**
|
||||
* \brief Creates new Vulkan instance
|
||||
* \param [in] flags Instance flags
|
||||
*/
|
||||
DxvkInstance();
|
||||
explicit DxvkInstance(DxvkInstanceFlags flags);
|
||||
|
||||
/**
|
||||
* \brief Imports existing Vulkan instance
|
||||
* \param [in] flags Instance flags
|
||||
*/
|
||||
explicit DxvkInstance(
|
||||
const DxvkInstanceImportInfo& args);
|
||||
const DxvkInstanceImportInfo& args,
|
||||
DxvkInstanceFlags flags);
|
||||
|
||||
~DxvkInstance();
|
||||
|
||||
@ -145,7 +163,8 @@ namespace dxvk {
|
||||
const DxvkInstanceImportInfo& args);
|
||||
|
||||
void createInstanceLoader(
|
||||
const DxvkInstanceImportInfo& args);
|
||||
const DxvkInstanceImportInfo& args,
|
||||
DxvkInstanceFlags flags);
|
||||
|
||||
std::vector<DxvkExt*> getExtensionList(
|
||||
DxvkInstanceExtensions& ext,
|
||||
|
@ -16,11 +16,12 @@ class Singleton {
|
||||
|
||||
public:
|
||||
|
||||
Rc<T> acquire() {
|
||||
template<typename... Args>
|
||||
Rc<T> acquire(Args... constantArgs) {
|
||||
std::lock_guard lock(m_mutex);
|
||||
|
||||
if (!(m_useCount++))
|
||||
m_object = new T();
|
||||
m_object = new T(constantArgs...);
|
||||
|
||||
return m_object;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user