Skip to content

Commit a500ef1

Browse files
committed
Improve DXVK compatibility
1 parent ca8b4bb commit a500ef1

File tree

5 files changed

+12
-13
lines changed

5 files changed

+12
-13
lines changed

OptiScaler/hooks/Vulkan_Hooks.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ static VkResult hkvkCreateDevice(VkPhysicalDevice physicalDevice, const VkDevice
170170

171171
if (idProps.deviceLUIDValid == VK_TRUE)
172172
{
173-
auto primaryGpu = IdentifyGpu::getPrimaryGpu();
173+
auto primaryGpu = IdentifyGpu::getPrimaryGpuVulkan();
174174
auto luid = (PLUID) idProps.deviceLUID;
175175
if (!IsEqualLUID(*luid, primaryGpu.luid))
176176
LOG_WARN("VkDevice created with non-primary GPU");

OptiScaler/misc/IdentifyGpu.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ std::vector<GpuInformation> IdentifyGpu::checkGpuInfo()
8585
std::wstring szName(adapterDesc.Description);
8686
gpuInfo.name = wstring_to_string(szName);
8787

88-
ComPtr<IDXGIVkInteropDevice> dxgiInterop;
89-
if (SUCCEEDED(adapter->QueryInterface(IID_PPV_ARGS(&dxgiInterop))))
88+
ComPtr<IDXGIDXVKAdapter> dxvkAdapter;
89+
if (SUCCEEDED(adapter->QueryInterface(IID_PPV_ARGS(&dxvkAdapter))))
9090
gpuInfo.usesDxvk = true;
9191

9292
// Needed to be able to query amdxc and check for vkd3d-proton
@@ -224,9 +224,6 @@ std::vector<GpuInformation> IdentifyGpu::checkGpuInfoVulkan()
224224
createInfo.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
225225
createInfo.pApplicationInfo = &appInfo;
226226

227-
// while (!IsDebuggerPresent())
228-
// Sleep(100);
229-
230227
auto winevulkan = LoadLibraryA("winevulkan.dll");
231228

232229
auto o_vkCreateInstance = vkCreateInstance;

OptiScaler/misc/IdentifyGpu.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,12 @@ ID3D12DXVKInteropDevice : public IUnknown
3131
};
3232

3333
// dxvk
34-
MIDL_INTERFACE("e2ef5fa5-dc21-4af7-90c4-f67ef6a09323")
35-
IDXGIVkInteropDevice : public IUnknown
34+
MIDL_INTERFACE("907bf281-ea3c-43b4-a8e4-9f231107b4ff")
35+
IDXGIDXVKAdapter : public IDXGIAdapter4
3636
{
37-
virtual void STDMETHODCALLTYPE GetVulkanHandles(VkInstance * pInstance, VkPhysicalDevice * pPhysDev,
38-
VkDevice * pDevice) = 0;
37+
virtual void* STDMETHODCALLTYPE GetDXVKAdapter() = 0;
38+
39+
virtual void* STDMETHODCALLTYPE GetDXVKInstance() = 0;
3940
};
4041

4142
struct GpuInformation

OptiScaler/spoofing/Vulkan_Spoofing.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ VkResult VulkanSpoofing::hkvkCreateInstance(VkInstanceCreateInfo* pCreateInfo, c
242242
newExtensionList.push_back(pCreateInfo->ppEnabledExtensionNames[i]);
243243
}
244244

245-
static auto primaryGpu = IdentifyGpu::getPrimaryGpu();
245+
static auto primaryGpu = IdentifyGpu::getPrimaryGpuVulkan();
246246
if (primaryGpu.dlssCapable && Config::Instance()->DLSSEnabled.value_or_default())
247247
{
248248
LOG_INFO("Adding NVNGX Vulkan extensions");
@@ -343,7 +343,7 @@ VkResult VulkanSpoofing::hkvkCreateDevice(VkPhysicalDevice physicalDevice, VkDev
343343
static std::vector<const char*> newExtensionList;
344344
newExtensionList.clear();
345345

346-
static auto primaryGpu = IdentifyGpu::getPrimaryGpu();
346+
static auto primaryGpu = IdentifyGpu::getPrimaryGpuVulkan();
347347
LOG_DEBUG("Checking extensions and removing Streamline ones");
348348
for (size_t i = 0; i < pCreateInfo->enabledExtensionCount; i++)
349349
{

OptiScaler/wrapped/wrapped_swapchain.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,9 +193,10 @@ static HRESULT LocalPresent(IDXGISwapChain* pSwapChain, UINT SyncInterval, UINT
193193
// Draw overlay
194194
MenuOverlayDx::Present(pSwapChain, SyncInterval, Flags, pPresentParameters, pDevice, hWnd, isUWP);
195195

196-
LOG_DEBUG("Calling fakenvapi");
197196
if (State::Instance().activeFgOutput == FGOutput::FSRFG || State::Instance().activeFgOutput == FGOutput::XeFG)
198197
{
198+
LOG_DEBUG("Calling fakenvapi");
199+
199200
static UINT64 fgPresentFrame = 0;
200201
auto fgIsActive = fg != nullptr && fg->IsActive() && !fg->IsPaused();
201202

0 commit comments

Comments
 (0)