From 4c0eb91d7e6bdbe42ffa6e950e3288f8066de089 Mon Sep 17 00:00:00 2001 From: riperiperi Date: Tue, 20 Sep 2022 22:38:48 +0100 Subject: Convert Quads to Triangles in Vulkan (#3715) * Add Index Buffer conversion for quads to Vulkan Also adds a reusable repeating pattern index buffer to use for non-indexed draws, and generalizes the conversion cache for buffers. * Fix some issues * End render pass before conversion * Resume transform feedback after we ensure we're in a pass. * Always generate UInt32 type indices for topology conversion * No it's not. * Remove unused code * Rely on TopologyRemap to convert quads to tris. * Remove double newline * Ensure render pass ends before stride or I8 conversion --- Ryujinx.Graphics.Vulkan/VulkanRenderer.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'Ryujinx.Graphics.Vulkan/VulkanRenderer.cs') diff --git a/Ryujinx.Graphics.Vulkan/VulkanRenderer.cs b/Ryujinx.Graphics.Vulkan/VulkanRenderer.cs index 3776be9e..d92fff49 100644 --- a/Ryujinx.Graphics.Vulkan/VulkanRenderer.cs +++ b/Ryujinx.Graphics.Vulkan/VulkanRenderer.cs @@ -471,6 +471,25 @@ namespace Ryujinx.Graphics.Vulkan Logger.Notice.Print(LogClass.Gpu, $"{GpuVendor} {GpuRenderer} ({GpuVersion})"); } + public GAL.PrimitiveTopology TopologyRemap(GAL.PrimitiveTopology topology) + { + return topology switch + { + GAL.PrimitiveTopology.Quads => GAL.PrimitiveTopology.Triangles, + GAL.PrimitiveTopology.QuadStrip => GAL.PrimitiveTopology.TriangleStrip, + _ => topology + }; + } + + public bool TopologyUnsupported(GAL.PrimitiveTopology topology) + { + return topology switch + { + GAL.PrimitiveTopology.Quads => true, + _ => false + }; + } + public void Initialize(GraphicsDebugLevel logLevel) { SetupContext(logLevel); -- cgit v1.2.3