diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/engines/maxwell_3d.h | 7 | ||||
| -rw-r--r-- | src/video_core/renderer_vulkan/fixed_pipeline_state.cpp | 4 | ||||
| -rw-r--r-- | src/video_core/renderer_vulkan/fixed_pipeline_state.h | 1 | ||||
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp | 10 | ||||
| -rw-r--r-- | src/video_core/vulkan_common/vulkan_device.cpp | 28 | ||||
| -rw-r--r-- | src/video_core/vulkan_common/vulkan_device.h | 6 |
6 files changed, 52 insertions, 4 deletions
diff --git a/src/video_core/engines/maxwell_3d.h b/src/video_core/engines/maxwell_3d.h index cbf94412b..04d5790f6 100644 --- a/src/video_core/engines/maxwell_3d.h +++ b/src/video_core/engines/maxwell_3d.h | |||
| @@ -1151,7 +1151,11 @@ public: | |||
| 1151 | u32 index; | 1151 | u32 index; |
| 1152 | } primitive_restart; | 1152 | } primitive_restart; |
| 1153 | 1153 | ||
| 1154 | INSERT_PADDING_WORDS_NOINIT(0x5F); | 1154 | INSERT_PADDING_WORDS_NOINIT(0xE); |
| 1155 | |||
| 1156 | u32 provoking_vertex_last; | ||
| 1157 | |||
| 1158 | INSERT_PADDING_WORDS_NOINIT(0x50); | ||
| 1155 | 1159 | ||
| 1156 | struct { | 1160 | struct { |
| 1157 | u32 start_addr_high; | 1161 | u32 start_addr_high; |
| @@ -1672,6 +1676,7 @@ ASSERT_REG_POSITION(point_coord_replace, 0x581); | |||
| 1672 | ASSERT_REG_POSITION(code_address, 0x582); | 1676 | ASSERT_REG_POSITION(code_address, 0x582); |
| 1673 | ASSERT_REG_POSITION(draw, 0x585); | 1677 | ASSERT_REG_POSITION(draw, 0x585); |
| 1674 | ASSERT_REG_POSITION(primitive_restart, 0x591); | 1678 | ASSERT_REG_POSITION(primitive_restart, 0x591); |
| 1679 | ASSERT_REG_POSITION(provoking_vertex_last, 0x5A1); | ||
| 1675 | ASSERT_REG_POSITION(index_array, 0x5F2); | 1680 | ASSERT_REG_POSITION(index_array, 0x5F2); |
| 1676 | ASSERT_REG_POSITION(polygon_offset_clamp, 0x61F); | 1681 | ASSERT_REG_POSITION(polygon_offset_clamp, 0x61F); |
| 1677 | ASSERT_REG_POSITION(instanced_arrays, 0x620); | 1682 | ASSERT_REG_POSITION(instanced_arrays, 0x620); |
diff --git a/src/video_core/renderer_vulkan/fixed_pipeline_state.cpp b/src/video_core/renderer_vulkan/fixed_pipeline_state.cpp index 1486d088a..f121fbf0e 100644 --- a/src/video_core/renderer_vulkan/fixed_pipeline_state.cpp +++ b/src/video_core/renderer_vulkan/fixed_pipeline_state.cpp | |||
| @@ -84,6 +84,8 @@ void FixedPipelineState::Refresh(Tegra::Engines::Maxwell3D& maxwell3d, | |||
| 84 | early_z.Assign(regs.force_early_fragment_tests != 0 ? 1 : 0); | 84 | early_z.Assign(regs.force_early_fragment_tests != 0 ? 1 : 0); |
| 85 | depth_enabled.Assign(regs.zeta_enable != 0 ? 1 : 0); | 85 | depth_enabled.Assign(regs.zeta_enable != 0 ? 1 : 0); |
| 86 | depth_format.Assign(static_cast<u32>(regs.zeta.format)); | 86 | depth_format.Assign(static_cast<u32>(regs.zeta.format)); |
| 87 | y_negate.Assign(regs.screen_y_control.y_negate != 0 ? 1 : 0); | ||
| 88 | provoking_vertex_last.Assign(regs.provoking_vertex_last != 0 ? 1 : 0); | ||
| 87 | 89 | ||
| 88 | for (size_t i = 0; i < regs.rt.size(); ++i) { | 90 | for (size_t i = 0; i < regs.rt.size(); ++i) { |
| 89 | color_formats[i] = static_cast<u8>(regs.rt[i].format); | 91 | color_formats[i] = static_cast<u8>(regs.rt[i].format); |
| @@ -91,8 +93,6 @@ void FixedPipelineState::Refresh(Tegra::Engines::Maxwell3D& maxwell3d, | |||
| 91 | alpha_test_ref = Common::BitCast<u32>(regs.alpha_test_ref); | 93 | alpha_test_ref = Common::BitCast<u32>(regs.alpha_test_ref); |
| 92 | point_size = Common::BitCast<u32>(regs.point_size); | 94 | point_size = Common::BitCast<u32>(regs.point_size); |
| 93 | 95 | ||
| 94 | y_negate.Assign(regs.screen_y_control.y_negate != 0 ? 1 : 0); | ||
| 95 | |||
| 96 | if (maxwell3d.dirty.flags[Dirty::InstanceDivisors]) { | 96 | if (maxwell3d.dirty.flags[Dirty::InstanceDivisors]) { |
| 97 | maxwell3d.dirty.flags[Dirty::InstanceDivisors] = false; | 97 | maxwell3d.dirty.flags[Dirty::InstanceDivisors] = false; |
| 98 | for (size_t index = 0; index < Maxwell::NumVertexArrays; ++index) { | 98 | for (size_t index = 0; index < Maxwell::NumVertexArrays; ++index) { |
diff --git a/src/video_core/renderer_vulkan/fixed_pipeline_state.h b/src/video_core/renderer_vulkan/fixed_pipeline_state.h index 0f1eff9cd..60adae316 100644 --- a/src/video_core/renderer_vulkan/fixed_pipeline_state.h +++ b/src/video_core/renderer_vulkan/fixed_pipeline_state.h | |||
| @@ -192,6 +192,7 @@ struct FixedPipelineState { | |||
| 192 | BitField<4, 1, u32> depth_enabled; | 192 | BitField<4, 1, u32> depth_enabled; |
| 193 | BitField<5, 5, u32> depth_format; | 193 | BitField<5, 5, u32> depth_format; |
| 194 | BitField<10, 1, u32> y_negate; | 194 | BitField<10, 1, u32> y_negate; |
| 195 | BitField<11, 1, u32> provoking_vertex_last; | ||
| 195 | }; | 196 | }; |
| 196 | std::array<u8, Maxwell::NumRenderTargets> color_formats; | 197 | std::array<u8, Maxwell::NumRenderTargets> color_formats; |
| 197 | 198 | ||
diff --git a/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp b/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp index 5c916c869..06a80c2ba 100644 --- a/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp +++ b/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp | |||
| @@ -567,9 +567,16 @@ void GraphicsPipeline::MakePipeline(VkRenderPass render_pass) { | |||
| 567 | viewport_ci.pNext = &swizzle_ci; | 567 | viewport_ci.pNext = &swizzle_ci; |
| 568 | } | 568 | } |
| 569 | 569 | ||
| 570 | const VkPipelineRasterizationProvokingVertexStateCreateInfoEXT provoking_vertex{ | ||
| 571 | .sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_PROVOKING_VERTEX_STATE_CREATE_INFO_EXT, | ||
| 572 | .pNext = nullptr, | ||
| 573 | .provokingVertexMode = key.state.provoking_vertex_last != 0 | ||
| 574 | ? VK_PROVOKING_VERTEX_MODE_LAST_VERTEX_EXT | ||
| 575 | : VK_PROVOKING_VERTEX_MODE_FIRST_VERTEX_EXT, | ||
| 576 | }; | ||
| 570 | const VkPipelineRasterizationStateCreateInfo rasterization_ci{ | 577 | const VkPipelineRasterizationStateCreateInfo rasterization_ci{ |
| 571 | .sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO, | 578 | .sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO, |
| 572 | .pNext = nullptr, | 579 | .pNext = device.IsExtProvokingVertexSupported() ? &provoking_vertex : nullptr, |
| 573 | .flags = 0, | 580 | .flags = 0, |
| 574 | .depthClampEnable = | 581 | .depthClampEnable = |
| 575 | static_cast<VkBool32>(key.state.depth_clamp_disabled == 0 ? VK_TRUE : VK_FALSE), | 582 | static_cast<VkBool32>(key.state.depth_clamp_disabled == 0 ? VK_TRUE : VK_FALSE), |
| @@ -586,6 +593,7 @@ void GraphicsPipeline::MakePipeline(VkRenderPass render_pass) { | |||
| 586 | .depthBiasSlopeFactor = 0.0f, | 593 | .depthBiasSlopeFactor = 0.0f, |
| 587 | .lineWidth = 1.0f, | 594 | .lineWidth = 1.0f, |
| 588 | }; | 595 | }; |
| 596 | |||
| 589 | const VkPipelineMultisampleStateCreateInfo multisample_ci{ | 597 | const VkPipelineMultisampleStateCreateInfo multisample_ci{ |
| 590 | .sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO, | 598 | .sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO, |
| 591 | .pNext = nullptr, | 599 | .pNext = nullptr, |
diff --git a/src/video_core/vulkan_common/vulkan_device.cpp b/src/video_core/vulkan_common/vulkan_device.cpp index 2b715baba..618535aae 100644 --- a/src/video_core/vulkan_common/vulkan_device.cpp +++ b/src/video_core/vulkan_common/vulkan_device.cpp | |||
| @@ -412,6 +412,19 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR | |||
| 412 | LOG_INFO(Render_Vulkan, "Device doesn't support extended dynamic state"); | 412 | LOG_INFO(Render_Vulkan, "Device doesn't support extended dynamic state"); |
| 413 | } | 413 | } |
| 414 | 414 | ||
| 415 | VkPhysicalDeviceProvokingVertexFeaturesEXT provoking_vertex; | ||
| 416 | if (ext_provoking_vertex) { | ||
| 417 | provoking_vertex = { | ||
| 418 | .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROVOKING_VERTEX_FEATURES_EXT, | ||
| 419 | .pNext = nullptr, | ||
| 420 | .provokingVertexLast = VK_TRUE, | ||
| 421 | .transformFeedbackPreservesProvokingVertex = VK_TRUE, | ||
| 422 | }; | ||
| 423 | SetNext(next, provoking_vertex); | ||
| 424 | } else { | ||
| 425 | LOG_INFO(Render_Vulkan, "Device doesn't support provoking vertex last"); | ||
| 426 | } | ||
| 427 | |||
| 415 | VkPhysicalDeviceShaderAtomicInt64FeaturesKHR atomic_int64; | 428 | VkPhysicalDeviceShaderAtomicInt64FeaturesKHR atomic_int64; |
| 416 | if (ext_shader_atomic_int64) { | 429 | if (ext_shader_atomic_int64) { |
| 417 | atomic_int64 = { | 430 | atomic_int64 = { |
| @@ -718,6 +731,7 @@ std::vector<const char*> Device::LoadExtensions(bool requires_surface) { | |||
| 718 | bool has_ext_custom_border_color{}; | 731 | bool has_ext_custom_border_color{}; |
| 719 | bool has_ext_extended_dynamic_state{}; | 732 | bool has_ext_extended_dynamic_state{}; |
| 720 | bool has_ext_shader_atomic_int64{}; | 733 | bool has_ext_shader_atomic_int64{}; |
| 734 | bool has_ext_provoking_vertex{}; | ||
| 721 | for (const VkExtensionProperties& extension : physical.EnumerateDeviceExtensionProperties()) { | 735 | for (const VkExtensionProperties& extension : physical.EnumerateDeviceExtensionProperties()) { |
| 722 | const auto test = [&](std::optional<std::reference_wrapper<bool>> status, const char* name, | 736 | const auto test = [&](std::optional<std::reference_wrapper<bool>> status, const char* name, |
| 723 | bool push) { | 737 | bool push) { |
| @@ -748,6 +762,7 @@ std::vector<const char*> Device::LoadExtensions(bool requires_surface) { | |||
| 748 | test(has_ext_custom_border_color, VK_EXT_CUSTOM_BORDER_COLOR_EXTENSION_NAME, false); | 762 | test(has_ext_custom_border_color, VK_EXT_CUSTOM_BORDER_COLOR_EXTENSION_NAME, false); |
| 749 | test(has_ext_extended_dynamic_state, VK_EXT_EXTENDED_DYNAMIC_STATE_EXTENSION_NAME, false); | 763 | test(has_ext_extended_dynamic_state, VK_EXT_EXTENDED_DYNAMIC_STATE_EXTENSION_NAME, false); |
| 750 | test(has_ext_subgroup_size_control, VK_EXT_SUBGROUP_SIZE_CONTROL_EXTENSION_NAME, false); | 764 | test(has_ext_subgroup_size_control, VK_EXT_SUBGROUP_SIZE_CONTROL_EXTENSION_NAME, false); |
| 765 | test(has_ext_provoking_vertex, VK_EXT_PROVOKING_VERTEX_EXTENSION_NAME, false); | ||
| 751 | test(has_ext_shader_atomic_int64, VK_KHR_SHADER_ATOMIC_INT64_EXTENSION_NAME, false); | 766 | test(has_ext_shader_atomic_int64, VK_KHR_SHADER_ATOMIC_INT64_EXTENSION_NAME, false); |
| 752 | test(has_khr_workgroup_memory_explicit_layout, | 767 | test(has_khr_workgroup_memory_explicit_layout, |
| 753 | VK_KHR_WORKGROUP_MEMORY_EXPLICIT_LAYOUT_EXTENSION_NAME, false); | 768 | VK_KHR_WORKGROUP_MEMORY_EXPLICIT_LAYOUT_EXTENSION_NAME, false); |
| @@ -799,6 +814,19 @@ std::vector<const char*> Device::LoadExtensions(bool requires_surface) { | |||
| 799 | } else { | 814 | } else { |
| 800 | is_warp_potentially_bigger = true; | 815 | is_warp_potentially_bigger = true; |
| 801 | } | 816 | } |
| 817 | if (has_ext_provoking_vertex) { | ||
| 818 | VkPhysicalDeviceProvokingVertexFeaturesEXT provoking_vertex; | ||
| 819 | provoking_vertex.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROVOKING_VERTEX_FEATURES_EXT; | ||
| 820 | provoking_vertex.pNext = nullptr; | ||
| 821 | features.pNext = &provoking_vertex; | ||
| 822 | physical.GetFeatures2KHR(features); | ||
| 823 | |||
| 824 | if (provoking_vertex.provokingVertexLast && | ||
| 825 | provoking_vertex.transformFeedbackPreservesProvokingVertex) { | ||
| 826 | extensions.push_back(VK_EXT_PROVOKING_VERTEX_EXTENSION_NAME); | ||
| 827 | ext_provoking_vertex = true; | ||
| 828 | } | ||
| 829 | } | ||
| 802 | if (has_ext_shader_atomic_int64) { | 830 | if (has_ext_shader_atomic_int64) { |
| 803 | VkPhysicalDeviceShaderAtomicInt64Features atomic_int64; | 831 | VkPhysicalDeviceShaderAtomicInt64Features atomic_int64; |
| 804 | atomic_int64.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_FEATURES_EXT; | 832 | atomic_int64.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_FEATURES_EXT; |
diff --git a/src/video_core/vulkan_common/vulkan_device.h b/src/video_core/vulkan_common/vulkan_device.h index 9bc1fb947..37f589612 100644 --- a/src/video_core/vulkan_common/vulkan_device.h +++ b/src/video_core/vulkan_common/vulkan_device.h | |||
| @@ -244,6 +244,11 @@ public: | |||
| 244 | return ext_shader_stencil_export; | 244 | return ext_shader_stencil_export; |
| 245 | } | 245 | } |
| 246 | 246 | ||
| 247 | /// Returns true if the device supports VK_EXT_provoking_vertex. | ||
| 248 | bool IsExtProvokingVertexSupported() const { | ||
| 249 | return ext_provoking_vertex; | ||
| 250 | } | ||
| 251 | |||
| 247 | /// Returns true if the device supports VK_KHR_shader_atomic_int64. | 252 | /// Returns true if the device supports VK_KHR_shader_atomic_int64. |
| 248 | bool IsExtShaderAtomicInt64Supported() const { | 253 | bool IsExtShaderAtomicInt64Supported() const { |
| 249 | return ext_shader_atomic_int64; | 254 | return ext_shader_atomic_int64; |
| @@ -346,6 +351,7 @@ private: | |||
| 346 | bool ext_extended_dynamic_state{}; ///< Support for VK_EXT_extended_dynamic_state. | 351 | bool ext_extended_dynamic_state{}; ///< Support for VK_EXT_extended_dynamic_state. |
| 347 | bool ext_shader_stencil_export{}; ///< Support for VK_EXT_shader_stencil_export. | 352 | bool ext_shader_stencil_export{}; ///< Support for VK_EXT_shader_stencil_export. |
| 348 | bool ext_shader_atomic_int64{}; ///< Support for VK_KHR_shader_atomic_int64. | 353 | bool ext_shader_atomic_int64{}; ///< Support for VK_KHR_shader_atomic_int64. |
| 354 | bool ext_provoking_vertex{}; ///< Support for VK_EXT_provoking_vertex. | ||
| 349 | bool nv_device_diagnostics_config{}; ///< Support for VK_NV_device_diagnostics_config. | 355 | bool nv_device_diagnostics_config{}; ///< Support for VK_NV_device_diagnostics_config. |
| 350 | bool has_renderdoc{}; ///< Has RenderDoc attached | 356 | bool has_renderdoc{}; ///< Has RenderDoc attached |
| 351 | bool has_nsight_graphics{}; ///< Has Nsight Graphics attached | 357 | bool has_nsight_graphics{}; ///< Has Nsight Graphics attached |