diff --git a/src/Ryujinx.Graphics.Vulkan/HardwareCapabilities.cs b/src/Ryujinx.Graphics.Vulkan/HardwareCapabilities.cs index c7df9bafc..9420aa31c 100644 --- a/src/Ryujinx.Graphics.Vulkan/HardwareCapabilities.cs +++ b/src/Ryujinx.Graphics.Vulkan/HardwareCapabilities.cs @@ -54,6 +54,7 @@ namespace Ryujinx.Graphics.Vulkan public readonly uint VertexBufferAlignment; public readonly uint SubTexelPrecisionBits; public readonly ulong MinResourceAlignment; + public readonly uint MaxTessellationPatchSize; public HardwareCapabilities( bool supportsIndexTypeUint8, @@ -72,6 +73,7 @@ namespace Ryujinx.Graphics.Vulkan bool supportsConditionalRendering, bool supportsExtendedDynamicState, PhysicalDeviceExtendedDynamicState2FeaturesEXT supportsExtendedDynamicState2, + uint maxTessellationPatchSize, bool supportsMultiView, bool supportsNullDescriptors, bool supportsPushDescriptors, @@ -111,6 +113,7 @@ namespace Ryujinx.Graphics.Vulkan SupportsConditionalRendering = supportsConditionalRendering; SupportsExtendedDynamicState = supportsExtendedDynamicState; SupportsExtendedDynamicState2 = supportsExtendedDynamicState2; + MaxTessellationPatchSize = maxTessellationPatchSize; SupportsMultiView = supportsMultiView; SupportsNullDescriptors = supportsNullDescriptors; SupportsPushDescriptors = supportsPushDescriptors; diff --git a/src/Ryujinx.Graphics.Vulkan/PipelineBase.cs b/src/Ryujinx.Graphics.Vulkan/PipelineBase.cs index fe4a4cb90..7afa9acce 100644 --- a/src/Ryujinx.Graphics.Vulkan/PipelineBase.cs +++ b/src/Ryujinx.Graphics.Vulkan/PipelineBase.cs @@ -992,6 +992,11 @@ namespace Ryujinx.Graphics.Vulkan public void SetPatchParameters(int vertices, ReadOnlySpan defaultOuterLevel, ReadOnlySpan defaultInnerLevel) { + if (vertices == 0 || vertices > Gd.Capabilities.MaxTessellationPatchSize) + { + return; + } + if (Gd.Capabilities.SupportsExtendedDynamicState2.ExtendedDynamicState2PatchControlPoints) { DynamicState.SetPatchControlPoints((uint)vertices); diff --git a/src/Ryujinx.Graphics.Vulkan/VulkanRenderer.cs b/src/Ryujinx.Graphics.Vulkan/VulkanRenderer.cs index bb6216be7..fbf8856e5 100644 --- a/src/Ryujinx.Graphics.Vulkan/VulkanRenderer.cs +++ b/src/Ryujinx.Graphics.Vulkan/VulkanRenderer.cs @@ -404,6 +404,7 @@ namespace Ryujinx.Graphics.Vulkan _physicalDevice.IsDeviceExtensionPresent(ExtConditionalRendering.ExtensionName), _physicalDevice.IsDeviceExtensionPresent(ExtExtendedDynamicState.ExtensionName), featuresExtendedDynamicState2, + _physicalDevice.PhysicalDeviceProperties.Limits.MaxTessellationPatchSize, features2.Features.MultiViewport && !(IsMoltenVk && Vendor == Vendor.Amd), // Workaround for AMD on MoltenVK issue featuresRobustness2.NullDescriptor || IsMoltenVk, supportsPushDescriptors && !IsMoltenVk,