diff options
| author | 2021-12-22 00:19:23 -0800 | |
|---|---|---|
| committer | 2021-12-22 00:19:23 -0800 | |
| commit | 36df305b13afc3d91bb7f9694dedab9a84a94130 (patch) | |
| tree | 3e7f617dcdc5b819ab2e7da9749875f948b0d773 /src/video_core/vulkan_common | |
| parent | Merge pull request #7602 from jbeich/freebsd-vaapi (diff) | |
| parent | Vulkan: Fix the checks for primitive restart extension. (diff) | |
| download | yuzu-36df305b13afc3d91bb7f9694dedab9a84a94130.tar.gz yuzu-36df305b13afc3d91bb7f9694dedab9a84a94130.tar.xz yuzu-36df305b13afc3d91bb7f9694dedab9a84a94130.zip | |
Merge pull request #7599 from FernandoS27/primrestart-vulkan
Vulkan: Fix Primitive Restart and implement Logical Operations
Diffstat (limited to 'src/video_core/vulkan_common')
| -rw-r--r-- | src/video_core/vulkan_common/vulkan_device.cpp | 31 | ||||
| -rw-r--r-- | src/video_core/vulkan_common/vulkan_device.h | 13 |
2 files changed, 43 insertions, 1 deletions
diff --git a/src/video_core/vulkan_common/vulkan_device.cpp b/src/video_core/vulkan_common/vulkan_device.cpp index 7bf5b6578..9862b815b 100644 --- a/src/video_core/vulkan_common/vulkan_device.cpp +++ b/src/video_core/vulkan_common/vulkan_device.cpp | |||
| @@ -271,7 +271,7 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR | |||
| 271 | .tessellationShader = true, | 271 | .tessellationShader = true, |
| 272 | .sampleRateShading = true, | 272 | .sampleRateShading = true, |
| 273 | .dualSrcBlend = true, | 273 | .dualSrcBlend = true, |
| 274 | .logicOp = false, | 274 | .logicOp = true, |
| 275 | .multiDrawIndirect = false, | 275 | .multiDrawIndirect = false, |
| 276 | .drawIndirectFirstInstance = false, | 276 | .drawIndirectFirstInstance = false, |
| 277 | .depthClamp = true, | 277 | .depthClamp = true, |
| @@ -433,6 +433,19 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR | |||
| 433 | LOG_INFO(Render_Vulkan, "Device doesn't support uint8 indexes"); | 433 | LOG_INFO(Render_Vulkan, "Device doesn't support uint8 indexes"); |
| 434 | } | 434 | } |
| 435 | 435 | ||
| 436 | VkPhysicalDevicePrimitiveTopologyListRestartFeaturesEXT primitive_topology_list_restart; | ||
| 437 | if (is_topology_list_restart_supported || is_patch_list_restart_supported) { | ||
| 438 | primitive_topology_list_restart = { | ||
| 439 | .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRIMITIVE_TOPOLOGY_LIST_RESTART_FEATURES_EXT, | ||
| 440 | .pNext = nullptr, | ||
| 441 | .primitiveTopologyListRestart = is_topology_list_restart_supported, | ||
| 442 | .primitiveTopologyPatchListRestart = is_patch_list_restart_supported, | ||
| 443 | }; | ||
| 444 | SetNext(next, primitive_topology_list_restart); | ||
| 445 | } else { | ||
| 446 | LOG_INFO(Render_Vulkan, "Device doesn't support list topology primitive restart"); | ||
| 447 | } | ||
| 448 | |||
| 436 | VkPhysicalDeviceTransformFeedbackFeaturesEXT transform_feedback; | 449 | VkPhysicalDeviceTransformFeedbackFeaturesEXT transform_feedback; |
| 437 | if (ext_transform_feedback) { | 450 | if (ext_transform_feedback) { |
| 438 | transform_feedback = { | 451 | transform_feedback = { |
| @@ -891,6 +904,7 @@ std::vector<const char*> Device::LoadExtensions(bool requires_surface) { | |||
| 891 | bool has_ext_provoking_vertex{}; | 904 | bool has_ext_provoking_vertex{}; |
| 892 | bool has_ext_vertex_input_dynamic_state{}; | 905 | bool has_ext_vertex_input_dynamic_state{}; |
| 893 | bool has_ext_line_rasterization{}; | 906 | bool has_ext_line_rasterization{}; |
| 907 | bool has_ext_primitive_topology_list_restart{}; | ||
| 894 | for (const std::string& extension : supported_extensions) { | 908 | for (const std::string& extension : supported_extensions) { |
| 895 | const auto test = [&](std::optional<std::reference_wrapper<bool>> status, const char* name, | 909 | const auto test = [&](std::optional<std::reference_wrapper<bool>> status, const char* name, |
| 896 | bool push) { | 910 | bool push) { |
| @@ -915,6 +929,8 @@ std::vector<const char*> Device::LoadExtensions(bool requires_surface) { | |||
| 915 | test(has_khr_shader_float16_int8, VK_KHR_SHADER_FLOAT16_INT8_EXTENSION_NAME, false); | 929 | test(has_khr_shader_float16_int8, VK_KHR_SHADER_FLOAT16_INT8_EXTENSION_NAME, false); |
| 916 | test(ext_depth_range_unrestricted, VK_EXT_DEPTH_RANGE_UNRESTRICTED_EXTENSION_NAME, true); | 930 | test(ext_depth_range_unrestricted, VK_EXT_DEPTH_RANGE_UNRESTRICTED_EXTENSION_NAME, true); |
| 917 | test(ext_index_type_uint8, VK_EXT_INDEX_TYPE_UINT8_EXTENSION_NAME, true); | 931 | test(ext_index_type_uint8, VK_EXT_INDEX_TYPE_UINT8_EXTENSION_NAME, true); |
| 932 | test(has_ext_primitive_topology_list_restart, | ||
| 933 | VK_EXT_PRIMITIVE_TOPOLOGY_LIST_RESTART_EXTENSION_NAME, true); | ||
| 918 | test(ext_sampler_filter_minmax, VK_EXT_SAMPLER_FILTER_MINMAX_EXTENSION_NAME, true); | 934 | test(ext_sampler_filter_minmax, VK_EXT_SAMPLER_FILTER_MINMAX_EXTENSION_NAME, true); |
| 919 | test(ext_shader_viewport_index_layer, VK_EXT_SHADER_VIEWPORT_INDEX_LAYER_EXTENSION_NAME, | 935 | test(ext_shader_viewport_index_layer, VK_EXT_SHADER_VIEWPORT_INDEX_LAYER_EXTENSION_NAME, |
| 920 | true); | 936 | true); |
| @@ -1113,6 +1129,19 @@ std::vector<const char*> Device::LoadExtensions(bool requires_surface) { | |||
| 1113 | khr_pipeline_executable_properties = true; | 1129 | khr_pipeline_executable_properties = true; |
| 1114 | } | 1130 | } |
| 1115 | } | 1131 | } |
| 1132 | if (has_ext_primitive_topology_list_restart) { | ||
| 1133 | VkPhysicalDevicePrimitiveTopologyListRestartFeaturesEXT primitive_topology_list_restart{}; | ||
| 1134 | primitive_topology_list_restart.sType = | ||
| 1135 | VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRIMITIVE_TOPOLOGY_LIST_RESTART_FEATURES_EXT; | ||
| 1136 | primitive_topology_list_restart.pNext = nullptr; | ||
| 1137 | features.pNext = &primitive_topology_list_restart; | ||
| 1138 | physical.GetFeatures2KHR(features); | ||
| 1139 | |||
| 1140 | is_topology_list_restart_supported = | ||
| 1141 | primitive_topology_list_restart.primitiveTopologyListRestart; | ||
| 1142 | is_patch_list_restart_supported = | ||
| 1143 | primitive_topology_list_restart.primitiveTopologyPatchListRestart; | ||
| 1144 | } | ||
| 1116 | if (has_khr_image_format_list && has_khr_swapchain_mutable_format) { | 1145 | if (has_khr_image_format_list && has_khr_swapchain_mutable_format) { |
| 1117 | extensions.push_back(VK_KHR_IMAGE_FORMAT_LIST_EXTENSION_NAME); | 1146 | extensions.push_back(VK_KHR_IMAGE_FORMAT_LIST_EXTENSION_NAME); |
| 1118 | extensions.push_back(VK_KHR_SWAPCHAIN_MUTABLE_FORMAT_EXTENSION_NAME); | 1147 | extensions.push_back(VK_KHR_SWAPCHAIN_MUTABLE_FORMAT_EXTENSION_NAME); |
diff --git a/src/video_core/vulkan_common/vulkan_device.h b/src/video_core/vulkan_common/vulkan_device.h index 10653ac6b..4c9d86aad 100644 --- a/src/video_core/vulkan_common/vulkan_device.h +++ b/src/video_core/vulkan_common/vulkan_device.h | |||
| @@ -238,6 +238,16 @@ public: | |||
| 238 | return khr_workgroup_memory_explicit_layout; | 238 | return khr_workgroup_memory_explicit_layout; |
| 239 | } | 239 | } |
| 240 | 240 | ||
| 241 | /// Returns true if the device supports VK_EXT_primitive_topology_list_restart. | ||
| 242 | bool IsTopologyListPrimitiveRestartSupported() const { | ||
| 243 | return is_topology_list_restart_supported; | ||
| 244 | } | ||
| 245 | |||
| 246 | /// Returns true if the device supports VK_EXT_primitive_topology_list_restart. | ||
| 247 | bool IsPatchListPrimitiveRestartSupported() const { | ||
| 248 | return is_patch_list_restart_supported; | ||
| 249 | } | ||
| 250 | |||
| 241 | /// Returns true if the device supports VK_EXT_index_type_uint8. | 251 | /// Returns true if the device supports VK_EXT_index_type_uint8. |
| 242 | bool IsExtIndexTypeUint8Supported() const { | 252 | bool IsExtIndexTypeUint8Supported() const { |
| 243 | return ext_index_type_uint8; | 253 | return ext_index_type_uint8; |
| @@ -401,6 +411,9 @@ private: | |||
| 401 | bool is_shader_int16_supported{}; ///< Support for int16. | 411 | bool is_shader_int16_supported{}; ///< Support for int16. |
| 402 | bool is_shader_storage_image_multisample{}; ///< Support for image operations on MSAA images. | 412 | bool is_shader_storage_image_multisample{}; ///< Support for image operations on MSAA images. |
| 403 | bool is_blit_depth_stencil_supported{}; ///< Support for blitting from and to depth stencil. | 413 | bool is_blit_depth_stencil_supported{}; ///< Support for blitting from and to depth stencil. |
| 414 | bool is_topology_list_restart_supported{}; ///< Support for primitive restart with list | ||
| 415 | ///< topologies. | ||
| 416 | bool is_patch_list_restart_supported{}; ///< Support for primitive restart with list patch. | ||
| 404 | bool nv_viewport_swizzle{}; ///< Support for VK_NV_viewport_swizzle. | 417 | bool nv_viewport_swizzle{}; ///< Support for VK_NV_viewport_swizzle. |
| 405 | bool nv_viewport_array2{}; ///< Support for VK_NV_viewport_array2. | 418 | bool nv_viewport_array2{}; ///< Support for VK_NV_viewport_array2. |
| 406 | bool nv_geometry_shader_passthrough{}; ///< Support for VK_NV_geometry_shader_passthrough. | 419 | bool nv_geometry_shader_passthrough{}; ///< Support for VK_NV_geometry_shader_passthrough. |