diff options
Diffstat (limited to 'src')
8 files changed, 36 insertions, 8 deletions
diff --git a/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp b/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp index 6d664ed6b..3363a6877 100644 --- a/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp +++ b/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp | |||
| @@ -705,11 +705,12 @@ void GraphicsPipeline::MakePipeline(VkRenderPass render_pass) { | |||
| 705 | .pAttachments = cb_attachments.data(), | 705 | .pAttachments = cb_attachments.data(), |
| 706 | .blendConstants = {}, | 706 | .blendConstants = {}, |
| 707 | }; | 707 | }; |
| 708 | static_vector<VkDynamicState, 18> dynamic_states{ | 708 | static_vector<VkDynamicState, 19> dynamic_states{ |
| 709 | VK_DYNAMIC_STATE_VIEWPORT, VK_DYNAMIC_STATE_SCISSOR, | 709 | VK_DYNAMIC_STATE_VIEWPORT, VK_DYNAMIC_STATE_SCISSOR, |
| 710 | VK_DYNAMIC_STATE_DEPTH_BIAS, VK_DYNAMIC_STATE_BLEND_CONSTANTS, | 710 | VK_DYNAMIC_STATE_DEPTH_BIAS, VK_DYNAMIC_STATE_BLEND_CONSTANTS, |
| 711 | VK_DYNAMIC_STATE_DEPTH_BOUNDS, VK_DYNAMIC_STATE_STENCIL_COMPARE_MASK, | 711 | VK_DYNAMIC_STATE_DEPTH_BOUNDS, VK_DYNAMIC_STATE_STENCIL_COMPARE_MASK, |
| 712 | VK_DYNAMIC_STATE_STENCIL_WRITE_MASK, VK_DYNAMIC_STATE_STENCIL_REFERENCE, | 712 | VK_DYNAMIC_STATE_STENCIL_WRITE_MASK, VK_DYNAMIC_STATE_STENCIL_REFERENCE, |
| 713 | VK_DYNAMIC_STATE_LINE_WIDTH, | ||
| 713 | }; | 714 | }; |
| 714 | if (key.state.extended_dynamic_state) { | 715 | if (key.state.extended_dynamic_state) { |
| 715 | static constexpr std::array extended{ | 716 | static constexpr std::array extended{ |
diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.cpp b/src/video_core/renderer_vulkan/vk_rasterizer.cpp index f04c3394c..bb7301c53 100644 --- a/src/video_core/renderer_vulkan/vk_rasterizer.cpp +++ b/src/video_core/renderer_vulkan/vk_rasterizer.cpp | |||
| @@ -541,6 +541,7 @@ void RasterizerVulkan::UpdateDynamicStates() { | |||
| 541 | UpdateBlendConstants(regs); | 541 | UpdateBlendConstants(regs); |
| 542 | UpdateDepthBounds(regs); | 542 | UpdateDepthBounds(regs); |
| 543 | UpdateStencilFaces(regs); | 543 | UpdateStencilFaces(regs); |
| 544 | UpdateLineWidth(regs); | ||
| 544 | if (device.IsExtExtendedDynamicStateSupported()) { | 545 | if (device.IsExtExtendedDynamicStateSupported()) { |
| 545 | UpdateCullMode(regs); | 546 | UpdateCullMode(regs); |
| 546 | UpdateDepthBoundsTestEnable(regs); | 547 | UpdateDepthBoundsTestEnable(regs); |
| @@ -676,6 +677,14 @@ void RasterizerVulkan::UpdateStencilFaces(Tegra::Engines::Maxwell3D::Regs& regs) | |||
| 676 | } | 677 | } |
| 677 | } | 678 | } |
| 678 | 679 | ||
| 680 | void RasterizerVulkan::UpdateLineWidth(Tegra::Engines::Maxwell3D::Regs& regs) { | ||
| 681 | if (!state_tracker.TouchLineWidth()) { | ||
| 682 | return; | ||
| 683 | } | ||
| 684 | const float width = regs.line_smooth_enable ? regs.line_width_smooth : regs.line_width_aliased; | ||
| 685 | scheduler.Record([width](vk::CommandBuffer cmdbuf) { cmdbuf.SetLineWidth(width); }); | ||
| 686 | } | ||
| 687 | |||
| 679 | void RasterizerVulkan::UpdateCullMode(Tegra::Engines::Maxwell3D::Regs& regs) { | 688 | void RasterizerVulkan::UpdateCullMode(Tegra::Engines::Maxwell3D::Regs& regs) { |
| 680 | if (!state_tracker.TouchCullMode()) { | 689 | if (!state_tracker.TouchCullMode()) { |
| 681 | return; | 690 | return; |
diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.h b/src/video_core/renderer_vulkan/vk_rasterizer.h index c954fa7f8..866827247 100644 --- a/src/video_core/renderer_vulkan/vk_rasterizer.h +++ b/src/video_core/renderer_vulkan/vk_rasterizer.h | |||
| @@ -125,6 +125,7 @@ private: | |||
| 125 | void UpdateBlendConstants(Tegra::Engines::Maxwell3D::Regs& regs); | 125 | void UpdateBlendConstants(Tegra::Engines::Maxwell3D::Regs& regs); |
| 126 | void UpdateDepthBounds(Tegra::Engines::Maxwell3D::Regs& regs); | 126 | void UpdateDepthBounds(Tegra::Engines::Maxwell3D::Regs& regs); |
| 127 | void UpdateStencilFaces(Tegra::Engines::Maxwell3D::Regs& regs); | 127 | void UpdateStencilFaces(Tegra::Engines::Maxwell3D::Regs& regs); |
| 128 | void UpdateLineWidth(Tegra::Engines::Maxwell3D::Regs& regs); | ||
| 128 | 129 | ||
| 129 | void UpdateCullMode(Tegra::Engines::Maxwell3D::Regs& regs); | 130 | void UpdateCullMode(Tegra::Engines::Maxwell3D::Regs& regs); |
| 130 | void UpdateDepthBoundsTestEnable(Tegra::Engines::Maxwell3D::Regs& regs); | 131 | void UpdateDepthBoundsTestEnable(Tegra::Engines::Maxwell3D::Regs& regs); |
diff --git a/src/video_core/renderer_vulkan/vk_state_tracker.cpp b/src/video_core/renderer_vulkan/vk_state_tracker.cpp index 0ebe0473f..e3b7dd61c 100644 --- a/src/video_core/renderer_vulkan/vk_state_tracker.cpp +++ b/src/video_core/renderer_vulkan/vk_state_tracker.cpp | |||
| @@ -29,10 +29,10 @@ using Flags = Maxwell3D::DirtyState::Flags; | |||
| 29 | 29 | ||
| 30 | Flags MakeInvalidationFlags() { | 30 | Flags MakeInvalidationFlags() { |
| 31 | static constexpr int INVALIDATION_FLAGS[]{ | 31 | static constexpr int INVALIDATION_FLAGS[]{ |
| 32 | Viewports, Scissors, DepthBias, BlendConstants, | 32 | Viewports, Scissors, DepthBias, BlendConstants, DepthBounds, |
| 33 | DepthBounds, StencilProperties, CullMode, DepthBoundsEnable, | 33 | StencilProperties, LineWidth, CullMode, DepthBoundsEnable, DepthTestEnable, |
| 34 | DepthTestEnable, DepthWriteEnable, DepthCompareOp, FrontFace, | 34 | DepthWriteEnable, DepthCompareOp, FrontFace, StencilOp, StencilTestEnable, |
| 35 | StencilOp, StencilTestEnable, VertexBuffers, VertexInput, | 35 | VertexBuffers, VertexInput, |
| 36 | }; | 36 | }; |
| 37 | Flags flags{}; | 37 | Flags flags{}; |
| 38 | for (const int flag : INVALIDATION_FLAGS) { | 38 | for (const int flag : INVALIDATION_FLAGS) { |
| @@ -86,6 +86,11 @@ void SetupDirtyStencilProperties(Tables& tables) { | |||
| 86 | table[OFF(stencil_back_func_mask)] = StencilProperties; | 86 | table[OFF(stencil_back_func_mask)] = StencilProperties; |
| 87 | } | 87 | } |
| 88 | 88 | ||
| 89 | void SetupDirtyLineWidth(Tables& tables) { | ||
| 90 | tables[0][OFF(line_width_smooth)] = LineWidth; | ||
| 91 | tables[0][OFF(line_width_aliased)] = LineWidth; | ||
| 92 | } | ||
| 93 | |||
| 89 | void SetupDirtyCullMode(Tables& tables) { | 94 | void SetupDirtyCullMode(Tables& tables) { |
| 90 | auto& table = tables[0]; | 95 | auto& table = tables[0]; |
| 91 | table[OFF(cull_face)] = CullMode; | 96 | table[OFF(cull_face)] = CullMode; |
| @@ -180,6 +185,7 @@ StateTracker::StateTracker(Tegra::GPU& gpu) | |||
| 180 | SetupDirtyBlendConstants(tables); | 185 | SetupDirtyBlendConstants(tables); |
| 181 | SetupDirtyDepthBounds(tables); | 186 | SetupDirtyDepthBounds(tables); |
| 182 | SetupDirtyStencilProperties(tables); | 187 | SetupDirtyStencilProperties(tables); |
| 188 | SetupDirtyLineWidth(tables); | ||
| 183 | SetupDirtyCullMode(tables); | 189 | SetupDirtyCullMode(tables); |
| 184 | SetupDirtyDepthBoundsEnable(tables); | 190 | SetupDirtyDepthBoundsEnable(tables); |
| 185 | SetupDirtyDepthTestEnable(tables); | 191 | SetupDirtyDepthTestEnable(tables); |
diff --git a/src/video_core/renderer_vulkan/vk_state_tracker.h b/src/video_core/renderer_vulkan/vk_state_tracker.h index 1976b7e9b..5f78f6950 100644 --- a/src/video_core/renderer_vulkan/vk_state_tracker.h +++ b/src/video_core/renderer_vulkan/vk_state_tracker.h | |||
| @@ -31,6 +31,7 @@ enum : u8 { | |||
| 31 | BlendConstants, | 31 | BlendConstants, |
| 32 | DepthBounds, | 32 | DepthBounds, |
| 33 | StencilProperties, | 33 | StencilProperties, |
| 34 | LineWidth, | ||
| 34 | 35 | ||
| 35 | CullMode, | 36 | CullMode, |
| 36 | DepthBoundsEnable, | 37 | DepthBoundsEnable, |
| @@ -44,7 +45,7 @@ enum : u8 { | |||
| 44 | Blending, | 45 | Blending, |
| 45 | ViewportSwizzles, | 46 | ViewportSwizzles, |
| 46 | 47 | ||
| 47 | Last | 48 | Last, |
| 48 | }; | 49 | }; |
| 49 | static_assert(Last <= std::numeric_limits<u8>::max()); | 50 | static_assert(Last <= std::numeric_limits<u8>::max()); |
| 50 | 51 | ||
| @@ -93,6 +94,10 @@ public: | |||
| 93 | return Exchange(Dirty::StencilProperties, false); | 94 | return Exchange(Dirty::StencilProperties, false); |
| 94 | } | 95 | } |
| 95 | 96 | ||
| 97 | bool TouchLineWidth() const { | ||
| 98 | return Exchange(Dirty::LineWidth, false); | ||
| 99 | } | ||
| 100 | |||
| 96 | bool TouchCullMode() { | 101 | bool TouchCullMode() { |
| 97 | return Exchange(Dirty::CullMode, false); | 102 | return Exchange(Dirty::CullMode, false); |
| 98 | } | 103 | } |
diff --git a/src/video_core/vulkan_common/vulkan_device.cpp b/src/video_core/vulkan_common/vulkan_device.cpp index da4721e6b..912e03c5c 100644 --- a/src/video_core/vulkan_common/vulkan_device.cpp +++ b/src/video_core/vulkan_common/vulkan_device.cpp | |||
| @@ -227,7 +227,7 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR | |||
| 227 | .depthBiasClamp = true, | 227 | .depthBiasClamp = true, |
| 228 | .fillModeNonSolid = true, | 228 | .fillModeNonSolid = true, |
| 229 | .depthBounds = is_depth_bounds_supported, | 229 | .depthBounds = is_depth_bounds_supported, |
| 230 | .wideLines = false, | 230 | .wideLines = true, |
| 231 | .largePoints = true, | 231 | .largePoints = true, |
| 232 | .alphaToOne = false, | 232 | .alphaToOne = false, |
| 233 | .multiViewport = true, | 233 | .multiViewport = true, |
| @@ -703,7 +703,6 @@ void Device::CheckSuitability(bool requires_swapchain) const { | |||
| 703 | const std::array feature_report{ | 703 | const std::array feature_report{ |
| 704 | std::make_pair(features.robustBufferAccess, "robustBufferAccess"), | 704 | std::make_pair(features.robustBufferAccess, "robustBufferAccess"), |
| 705 | std::make_pair(features.vertexPipelineStoresAndAtomics, "vertexPipelineStoresAndAtomics"), | 705 | std::make_pair(features.vertexPipelineStoresAndAtomics, "vertexPipelineStoresAndAtomics"), |
| 706 | std::make_pair(features.robustBufferAccess, "robustBufferAccess"), | ||
| 707 | std::make_pair(features.imageCubeArray, "imageCubeArray"), | 706 | std::make_pair(features.imageCubeArray, "imageCubeArray"), |
| 708 | std::make_pair(features.independentBlend, "independentBlend"), | 707 | std::make_pair(features.independentBlend, "independentBlend"), |
| 709 | std::make_pair(features.depthClamp, "depthClamp"), | 708 | std::make_pair(features.depthClamp, "depthClamp"), |
| @@ -712,6 +711,7 @@ void Device::CheckSuitability(bool requires_swapchain) const { | |||
| 712 | std::make_pair(features.multiViewport, "multiViewport"), | 711 | std::make_pair(features.multiViewport, "multiViewport"), |
| 713 | std::make_pair(features.depthBiasClamp, "depthBiasClamp"), | 712 | std::make_pair(features.depthBiasClamp, "depthBiasClamp"), |
| 714 | std::make_pair(features.fillModeNonSolid, "fillModeNonSolid"), | 713 | std::make_pair(features.fillModeNonSolid, "fillModeNonSolid"), |
| 714 | std::make_pair(features.wideLines, "wideLines"), | ||
| 715 | std::make_pair(features.geometryShader, "geometryShader"), | 715 | std::make_pair(features.geometryShader, "geometryShader"), |
| 716 | std::make_pair(features.tessellationShader, "tessellationShader"), | 716 | std::make_pair(features.tessellationShader, "tessellationShader"), |
| 717 | std::make_pair(features.sampleRateShading, "sampleRateShading"), | 717 | std::make_pair(features.sampleRateShading, "sampleRateShading"), |
diff --git a/src/video_core/vulkan_common/vulkan_wrapper.cpp b/src/video_core/vulkan_common/vulkan_wrapper.cpp index d7e9fac22..bbf0fccae 100644 --- a/src/video_core/vulkan_common/vulkan_wrapper.cpp +++ b/src/video_core/vulkan_common/vulkan_wrapper.cpp | |||
| @@ -121,6 +121,7 @@ void Load(VkDevice device, DeviceDispatch& dld) noexcept { | |||
| 121 | X(vkCmdSetDepthTestEnableEXT); | 121 | X(vkCmdSetDepthTestEnableEXT); |
| 122 | X(vkCmdSetDepthWriteEnableEXT); | 122 | X(vkCmdSetDepthWriteEnableEXT); |
| 123 | X(vkCmdSetFrontFaceEXT); | 123 | X(vkCmdSetFrontFaceEXT); |
| 124 | X(vkCmdSetLineWidth); | ||
| 124 | X(vkCmdSetPrimitiveTopologyEXT); | 125 | X(vkCmdSetPrimitiveTopologyEXT); |
| 125 | X(vkCmdSetStencilOpEXT); | 126 | X(vkCmdSetStencilOpEXT); |
| 126 | X(vkCmdSetStencilTestEnableEXT); | 127 | X(vkCmdSetStencilTestEnableEXT); |
diff --git a/src/video_core/vulkan_common/vulkan_wrapper.h b/src/video_core/vulkan_common/vulkan_wrapper.h index d43b606f1..d76bb4324 100644 --- a/src/video_core/vulkan_common/vulkan_wrapper.h +++ b/src/video_core/vulkan_common/vulkan_wrapper.h | |||
| @@ -231,6 +231,7 @@ struct DeviceDispatch : InstanceDispatch { | |||
| 231 | PFN_vkCmdSetDepthWriteEnableEXT vkCmdSetDepthWriteEnableEXT{}; | 231 | PFN_vkCmdSetDepthWriteEnableEXT vkCmdSetDepthWriteEnableEXT{}; |
| 232 | PFN_vkCmdSetEvent vkCmdSetEvent{}; | 232 | PFN_vkCmdSetEvent vkCmdSetEvent{}; |
| 233 | PFN_vkCmdSetFrontFaceEXT vkCmdSetFrontFaceEXT{}; | 233 | PFN_vkCmdSetFrontFaceEXT vkCmdSetFrontFaceEXT{}; |
| 234 | PFN_vkCmdSetLineWidth vkCmdSetLineWidth{}; | ||
| 234 | PFN_vkCmdSetPrimitiveTopologyEXT vkCmdSetPrimitiveTopologyEXT{}; | 235 | PFN_vkCmdSetPrimitiveTopologyEXT vkCmdSetPrimitiveTopologyEXT{}; |
| 235 | PFN_vkCmdSetScissor vkCmdSetScissor{}; | 236 | PFN_vkCmdSetScissor vkCmdSetScissor{}; |
| 236 | PFN_vkCmdSetStencilCompareMask vkCmdSetStencilCompareMask{}; | 237 | PFN_vkCmdSetStencilCompareMask vkCmdSetStencilCompareMask{}; |
| @@ -1198,6 +1199,10 @@ public: | |||
| 1198 | dld->vkCmdSetFrontFaceEXT(handle, front_face); | 1199 | dld->vkCmdSetFrontFaceEXT(handle, front_face); |
| 1199 | } | 1200 | } |
| 1200 | 1201 | ||
| 1202 | void SetLineWidth(float line_width) const noexcept { | ||
| 1203 | dld->vkCmdSetLineWidth(handle, line_width); | ||
| 1204 | } | ||
| 1205 | |||
| 1201 | void SetPrimitiveTopologyEXT(VkPrimitiveTopology primitive_topology) const noexcept { | 1206 | void SetPrimitiveTopologyEXT(VkPrimitiveTopology primitive_topology) const noexcept { |
| 1202 | dld->vkCmdSetPrimitiveTopologyEXT(handle, primitive_topology); | 1207 | dld->vkCmdSetPrimitiveTopologyEXT(handle, primitive_topology); |
| 1203 | } | 1208 | } |