1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-01-31 05:52:11 +01:00

[dxvk] Use VkPhysicalDeviceVulkan11{Features,Properties} where appropriate

This commit is contained in:
Philip Rebohle 2022-07-14 19:30:35 +02:00
parent fd15795a0b
commit 2774a04195
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
8 changed files with 29 additions and 31 deletions

View File

@ -1925,7 +1925,7 @@ namespace dxvk {
enabled.core.features.shaderStorageImageWriteWithoutFormat = VK_TRUE;
enabled.core.features.depthBounds = supported.core.features.depthBounds;
enabled.shaderDrawParameters.shaderDrawParameters = VK_TRUE;
enabled.vk11.shaderDrawParameters = VK_TRUE;
enabled.extMemoryPriority.memoryPriority = supported.extMemoryPriority.memoryPriority;

View File

@ -67,7 +67,7 @@ namespace dxvk {
return D3DERR_INVALIDCALL;
}
GUID guid = bit::cast<GUID>(m_adapter->devicePropertiesExt().coreDeviceId.deviceUUID);
GUID guid = bit::cast<GUID>(m_adapter->devicePropertiesExt().vk11.deviceUUID);
uint32_t vendorId = options.customVendorId == -1 ? props.vendorID : uint32_t(options.customVendorId);
uint32_t deviceId = options.customDeviceId == -1 ? props.deviceID : uint32_t(options.customDeviceId);
@ -702,10 +702,10 @@ namespace dxvk {
if (pLUID == nullptr)
return D3DERR_INVALIDCALL;
auto& deviceId = m_adapter->devicePropertiesExt().coreDeviceId;
auto& vk11 = m_adapter->devicePropertiesExt().vk11;
if (deviceId.deviceLUIDValid)
*pLUID = bit::cast<LUID>(deviceId.deviceLUID);
if (vk11.deviceLUIDValid)
*pLUID = bit::cast<LUID>(vk11.deviceLUID);
else
*pLUID = dxvk::GetAdapterLUID(m_ordinal);

View File

@ -20,14 +20,14 @@ namespace dxvk {
useStorageImageReadWithoutFormat
= devFeatures.core.features.shaderStorageImageReadWithoutFormat;
useSubgroupOpsForAtomicCounters
= (devInfo.coreSubgroup.supportedStages & VK_SHADER_STAGE_COMPUTE_BIT)
&& (devInfo.coreSubgroup.supportedOperations & VK_SUBGROUP_FEATURE_BALLOT_BIT);
= (devInfo.vk11.subgroupSupportedStages & VK_SHADER_STAGE_COMPUTE_BIT)
&& (devInfo.vk11.subgroupSupportedOperations & VK_SUBGROUP_FEATURE_BALLOT_BIT);
useDemoteToHelperInvocation
= (devFeatures.extShaderDemoteToHelperInvocation.shaderDemoteToHelperInvocation);
useSubgroupOpsForEarlyDiscard
= (devInfo.coreSubgroup.subgroupSize >= 4)
&& (devInfo.coreSubgroup.supportedStages & VK_SHADER_STAGE_FRAGMENT_BIT)
&& (devInfo.coreSubgroup.supportedOperations & VK_SUBGROUP_FEATURE_BALLOT_BIT);
= (devInfo.vk11.subgroupSize >= 4)
&& (devInfo.vk11.subgroupSupportedStages & VK_SHADER_STAGE_FRAGMENT_BIT)
&& (devInfo.vk11.subgroupSupportedOperations & VK_SUBGROUP_FEATURE_BALLOT_BIT);
useSdivForBufferIndex
= adapter->matchesDriver(DxvkGpuVendor::Nvidia, VK_DRIVER_ID_NVIDIA_PROPRIETARY_KHR, 0, 0);

View File

@ -244,7 +244,7 @@ namespace dxvk {
auto deviceProp = m_adapter->deviceProperties();
auto memoryProp = m_adapter->memoryProperties();
auto deviceId = m_adapter->devicePropertiesExt().coreDeviceId;
auto vk11 = m_adapter->devicePropertiesExt().vk11;
// Custom Vendor / Device ID
if (options->customVendorId >= 0)
@ -322,8 +322,8 @@ namespace dxvk {
pDesc->GraphicsPreemptionGranularity = DXGI_GRAPHICS_PREEMPTION_DMA_BUFFER_BOUNDARY;
pDesc->ComputePreemptionGranularity = DXGI_COMPUTE_PREEMPTION_DMA_BUFFER_BOUNDARY;
if (deviceId.deviceLUIDValid)
std::memcpy(&pDesc->AdapterLuid, deviceId.deviceLUID, VK_LUID_SIZE);
if (vk11.deviceLUIDValid)
std::memcpy(&pDesc->AdapterLuid, vk11.deviceLUID, VK_LUID_SIZE);
else
pDesc->AdapterLuid = GetAdapterLUID(m_index);

View File

@ -18,9 +18,9 @@ namespace dxvk {
= (devFeatures.extShaderDemoteToHelperInvocation.shaderDemoteToHelperInvocation);
useSubgroupOpsForEarlyDiscard
= (devInfo.coreSubgroup.subgroupSize >= 4)
&& (devInfo.coreSubgroup.supportedStages & VK_SHADER_STAGE_FRAGMENT_BIT)
&& (devInfo.coreSubgroup.supportedOperations & VK_SUBGROUP_FEATURE_BALLOT_BIT);
= (devInfo.vk11.subgroupSize >= 4)
&& (devInfo.vk11.subgroupSupportedStages & VK_SHADER_STAGE_FRAGMENT_BIT)
&& (devInfo.vk11.subgroupSupportedOperations & VK_SUBGROUP_FEATURE_BALLOT_BIT);
// Disable early discard on Nvidia because it may hurt performance
if (adapter->matchesDriver(DxvkGpuVendor::Nvidia, VK_DRIVER_ID_NVIDIA_PROPRIETARY_KHR, 0, 0))

View File

@ -220,8 +220,8 @@ namespace dxvk {
|| !required.core.features.variableMultisampleRate)
&& (m_deviceFeatures.core.features.inheritedQueries
|| !required.core.features.inheritedQueries)
&& (m_deviceFeatures.shaderDrawParameters.shaderDrawParameters
|| !required.shaderDrawParameters.shaderDrawParameters)
&& (m_deviceFeatures.vk11.shaderDrawParameters
|| !required.vk11.shaderDrawParameters)
&& (m_deviceFeatures.ext4444Formats.formatA4R4G4B4
|| !required.ext4444Formats.formatA4R4G4B4)
&& (m_deviceFeatures.ext4444Formats.formatA4B4G4R4
@ -373,8 +373,8 @@ namespace dxvk {
enabledFeatures.core.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2_KHR;
enabledFeatures.core.pNext = nullptr;
enabledFeatures.shaderDrawParameters.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DRAW_PARAMETERS_FEATURES;
enabledFeatures.shaderDrawParameters.pNext = std::exchange(enabledFeatures.core.pNext, &enabledFeatures.shaderDrawParameters);
enabledFeatures.vk11.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES;
enabledFeatures.vk11.pNext = std::exchange(enabledFeatures.core.pNext, &enabledFeatures.vk11);
if (devExtensions.ext4444Formats) {
enabledFeatures.ext4444Formats.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_4444_FORMATS_FEATURES_EXT;
@ -627,11 +627,8 @@ namespace dxvk {
// Query info now so that we have basic device properties available
m_vki->vkGetPhysicalDeviceProperties2(m_handle, &m_deviceInfo.core);
m_deviceInfo.coreDeviceId.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES;
m_deviceInfo.coreDeviceId.pNext = std::exchange(m_deviceInfo.core.pNext, &m_deviceInfo.coreDeviceId);
m_deviceInfo.coreSubgroup.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_PROPERTIES;
m_deviceInfo.coreSubgroup.pNext = std::exchange(m_deviceInfo.core.pNext, &m_deviceInfo.coreSubgroup);
m_deviceInfo.vk11.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_PROPERTIES;
m_deviceInfo.vk11.pNext = std::exchange(m_deviceInfo.core.pNext, &m_deviceInfo.vk11);
if (m_deviceExtensions.supports(VK_EXT_CONSERVATIVE_RASTERIZATION_EXTENSION_NAME)) {
m_deviceInfo.extConservativeRasterization.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CONSERVATIVE_RASTERIZATION_PROPERTIES_EXT;
@ -706,8 +703,8 @@ namespace dxvk {
m_deviceFeatures.core.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2;
m_deviceFeatures.core.pNext = nullptr;
m_deviceFeatures.shaderDrawParameters.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DRAW_PARAMETERS_FEATURES;
m_deviceFeatures.shaderDrawParameters.pNext = std::exchange(m_deviceFeatures.core.pNext, &m_deviceFeatures.shaderDrawParameters);
m_deviceFeatures.vk11.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES;
m_deviceFeatures.vk11.pNext = std::exchange(m_deviceFeatures.core.pNext, &m_deviceFeatures.vk11);
if (m_deviceExtensions.supports(VK_EXT_4444_FORMATS_EXTENSION_NAME)) {
m_deviceFeatures.ext4444Formats.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_4444_FORMATS_FEATURES_EXT;
@ -855,6 +852,8 @@ namespace dxvk {
"\n shaderFloat64 : ", features.core.features.shaderFloat64 ? "1" : "0",
"\n shaderInt64 : ", features.core.features.shaderInt64 ? "1" : "0",
"\n variableMultisampleRate : ", features.core.features.variableMultisampleRate ? "1" : "0",
"\nVulkan 1.1",
"\n shaderDrawParameters : ", features.vk11.shaderDrawParameters,
"\n", VK_EXT_4444_FORMATS_EXTENSION_NAME,
"\n formatA4R4G4B4 : ", features.ext4444Formats.formatA4R4G4B4 ? "1" : "0",
"\n formatA4B4G4R4 : ", features.ext4444Formats.formatA4B4G4R4 ? "1" : "0",

View File

@ -14,8 +14,7 @@ namespace dxvk {
*/
struct DxvkDeviceInfo {
VkPhysicalDeviceProperties2 core;
VkPhysicalDeviceIDProperties coreDeviceId;
VkPhysicalDeviceSubgroupProperties coreSubgroup;
VkPhysicalDeviceVulkan11Properties vk11;
VkPhysicalDeviceConservativeRasterizationPropertiesEXT extConservativeRasterization;
VkPhysicalDeviceCustomBorderColorPropertiesEXT extCustomBorderColor;
VkPhysicalDeviceGraphicsPipelineLibraryPropertiesEXT extGraphicsPipelineLibrary;
@ -37,7 +36,7 @@ namespace dxvk {
*/
struct DxvkDeviceFeatures {
VkPhysicalDeviceFeatures2 core;
VkPhysicalDeviceShaderDrawParametersFeatures shaderDrawParameters;
VkPhysicalDeviceVulkan11Features vk11;
VkPhysicalDevice4444FormatsFeaturesEXT ext4444Formats;
VkPhysicalDeviceCustomBorderColorFeaturesEXT extCustomBorderColor;
VkPhysicalDeviceDepthClipEnableFeaturesEXT extDepthClipEnable;

View File

@ -61,7 +61,7 @@ namespace dxvk {
Rc<DxvkAdapter> DxvkInstance::findAdapterByLuid(const void* luid) const {
for (const auto& adapter : m_adapters) {
const auto& props = adapter->devicePropertiesExt().coreDeviceId;
const auto& props = adapter->devicePropertiesExt().vk11;
if (props.deviceLUIDValid && !std::memcmp(luid, props.deviceLUID, VK_LUID_SIZE))
return adapter;