diff options
Diffstat (limited to '')
| -rw-r--r-- | src/video_core/vulkan_common/vulkan_device.cpp | 29 | ||||
| -rw-r--r-- | src/video_core/vulkan_common/vulkan_device.h | 6 |
2 files changed, 23 insertions, 12 deletions
diff --git a/src/video_core/vulkan_common/vulkan_device.cpp b/src/video_core/vulkan_common/vulkan_device.cpp index e297a3e92..7d66a43e7 100644 --- a/src/video_core/vulkan_common/vulkan_device.cpp +++ b/src/video_core/vulkan_common/vulkan_device.cpp | |||
| @@ -194,12 +194,22 @@ std::unordered_map<VkFormat, VkFormatProperties> GetFormatProperties(vk::Physica | |||
| 194 | return format_properties; | 194 | return format_properties; |
| 195 | } | 195 | } |
| 196 | 196 | ||
| 197 | std::vector<std::string> GetSupportedExtensions(vk::PhysicalDevice physical) { | ||
| 198 | const std::vector extensions = physical.EnumerateDeviceExtensionProperties(); | ||
| 199 | std::vector<std::string> supported_extensions(std::size(extensions)); | ||
| 200 | for (const auto& extension : extensions) { | ||
| 201 | supported_extensions.emplace_back(extension.extensionName); | ||
| 202 | } | ||
| 203 | return supported_extensions; | ||
| 204 | } | ||
| 205 | |||
| 197 | } // Anonymous namespace | 206 | } // Anonymous namespace |
| 198 | 207 | ||
| 199 | Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR surface, | 208 | Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR surface, |
| 200 | const vk::InstanceDispatch& dld_) | 209 | const vk::InstanceDispatch& dld_) |
| 201 | : instance{instance_}, dld{dld_}, physical{physical_}, properties{physical.GetProperties()}, | 210 | : instance{instance_}, dld{dld_}, physical{physical_}, properties{physical.GetProperties()}, |
| 202 | format_properties{GetFormatProperties(physical)} { | 211 | supported_extensions{GetSupportedExtensions(physical)}, |
| 212 | format_properties(GetFormatProperties(physical)) { | ||
| 203 | CheckSuitability(surface != nullptr); | 213 | CheckSuitability(surface != nullptr); |
| 204 | SetupFamilies(surface); | 214 | SetupFamilies(surface); |
| 205 | SetupFeatures(); | 215 | SetupFeatures(); |
| @@ -510,6 +520,13 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR | |||
| 510 | CollectTelemetryParameters(); | 520 | CollectTelemetryParameters(); |
| 511 | CollectToolingInfo(); | 521 | CollectToolingInfo(); |
| 512 | 522 | ||
| 523 | if (driver_id == VK_DRIVER_ID_NVIDIA_PROPRIETARY_KHR && is_float16_supported) { | ||
| 524 | if (std::ranges::find(supported_extensions, VK_KHR_FRAGMENT_SHADING_RATE_EXTENSION_NAME) != | ||
| 525 | supported_extensions.end()) { | ||
| 526 | LOG_WARNING(Render_Vulkan, "Blacklisting Ampere devices from float16 math"); | ||
| 527 | is_float16_supported = false; | ||
| 528 | } | ||
| 529 | } | ||
| 513 | if (ext_extended_dynamic_state && driver_id == VK_DRIVER_ID_MESA_RADV) { | 530 | if (ext_extended_dynamic_state && driver_id == VK_DRIVER_ID_MESA_RADV) { |
| 514 | // Mask driver version variant | 531 | // Mask driver version variant |
| 515 | const u32 version = (properties.driverVersion << 3) >> 3; | 532 | const u32 version = (properties.driverVersion << 3) >> 3; |
| @@ -778,10 +795,10 @@ std::vector<const char*> Device::LoadExtensions(bool requires_surface) { | |||
| 778 | bool has_ext_provoking_vertex{}; | 795 | bool has_ext_provoking_vertex{}; |
| 779 | bool has_ext_vertex_input_dynamic_state{}; | 796 | bool has_ext_vertex_input_dynamic_state{}; |
| 780 | bool has_ext_line_rasterization{}; | 797 | bool has_ext_line_rasterization{}; |
| 781 | for (const VkExtensionProperties& extension : physical.EnumerateDeviceExtensionProperties()) { | 798 | for (const std::string& extension : supported_extensions) { |
| 782 | const auto test = [&](std::optional<std::reference_wrapper<bool>> status, const char* name, | 799 | const auto test = [&](std::optional<std::reference_wrapper<bool>> status, const char* name, |
| 783 | bool push) { | 800 | bool push) { |
| 784 | if (extension.extensionName != std::string_view(name)) { | 801 | if (extension != name) { |
| 785 | return; | 802 | return; |
| 786 | } | 803 | } |
| 787 | if (push) { | 804 | if (push) { |
| @@ -1064,12 +1081,6 @@ void Device::CollectTelemetryParameters() { | |||
| 1064 | 1081 | ||
| 1065 | driver_id = driver.driverID; | 1082 | driver_id = driver.driverID; |
| 1066 | vendor_name = driver.driverName; | 1083 | vendor_name = driver.driverName; |
| 1067 | |||
| 1068 | const std::vector extensions = physical.EnumerateDeviceExtensionProperties(); | ||
| 1069 | reported_extensions.reserve(std::size(extensions)); | ||
| 1070 | for (const auto& extension : extensions) { | ||
| 1071 | reported_extensions.emplace_back(extension.extensionName); | ||
| 1072 | } | ||
| 1073 | } | 1084 | } |
| 1074 | 1085 | ||
| 1075 | void Device::CollectPhysicalMemoryInfo() { | 1086 | void Device::CollectPhysicalMemoryInfo() { |
diff --git a/src/video_core/vulkan_common/vulkan_device.h b/src/video_core/vulkan_common/vulkan_device.h index 26100166f..df394e384 100644 --- a/src/video_core/vulkan_common/vulkan_device.h +++ b/src/video_core/vulkan_common/vulkan_device.h | |||
| @@ -301,7 +301,7 @@ public: | |||
| 301 | 301 | ||
| 302 | /// Returns the list of available extensions. | 302 | /// Returns the list of available extensions. |
| 303 | const std::vector<std::string>& GetAvailableExtensions() const { | 303 | const std::vector<std::string>& GetAvailableExtensions() const { |
| 304 | return reported_extensions; | 304 | return supported_extensions; |
| 305 | } | 305 | } |
| 306 | 306 | ||
| 307 | u64 GetDeviceLocalMemory() const { | 307 | u64 GetDeviceLocalMemory() const { |
| @@ -398,8 +398,8 @@ private: | |||
| 398 | bool has_nsight_graphics{}; ///< Has Nsight Graphics attached | 398 | bool has_nsight_graphics{}; ///< Has Nsight Graphics attached |
| 399 | 399 | ||
| 400 | // Telemetry parameters | 400 | // Telemetry parameters |
| 401 | std::string vendor_name; ///< Device's driver name. | 401 | std::string vendor_name; ///< Device's driver name. |
| 402 | std::vector<std::string> reported_extensions; ///< Reported Vulkan extensions. | 402 | std::vector<std::string> supported_extensions; ///< Reported Vulkan extensions. |
| 403 | 403 | ||
| 404 | /// Format properties dictionary. | 404 | /// Format properties dictionary. |
| 405 | std::unordered_map<VkFormat, VkFormatProperties> format_properties; | 405 | std::unordered_map<VkFormat, VkFormatProperties> format_properties; |