1
0
Fork 0
mirror of https://github.com/Ryujinx/Ryujinx.git synced 2024-12-25 07:26:01 +00:00

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
{
GAL.PrimitiveTopology.Points => PrimitiveTopology.PointList,
GAL.PrimitiveTopology.Lines or
GAL.PrimitiveTopology.LineStrip or
GAL.PrimitiveTopology.LinesAdjacency or
GAL.PrimitiveTopology.LineStripAdjacency => PrimitiveTopology.LineList,
GAL.PrimitiveTopology.Triangles or
GAL.PrimitiveTopology.TriangleStrip or
GAL.PrimitiveTopology.TriangleFan or
GAL.PrimitiveTopology.TrianglesAdjacency or
GAL.PrimitiveTopology.TriangleStripAdjacency or
GAL.PrimitiveTopology.Polygon => PrimitiveTopology.TriangleList,
GAL.PrimitiveTopology.Patches => PrimitiveTopology.PatchList,
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),
PrimitiveTopology.PointList => PrimitiveTopology.PointList,
PrimitiveTopology.LineList or
PrimitiveTopology.LineStrip or
PrimitiveTopology.LineListWithAdjacency or
PrimitiveTopology.LineStripWithAdjacency => PrimitiveTopology.LineList,
PrimitiveTopology.TriangleList or
PrimitiveTopology.TriangleStrip or
PrimitiveTopology.TriangleFan or
PrimitiveTopology.TriangleListWithAdjacency or
PrimitiveTopology.TriangleStripWithAdjacency => PrimitiveTopology.TriangleList,
PrimitiveTopology.PatchList => PrimitiveTopology.PatchList,
_ => LogInvalidAndReturn(topology, nameof(PrimitiveTopology), PrimitiveTopology.TriangleList),
};
}

View file

@ -640,7 +640,6 @@ namespace Ryujinx.Graphics.Vulkan
var oldDepthTestEnable = _supportExtDynamic ? DynamicState.DepthTestEnable : _newState.DepthTestEnable;
var oldDepthWriteEnable = _supportExtDynamic ? DynamicState.DepthWriteEnable : _newState.DepthWriteEnable;
var oldTopology = _newState.Topology;
var oldTopologyClass = _newState.TopologyClass;
var oldViewports = DynamicState.Viewports;
var oldViewportsCount = _supportExtDynamic ? DynamicState.ViewportsCount : _newState.ViewportsCount;
@ -670,9 +669,9 @@ namespace Ryujinx.Graphics.Vulkan
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);
@ -1071,7 +1070,7 @@ namespace Ryujinx.Graphics.Vulkan
if (_supportExtDynamic)
{
var newTopologyClass = Gd.TopologyRemap(topology).ConvertToClass();
var newTopologyClass = vkTopology.ConvertToClass();
if ((_newState.TopologyClass != newTopologyClass))
{