diff options
| author | 2021-06-23 03:32:41 -0300 | |
|---|---|---|
| committer | 2021-07-22 21:51:39 -0400 | |
| commit | 4f052a1f393d45843eabc237e21757be15f20062 (patch) | |
| tree | 7624b3e6f6f77f2301a575918a680b887d905ff4 /src/video_core/renderer_vulkan | |
| parent | shader: Only verify shader when graphics debugging is enabled (diff) | |
| download | yuzu-4f052a1f393d45843eabc237e21757be15f20062.tar.gz yuzu-4f052a1f393d45843eabc237e21757be15f20062.tar.xz yuzu-4f052a1f393d45843eabc237e21757be15f20062.zip | |
vk_graphics_pipeline: Implement conservative rendering
Diffstat (limited to 'src/video_core/renderer_vulkan')
| -rw-r--r-- | src/video_core/renderer_vulkan/fixed_pipeline_state.cpp | 1 | ||||
| -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 | 33 |
3 files changed, 26 insertions, 9 deletions
diff --git a/src/video_core/renderer_vulkan/fixed_pipeline_state.cpp b/src/video_core/renderer_vulkan/fixed_pipeline_state.cpp index 16cef8711..7563dc462 100644 --- a/src/video_core/renderer_vulkan/fixed_pipeline_state.cpp +++ b/src/video_core/renderer_vulkan/fixed_pipeline_state.cpp | |||
| @@ -87,6 +87,7 @@ void FixedPipelineState::Refresh(Tegra::Engines::Maxwell3D& maxwell3d, | |||
| 87 | depth_format.Assign(static_cast<u32>(regs.zeta.format)); | 87 | depth_format.Assign(static_cast<u32>(regs.zeta.format)); |
| 88 | y_negate.Assign(regs.screen_y_control.y_negate != 0 ? 1 : 0); | 88 | y_negate.Assign(regs.screen_y_control.y_negate != 0 ? 1 : 0); |
| 89 | provoking_vertex_last.Assign(regs.provoking_vertex_last != 0 ? 1 : 0); | 89 | provoking_vertex_last.Assign(regs.provoking_vertex_last != 0 ? 1 : 0); |
| 90 | conservative_raster_enable.Assign(regs.conservative_raster_enable != 0 ? 1 : 0); | ||
| 90 | 91 | ||
| 91 | for (size_t i = 0; i < regs.rt.size(); ++i) { | 92 | for (size_t i = 0; i < regs.rt.size(); ++i) { |
| 92 | color_formats[i] = static_cast<u8>(regs.rt[i].format); | 93 | color_formats[i] = static_cast<u8>(regs.rt[i].format); |
diff --git a/src/video_core/renderer_vulkan/fixed_pipeline_state.h b/src/video_core/renderer_vulkan/fixed_pipeline_state.h index 04f34eb97..66b57b636 100644 --- a/src/video_core/renderer_vulkan/fixed_pipeline_state.h +++ b/src/video_core/renderer_vulkan/fixed_pipeline_state.h | |||
| @@ -194,6 +194,7 @@ struct FixedPipelineState { | |||
| 194 | BitField<6, 5, u32> depth_format; | 194 | BitField<6, 5, u32> depth_format; |
| 195 | BitField<11, 1, u32> y_negate; | 195 | BitField<11, 1, u32> y_negate; |
| 196 | BitField<12, 1, u32> provoking_vertex_last; | 196 | BitField<12, 1, u32> provoking_vertex_last; |
| 197 | BitField<13, 1, u32> conservative_raster_enable; | ||
| 197 | }; | 198 | }; |
| 198 | std::array<u8, Maxwell::NumRenderTargets> color_formats; | 199 | std::array<u8, Maxwell::NumRenderTargets> color_formats; |
| 199 | 200 | ||
diff --git a/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp b/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp index 9eb353a88..70e183e65 100644 --- a/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp +++ b/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp | |||
| @@ -599,16 +599,9 @@ void GraphicsPipeline::MakePipeline(VkRenderPass render_pass) { | |||
| 599 | .pScissors = nullptr, | 599 | .pScissors = nullptr, |
| 600 | }; | 600 | }; |
| 601 | 601 | ||
| 602 | const VkPipelineRasterizationProvokingVertexStateCreateInfoEXT provoking_vertex{ | 602 | VkPipelineRasterizationStateCreateInfo rasterization_ci{ |
| 603 | .sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_PROVOKING_VERTEX_STATE_CREATE_INFO_EXT, | ||
| 604 | .pNext = nullptr, | ||
| 605 | .provokingVertexMode = key.state.provoking_vertex_last != 0 | ||
| 606 | ? VK_PROVOKING_VERTEX_MODE_LAST_VERTEX_EXT | ||
| 607 | : VK_PROVOKING_VERTEX_MODE_FIRST_VERTEX_EXT, | ||
| 608 | }; | ||
| 609 | const VkPipelineRasterizationStateCreateInfo rasterization_ci{ | ||
| 610 | .sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO, | 603 | .sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO, |
| 611 | .pNext = device.IsExtProvokingVertexSupported() ? &provoking_vertex : nullptr, | 604 | .pNext = nullptr, |
| 612 | .flags = 0, | 605 | .flags = 0, |
| 613 | .depthClampEnable = | 606 | .depthClampEnable = |
| 614 | static_cast<VkBool32>(key.state.depth_clamp_disabled == 0 ? VK_TRUE : VK_FALSE), | 607 | static_cast<VkBool32>(key.state.depth_clamp_disabled == 0 ? VK_TRUE : VK_FALSE), |
| @@ -625,6 +618,28 @@ void GraphicsPipeline::MakePipeline(VkRenderPass render_pass) { | |||
| 625 | .depthBiasSlopeFactor = 0.0f, | 618 | .depthBiasSlopeFactor = 0.0f, |
| 626 | .lineWidth = 1.0f, | 619 | .lineWidth = 1.0f, |
| 627 | }; | 620 | }; |
| 621 | VkPipelineRasterizationConservativeStateCreateInfoEXT conservative_raster{ | ||
| 622 | .sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_CONSERVATIVE_STATE_CREATE_INFO_EXT, | ||
| 623 | .pNext = nullptr, | ||
| 624 | .flags = 0, | ||
| 625 | .conservativeRasterizationMode = key.state.conservative_raster_enable != 0 | ||
| 626 | ? VK_CONSERVATIVE_RASTERIZATION_MODE_OVERESTIMATE_EXT | ||
| 627 | : VK_CONSERVATIVE_RASTERIZATION_MODE_DISABLED_EXT, | ||
| 628 | .extraPrimitiveOverestimationSize = 0.0f, | ||
| 629 | }; | ||
| 630 | VkPipelineRasterizationProvokingVertexStateCreateInfoEXT provoking_vertex{ | ||
| 631 | .sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_PROVOKING_VERTEX_STATE_CREATE_INFO_EXT, | ||
| 632 | .pNext = nullptr, | ||
| 633 | .provokingVertexMode = key.state.provoking_vertex_last != 0 | ||
| 634 | ? VK_PROVOKING_VERTEX_MODE_LAST_VERTEX_EXT | ||
| 635 | : VK_PROVOKING_VERTEX_MODE_FIRST_VERTEX_EXT, | ||
| 636 | }; | ||
| 637 | if (device.IsExtConservativeRasterizationSupported()) { | ||
| 638 | conservative_raster.pNext = std::exchange(rasterization_ci.pNext, &conservative_raster); | ||
| 639 | } | ||
| 640 | if (device.IsExtProvokingVertexSupported()) { | ||
| 641 | provoking_vertex.pNext = std::exchange(rasterization_ci.pNext, &provoking_vertex); | ||
| 642 | } | ||
| 628 | 643 | ||
| 629 | const VkPipelineMultisampleStateCreateInfo multisample_ci{ | 644 | const VkPipelineMultisampleStateCreateInfo multisample_ci{ |
| 630 | .sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO, | 645 | .sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO, |