diff options
| author | 2021-02-20 03:30:13 -0300 | |
|---|---|---|
| committer | 2021-07-22 21:51:22 -0400 | |
| commit | e2bc05b17d91854cbb9c0ce3647141bf7d33143e (patch) | |
| tree | 96769db006b6015cd536483db98ee0697aee4992 /src/video_core/vulkan_common | |
| parent | spirv: Add lower fp16 to fp32 pass (diff) | |
| download | yuzu-e2bc05b17d91854cbb9c0ce3647141bf7d33143e.tar.gz yuzu-e2bc05b17d91854cbb9c0ce3647141bf7d33143e.tar.xz yuzu-e2bc05b17d91854cbb9c0ce3647141bf7d33143e.zip | |
shader: Add denorm flush support
Diffstat (limited to 'src/video_core/vulkan_common')
| -rw-r--r-- | src/video_core/vulkan_common/vulkan_device.cpp | 26 | ||||
| -rw-r--r-- | src/video_core/vulkan_common/vulkan_device.h | 33 | ||||
| -rw-r--r-- | src/video_core/vulkan_common/vulkan_wrapper.cpp | 2 |
3 files changed, 35 insertions, 26 deletions
diff --git a/src/video_core/vulkan_common/vulkan_device.cpp b/src/video_core/vulkan_common/vulkan_device.cpp index 85f903125..4887d6fd9 100644 --- a/src/video_core/vulkan_common/vulkan_device.cpp +++ b/src/video_core/vulkan_common/vulkan_device.cpp | |||
| @@ -43,6 +43,7 @@ constexpr std::array REQUIRED_EXTENSIONS{ | |||
| 43 | VK_KHR_DESCRIPTOR_UPDATE_TEMPLATE_EXTENSION_NAME, | 43 | VK_KHR_DESCRIPTOR_UPDATE_TEMPLATE_EXTENSION_NAME, |
| 44 | VK_KHR_TIMELINE_SEMAPHORE_EXTENSION_NAME, | 44 | VK_KHR_TIMELINE_SEMAPHORE_EXTENSION_NAME, |
| 45 | VK_KHR_SAMPLER_MIRROR_CLAMP_TO_EDGE_EXTENSION_NAME, | 45 | VK_KHR_SAMPLER_MIRROR_CLAMP_TO_EDGE_EXTENSION_NAME, |
| 46 | VK_KHR_SHADER_FLOAT_CONTROLS_EXTENSION_NAME, | ||
| 46 | VK_EXT_VERTEX_ATTRIBUTE_DIVISOR_EXTENSION_NAME, | 47 | VK_EXT_VERTEX_ATTRIBUTE_DIVISOR_EXTENSION_NAME, |
| 47 | VK_EXT_SHADER_SUBGROUP_BALLOT_EXTENSION_NAME, | 48 | VK_EXT_SHADER_SUBGROUP_BALLOT_EXTENSION_NAME, |
| 48 | VK_EXT_SHADER_SUBGROUP_VOTE_EXTENSION_NAME, | 49 | VK_EXT_SHADER_SUBGROUP_VOTE_EXTENSION_NAME, |
| @@ -200,6 +201,7 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR | |||
| 200 | CheckSuitability(surface != nullptr); | 201 | CheckSuitability(surface != nullptr); |
| 201 | SetupFamilies(surface); | 202 | SetupFamilies(surface); |
| 202 | SetupFeatures(); | 203 | SetupFeatures(); |
| 204 | SetupProperties(); | ||
| 203 | 205 | ||
| 204 | const auto queue_cis = GetDeviceQueueCreateInfos(); | 206 | const auto queue_cis = GetDeviceQueueCreateInfos(); |
| 205 | const std::vector extensions = LoadExtensions(surface != nullptr); | 207 | const std::vector extensions = LoadExtensions(surface != nullptr); |
| @@ -426,8 +428,6 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR | |||
| 426 | 428 | ||
| 427 | graphics_queue = logical.GetQueue(graphics_family); | 429 | graphics_queue = logical.GetQueue(graphics_family); |
| 428 | present_queue = logical.GetQueue(present_family); | 430 | present_queue = logical.GetQueue(present_family); |
| 429 | |||
| 430 | use_asynchronous_shaders = Settings::values.use_asynchronous_shaders.GetValue(); | ||
| 431 | } | 431 | } |
| 432 | 432 | ||
| 433 | Device::~Device() = default; | 433 | Device::~Device() = default; |
| @@ -600,7 +600,7 @@ void Device::CheckSuitability(bool requires_swapchain) const { | |||
| 600 | VkPhysicalDeviceRobustness2FeaturesEXT robustness2{}; | 600 | VkPhysicalDeviceRobustness2FeaturesEXT robustness2{}; |
| 601 | robustness2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ROBUSTNESS_2_FEATURES_EXT; | 601 | robustness2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ROBUSTNESS_2_FEATURES_EXT; |
| 602 | 602 | ||
| 603 | VkPhysicalDeviceFeatures2 features2{}; | 603 | VkPhysicalDeviceFeatures2KHR features2{}; |
| 604 | features2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2; | 604 | features2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2; |
| 605 | features2.pNext = &robustness2; | 605 | features2.pNext = &robustness2; |
| 606 | 606 | ||
| @@ -684,7 +684,7 @@ std::vector<const char*> Device::LoadExtensions(bool requires_surface) { | |||
| 684 | true); | 684 | true); |
| 685 | } | 685 | } |
| 686 | } | 686 | } |
| 687 | VkPhysicalDeviceFeatures2KHR features; | 687 | VkPhysicalDeviceFeatures2KHR features{}; |
| 688 | features.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2_KHR; | 688 | features.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2_KHR; |
| 689 | 689 | ||
| 690 | VkPhysicalDeviceProperties2KHR physical_properties; | 690 | VkPhysicalDeviceProperties2KHR physical_properties; |
| @@ -806,11 +806,21 @@ void Device::SetupFamilies(VkSurfaceKHR surface) { | |||
| 806 | } | 806 | } |
| 807 | 807 | ||
| 808 | void Device::SetupFeatures() { | 808 | void Device::SetupFeatures() { |
| 809 | const auto supported_features{physical.GetFeatures()}; | 809 | const VkPhysicalDeviceFeatures features{physical.GetFeatures()}; |
| 810 | is_formatless_image_load_supported = supported_features.shaderStorageImageReadWithoutFormat; | 810 | is_formatless_image_load_supported = features.shaderStorageImageReadWithoutFormat; |
| 811 | is_shader_storage_image_multisample = supported_features.shaderStorageImageMultisample; | 811 | is_shader_storage_image_multisample = features.shaderStorageImageMultisample; |
| 812 | is_blit_depth_stencil_supported = TestDepthStencilBlits(); | 812 | is_blit_depth_stencil_supported = TestDepthStencilBlits(); |
| 813 | is_optimal_astc_supported = IsOptimalAstcSupported(supported_features); | 813 | is_optimal_astc_supported = IsOptimalAstcSupported(features); |
| 814 | } | ||
| 815 | |||
| 816 | void Device::SetupProperties() { | ||
| 817 | float_controls.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FLOAT_CONTROLS_PROPERTIES_KHR; | ||
| 818 | |||
| 819 | VkPhysicalDeviceProperties2KHR properties2{}; | ||
| 820 | properties2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2_KHR; | ||
| 821 | properties2.pNext = &float_controls; | ||
| 822 | |||
| 823 | physical.GetProperties2KHR(properties2); | ||
| 814 | } | 824 | } |
| 815 | 825 | ||
| 816 | void Device::CollectTelemetryParameters() { | 826 | void Device::CollectTelemetryParameters() { |
diff --git a/src/video_core/vulkan_common/vulkan_device.h b/src/video_core/vulkan_common/vulkan_device.h index 96c0f8c60..82bccc8f0 100644 --- a/src/video_core/vulkan_common/vulkan_device.h +++ b/src/video_core/vulkan_common/vulkan_device.h | |||
| @@ -128,6 +128,11 @@ public: | |||
| 128 | return properties.limits.maxComputeSharedMemorySize; | 128 | return properties.limits.maxComputeSharedMemorySize; |
| 129 | } | 129 | } |
| 130 | 130 | ||
| 131 | /// Returns float control properties of the device. | ||
| 132 | const VkPhysicalDeviceFloatControlsPropertiesKHR& FloatControlProperties() const { | ||
| 133 | return float_controls; | ||
| 134 | } | ||
| 135 | |||
| 131 | /// Returns true if ASTC is natively supported. | 136 | /// Returns true if ASTC is natively supported. |
| 132 | bool IsOptimalAstcSupported() const { | 137 | bool IsOptimalAstcSupported() const { |
| 133 | return is_optimal_astc_supported; | 138 | return is_optimal_astc_supported; |
| @@ -223,11 +228,6 @@ public: | |||
| 223 | return reported_extensions; | 228 | return reported_extensions; |
| 224 | } | 229 | } |
| 225 | 230 | ||
| 226 | /// Returns true if the setting for async shader compilation is enabled. | ||
| 227 | bool UseAsynchronousShaders() const { | ||
| 228 | return use_asynchronous_shaders; | ||
| 229 | } | ||
| 230 | |||
| 231 | u64 GetDeviceLocalMemory() const { | 231 | u64 GetDeviceLocalMemory() const { |
| 232 | return device_access_memory; | 232 | return device_access_memory; |
| 233 | } | 233 | } |
| @@ -245,6 +245,9 @@ private: | |||
| 245 | /// Sets up device features. | 245 | /// Sets up device features. |
| 246 | void SetupFeatures(); | 246 | void SetupFeatures(); |
| 247 | 247 | ||
| 248 | /// Sets up device properties. | ||
| 249 | void SetupProperties(); | ||
| 250 | |||
| 248 | /// Collects telemetry information from the device. | 251 | /// Collects telemetry information from the device. |
| 249 | void CollectTelemetryParameters(); | 252 | void CollectTelemetryParameters(); |
| 250 | 253 | ||
| @@ -267,14 +270,15 @@ private: | |||
| 267 | bool IsFormatSupported(VkFormat wanted_format, VkFormatFeatureFlags wanted_usage, | 270 | bool IsFormatSupported(VkFormat wanted_format, VkFormatFeatureFlags wanted_usage, |
| 268 | FormatType format_type) const; | 271 | FormatType format_type) const; |
| 269 | 272 | ||
| 270 | VkInstance instance; ///< Vulkan instance. | 273 | VkInstance instance; ///< Vulkan instance. |
| 271 | vk::DeviceDispatch dld; ///< Device function pointers. | 274 | vk::DeviceDispatch dld; ///< Device function pointers. |
| 272 | vk::PhysicalDevice physical; ///< Physical device. | 275 | vk::PhysicalDevice physical; ///< Physical device. |
| 273 | VkPhysicalDeviceProperties properties; ///< Device properties. | 276 | VkPhysicalDeviceProperties properties; ///< Device properties. |
| 274 | vk::Device logical; ///< Logical device. | 277 | VkPhysicalDeviceFloatControlsPropertiesKHR float_controls{}; ///< Float control properties. |
| 275 | vk::Queue graphics_queue; ///< Main graphics queue. | 278 | vk::Device logical; ///< Logical device. |
| 276 | vk::Queue present_queue; ///< Main present queue. | 279 | vk::Queue graphics_queue; ///< Main graphics queue. |
| 277 | u32 instance_version{}; ///< Vulkan onstance version. | 280 | vk::Queue present_queue; ///< Main present queue. |
| 281 | u32 instance_version{}; ///< Vulkan onstance version. | ||
| 278 | u32 graphics_family{}; ///< Main graphics queue family index. | 282 | u32 graphics_family{}; ///< Main graphics queue family index. |
| 279 | u32 present_family{}; ///< Main present queue family index. | 283 | u32 present_family{}; ///< Main present queue family index. |
| 280 | VkDriverIdKHR driver_id{}; ///< Driver ID. | 284 | VkDriverIdKHR driver_id{}; ///< Driver ID. |
| @@ -301,9 +305,6 @@ private: | |||
| 301 | bool has_renderdoc{}; ///< Has RenderDoc attached | 305 | bool has_renderdoc{}; ///< Has RenderDoc attached |
| 302 | bool has_nsight_graphics{}; ///< Has Nsight Graphics attached | 306 | bool has_nsight_graphics{}; ///< Has Nsight Graphics attached |
| 303 | 307 | ||
| 304 | // Asynchronous Graphics Pipeline setting | ||
| 305 | bool use_asynchronous_shaders{}; ///< Setting to use asynchronous shaders/graphics pipeline | ||
| 306 | |||
| 307 | // Telemetry parameters | 308 | // Telemetry parameters |
| 308 | std::string vendor_name; ///< Device's driver name. | 309 | std::string vendor_name; ///< Device's driver name. |
| 309 | std::vector<std::string> reported_extensions; ///< Reported Vulkan extensions. | 310 | std::vector<std::string> reported_extensions; ///< Reported Vulkan extensions. |
diff --git a/src/video_core/vulkan_common/vulkan_wrapper.cpp b/src/video_core/vulkan_common/vulkan_wrapper.cpp index 2aa0ffbe6..33fb74bfb 100644 --- a/src/video_core/vulkan_common/vulkan_wrapper.cpp +++ b/src/video_core/vulkan_common/vulkan_wrapper.cpp | |||
| @@ -311,8 +311,6 @@ const char* ToString(VkResult result) noexcept { | |||
| 311 | return "VK_ERROR_FULL_SCREEN_EXCLUSIVE_MODE_LOST_EXT"; | 311 | return "VK_ERROR_FULL_SCREEN_EXCLUSIVE_MODE_LOST_EXT"; |
| 312 | case VkResult::VK_ERROR_UNKNOWN: | 312 | case VkResult::VK_ERROR_UNKNOWN: |
| 313 | return "VK_ERROR_UNKNOWN"; | 313 | return "VK_ERROR_UNKNOWN"; |
| 314 | case VkResult::VK_ERROR_INCOMPATIBLE_VERSION_KHR: | ||
| 315 | return "VK_ERROR_INCOMPATIBLE_VERSION_KHR"; | ||
| 316 | case VkResult::VK_THREAD_IDLE_KHR: | 314 | case VkResult::VK_THREAD_IDLE_KHR: |
| 317 | return "VK_THREAD_IDLE_KHR"; | 315 | return "VK_THREAD_IDLE_KHR"; |
| 318 | case VkResult::VK_THREAD_DONE_KHR: | 316 | case VkResult::VK_THREAD_DONE_KHR: |