summaryrefslogtreecommitdiff
path: root/src/video_core/renderer_vulkan
diff options
context:
space:
mode:
authorGravatar ReinUsesLisp2021-06-11 21:52:04 -0300
committerGravatar ameerj2021-07-22 21:51:35 -0400
commitd554778311c32e0a19ecdc13d7525b264d8443b5 (patch)
tree11329cc574aafbd2dde29e6161fb902ca67e8808 /src/video_core/renderer_vulkan
parentspirv/convert: Catch more signed operations oversights (diff)
downloadyuzu-d554778311c32e0a19ecdc13d7525b264d8443b5.tar.gz
yuzu-d554778311c32e0a19ecdc13d7525b264d8443b5.tar.xz
yuzu-d554778311c32e0a19ecdc13d7525b264d8443b5.zip
vulkan: Use VK_EXT_provoking_vertex when available
Diffstat (limited to 'src/video_core/renderer_vulkan')
-rw-r--r--src/video_core/renderer_vulkan/fixed_pipeline_state.cpp4
-rw-r--r--src/video_core/renderer_vulkan/fixed_pipeline_state.h1
-rw-r--r--src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp10
3 files changed, 12 insertions, 3 deletions
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,