Conver to TopologyClass from Vulkan Topology

This commit is contained in:
sunshineinabox 2024-08-01 08:19:11 -07:00
parent adc7528b54
commit 9b02fd6dc0
2 changed files with 16 additions and 20 deletions

View file

@ -310,25 +310,22 @@ namespace Ryujinx.Graphics.Vulkan
}; };
} }
public static PrimitiveTopology ConvertToClass(this GAL.PrimitiveTopology topology) public static PrimitiveTopology ConvertToClass(this PrimitiveTopology topology)
{ {
return topology switch return topology switch
{ {
GAL.PrimitiveTopology.Points => PrimitiveTopology.PointList, PrimitiveTopology.PointList => PrimitiveTopology.PointList,
GAL.PrimitiveTopology.Lines or PrimitiveTopology.LineList or
GAL.PrimitiveTopology.LineStrip or PrimitiveTopology.LineStrip or
GAL.PrimitiveTopology.LinesAdjacency or PrimitiveTopology.LineListWithAdjacency or
GAL.PrimitiveTopology.LineStripAdjacency => PrimitiveTopology.LineList, PrimitiveTopology.LineStripWithAdjacency => PrimitiveTopology.LineList,
GAL.PrimitiveTopology.Triangles or PrimitiveTopology.TriangleList or
GAL.PrimitiveTopology.TriangleStrip or PrimitiveTopology.TriangleStrip or
GAL.PrimitiveTopology.TriangleFan or PrimitiveTopology.TriangleFan or
GAL.PrimitiveTopology.TrianglesAdjacency or PrimitiveTopology.TriangleListWithAdjacency or
GAL.PrimitiveTopology.TriangleStripAdjacency or PrimitiveTopology.TriangleStripWithAdjacency => PrimitiveTopology.TriangleList,
GAL.PrimitiveTopology.Polygon => PrimitiveTopology.TriangleList, PrimitiveTopology.PatchList => PrimitiveTopology.PatchList,
GAL.PrimitiveTopology.Patches => PrimitiveTopology.PatchList, _ => LogInvalidAndReturn(topology, nameof(PrimitiveTopology), PrimitiveTopology.TriangleList),
GAL.PrimitiveTopology.Quads => throw new NotSupportedException("Quad topology is not available in Vulkan."),
GAL.PrimitiveTopology.QuadStrip => throw new NotSupportedException("QuadStrip topology is not available in Vulkan."),
_ => LogInvalidAndReturn(topology, nameof(GAL.PrimitiveTopology), PrimitiveTopology.TriangleList),
}; };
} }

View file

@ -640,7 +640,6 @@ namespace Ryujinx.Graphics.Vulkan
var oldDepthTestEnable = _supportExtDynamic ? DynamicState.DepthTestEnable : _newState.DepthTestEnable; var oldDepthTestEnable = _supportExtDynamic ? DynamicState.DepthTestEnable : _newState.DepthTestEnable;
var oldDepthWriteEnable = _supportExtDynamic ? DynamicState.DepthWriteEnable : _newState.DepthWriteEnable; var oldDepthWriteEnable = _supportExtDynamic ? DynamicState.DepthWriteEnable : _newState.DepthWriteEnable;
var oldTopology = _newState.Topology; var oldTopology = _newState.Topology;
var oldTopologyClass = _newState.TopologyClass;
var oldViewports = DynamicState.Viewports; var oldViewports = DynamicState.Viewports;
var oldViewportsCount = _supportExtDynamic ? DynamicState.ViewportsCount : _newState.ViewportsCount; var oldViewportsCount = _supportExtDynamic ? DynamicState.ViewportsCount : _newState.ViewportsCount;
@ -670,9 +669,9 @@ namespace Ryujinx.Graphics.Vulkan
if (_supportExtDynamic) if (_supportExtDynamic)
{ {
if (oldTopologyClass != Silk.NET.Vulkan.PrimitiveTopology.TriangleList) if (oldTopology.ConvertToClass() != _newState.TopologyClass.ConvertToClass())
{ {
_newState.TopologyClass = oldTopology; _newState.TopologyClass = _newState.TopologyClass.ConvertToClass();
} }
DynamicState.SetCullMode(oldCullMode); DynamicState.SetCullMode(oldCullMode);
@ -1071,7 +1070,7 @@ namespace Ryujinx.Graphics.Vulkan
if (_supportExtDynamic) if (_supportExtDynamic)
{ {
var newTopologyClass = Gd.TopologyRemap(topology).ConvertToClass(); var newTopologyClass = vkTopology.ConvertToClass();
if ((_newState.TopologyClass != newTopologyClass)) if ((_newState.TopologyClass != newTopologyClass))
{ {