diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp | 11 | ||||
| -rw-r--r-- | src/video_core/vulkan_common/vulkan_device.cpp | 31 | ||||
| -rw-r--r-- | src/video_core/vulkan_common/vulkan_device.h | 13 |
3 files changed, 50 insertions, 5 deletions
diff --git a/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp b/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp index 616a7b457..d514b71d0 100644 --- a/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp +++ b/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp | |||
| @@ -605,7 +605,11 @@ void GraphicsPipeline::MakePipeline(VkRenderPass render_pass) { | |||
| 605 | .flags = 0, | 605 | .flags = 0, |
| 606 | .topology = input_assembly_topology, | 606 | .topology = input_assembly_topology, |
| 607 | .primitiveRestartEnable = key.state.primitive_restart_enable != 0 && | 607 | .primitiveRestartEnable = key.state.primitive_restart_enable != 0 && |
| 608 | SupportsPrimitiveRestart(input_assembly_topology), | 608 | ((input_assembly_topology != VK_PRIMITIVE_TOPOLOGY_PATCH_LIST && |
| 609 | device.IsTopologyListPrimitiveRestartSupported()) || | ||
| 610 | SupportsPrimitiveRestart(input_assembly_topology) || | ||
| 611 | (input_assembly_topology == VK_PRIMITIVE_TOPOLOGY_PATCH_LIST && | ||
| 612 | device.IsPatchListPrimitiveRestartSupported())), | ||
| 609 | }; | 613 | }; |
| 610 | const VkPipelineTessellationStateCreateInfo tessellation_ci{ | 614 | const VkPipelineTessellationStateCreateInfo tessellation_ci{ |
| 611 | .sType = VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO, | 615 | .sType = VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO, |
| @@ -613,7 +617,6 @@ void GraphicsPipeline::MakePipeline(VkRenderPass render_pass) { | |||
| 613 | .flags = 0, | 617 | .flags = 0, |
| 614 | .patchControlPoints = key.state.patch_control_points_minus_one.Value() + 1, | 618 | .patchControlPoints = key.state.patch_control_points_minus_one.Value() + 1, |
| 615 | }; | 619 | }; |
| 616 | |||
| 617 | std::array<VkViewportSwizzleNV, Maxwell::NumViewports> swizzles; | 620 | std::array<VkViewportSwizzleNV, Maxwell::NumViewports> swizzles; |
| 618 | std::ranges::transform(key.state.viewport_swizzles, swizzles.begin(), UnpackViewportSwizzle); | 621 | std::ranges::transform(key.state.viewport_swizzles, swizzles.begin(), UnpackViewportSwizzle); |
| 619 | const VkPipelineViewportSwizzleStateCreateInfoNV swizzle_ci{ | 622 | const VkPipelineViewportSwizzleStateCreateInfoNV swizzle_ci{ |
| @@ -748,8 +751,8 @@ void GraphicsPipeline::MakePipeline(VkRenderPass render_pass) { | |||
| 748 | .sType = VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO, | 751 | .sType = VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO, |
| 749 | .pNext = nullptr, | 752 | .pNext = nullptr, |
| 750 | .flags = 0, | 753 | .flags = 0, |
| 751 | .logicOpEnable = VK_FALSE, | 754 | .logicOpEnable = key.state.logic_op_enable != 0, |
| 752 | .logicOp = VK_LOGIC_OP_COPY, | 755 | .logicOp = static_cast<VkLogicOp>(key.state.logic_op.Value()), |
| 753 | .attachmentCount = static_cast<u32>(cb_attachments.size()), | 756 | .attachmentCount = static_cast<u32>(cb_attachments.size()), |
| 754 | .pAttachments = cb_attachments.data(), | 757 | .pAttachments = cb_attachments.data(), |
| 755 | .blendConstants = {}, | 758 | .blendConstants = {}, |
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. |