Skip to content

Commit

Permalink
[dxvk] Reintroduce VkPhysicalDeviceIDProperties
Browse files Browse the repository at this point in the history
We need this to get the device LUID. Wine does not fill in the
LUID properties in VkPhysicalDeviceVulkan11Properties right now.

Fixes DLSS not working, as well as other potential issues.
  • Loading branch information
doitsujin committed Jul 26, 2022
1 parent 6425d23 commit 6c5f73a
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/d3d9/d3d9_adapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -702,10 +702,10 @@ namespace dxvk {
if (pLUID == nullptr)
return D3DERR_INVALIDCALL;

auto& vk11 = m_adapter->devicePropertiesExt().vk11;
auto& deviceId = m_adapter->devicePropertiesExt().coreDeviceId;

if (vk11.deviceLUIDValid)
*pLUID = bit::cast<LUID>(vk11.deviceLUID);
if (deviceId.deviceLUIDValid)
*pLUID = bit::cast<LUID>(deviceId.deviceLUID);
else
*pLUID = dxvk::GetAdapterLUID(m_ordinal);

Expand Down
6 changes: 3 additions & 3 deletions src/dxgi/dxgi_adapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ namespace dxvk {

auto deviceProp = m_adapter->deviceProperties();
auto memoryProp = m_adapter->memoryProperties();
auto vk11 = m_adapter->devicePropertiesExt().vk11;
auto deviceId = m_adapter->devicePropertiesExt().coreDeviceId;

// Custom Vendor / Device ID
if (options->customVendorId >= 0)
Expand Down Expand Up @@ -322,8 +322,8 @@ namespace dxvk {
pDesc->GraphicsPreemptionGranularity = DXGI_GRAPHICS_PREEMPTION_DMA_BUFFER_BOUNDARY;
pDesc->ComputePreemptionGranularity = DXGI_COMPUTE_PREEMPTION_DMA_BUFFER_BOUNDARY;

if (vk11.deviceLUIDValid)
std::memcpy(&pDesc->AdapterLuid, vk11.deviceLUID, VK_LUID_SIZE);
if (deviceId.deviceLUIDValid)
std::memcpy(&pDesc->AdapterLuid, deviceId.deviceLUID, VK_LUID_SIZE);
else
pDesc->AdapterLuid = GetAdapterLUID(m_index);

Expand Down
3 changes: 3 additions & 0 deletions src/dxvk/dxvk_adapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,9 @@ namespace dxvk {
m_deviceInfo.vk13.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_PROPERTIES;
m_deviceInfo.vk13.pNext = std::exchange(m_deviceInfo.core.pNext, &m_deviceInfo.vk13);

m_deviceInfo.coreDeviceId.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES;
m_deviceInfo.coreDeviceId.pNext = std::exchange(m_deviceInfo.core.pNext, &m_deviceInfo.coreDeviceId);

if (m_deviceExtensions.supports(VK_EXT_CONSERVATIVE_RASTERIZATION_EXTENSION_NAME)) {
m_deviceInfo.extConservativeRasterization.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CONSERVATIVE_RASTERIZATION_PROPERTIES_EXT;
m_deviceInfo.extConservativeRasterization.pNext = std::exchange(m_deviceInfo.core.pNext, &m_deviceInfo.extConservativeRasterization);
Expand Down
1 change: 1 addition & 0 deletions src/dxvk/dxvk_device_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ namespace dxvk {
*/
struct DxvkDeviceInfo {
VkPhysicalDeviceProperties2 core;
VkPhysicalDeviceIDProperties coreDeviceId;
VkPhysicalDeviceVulkan11Properties vk11;
VkPhysicalDeviceVulkan12Properties vk12;
VkPhysicalDeviceVulkan13Properties vk13;
Expand Down
4 changes: 2 additions & 2 deletions src/dxvk/dxvk_instance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ namespace dxvk {

Rc<DxvkAdapter> DxvkInstance::findAdapterByLuid(const void* luid) const {
for (const auto& adapter : m_adapters) {
const auto& props = adapter->devicePropertiesExt().vk11;
const auto& deviceId = adapter->devicePropertiesExt().coreDeviceId;

if (props.deviceLUIDValid && !std::memcmp(luid, props.deviceLUID, VK_LUID_SIZE))
if (deviceId.deviceLUIDValid && !std::memcmp(luid, deviceId.deviceLUID, VK_LUID_SIZE))
return adapter;
}

Expand Down

0 comments on commit 6c5f73a

Please sign in to comment.