Implement small indexed draws and other fixes to make guest Vulkan work (#1558)
This commit is contained in:
parent
e00ca92063
commit
bd28ce90e6
10 changed files with 357 additions and 133 deletions
|
@ -86,12 +86,17 @@ namespace Ryujinx.Graphics.Gpu.State
|
|||
PrimitiveRestartState = 0x591,
|
||||
IndexBufferState = 0x5f2,
|
||||
IndexBufferCount = 0x5f8,
|
||||
DrawIndexedSmall = 0x5f9,
|
||||
DrawIndexedSmall2 = 0x5fa,
|
||||
DrawIndexedSmallIncInstance = 0x5fc,
|
||||
DrawIndexedSmallIncInstance2 = 0x5fd,
|
||||
DepthBiasClamp = 0x61f,
|
||||
VertexBufferInstanced = 0x620,
|
||||
VertexProgramPointSize = 0x644,
|
||||
FaceState = 0x646,
|
||||
ViewportTransformEnable = 0x64b,
|
||||
ViewVolumeClipControl = 0x64f,
|
||||
PrimitiveTypeOverride = 0x65c,
|
||||
LogicOpState = 0x671,
|
||||
Clear = 0x674,
|
||||
RtColorMask = 0x680,
|
||||
|
|
|
@ -24,6 +24,25 @@ namespace Ryujinx.Graphics.Gpu.State
|
|||
Patches
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Alternative primitive type that might override <see cref="PrimitiveType"/>.
|
||||
/// </summary>
|
||||
enum PrimitiveTypeOverride
|
||||
{
|
||||
Invalid = 0,
|
||||
Points = 1,
|
||||
Lines = 2,
|
||||
LineStrip = 3,
|
||||
Triangles = 4,
|
||||
TriangleStrip = 5,
|
||||
TriangleFan = 0x1015,
|
||||
LinesAdjacency = 10,
|
||||
LineStripAdjacency = 11,
|
||||
TrianglesAdjacency = 12,
|
||||
TriangleStripAdjacency = 13,
|
||||
Patches = 14
|
||||
}
|
||||
|
||||
static class PrimitiveTypeConverter
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -53,5 +72,29 @@ namespace Ryujinx.Graphics.Gpu.State
|
|||
_ => PrimitiveTopology.Triangles
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts the primitive type into something that can be used with the host API.
|
||||
/// </summary>
|
||||
/// <param name="type">The primitive type to convert</param>
|
||||
/// <returns>A host compatible enum value</returns>
|
||||
public static PrimitiveTopology Convert(this PrimitiveTypeOverride type)
|
||||
{
|
||||
return type switch
|
||||
{
|
||||
PrimitiveTypeOverride.Points => PrimitiveTopology.Points,
|
||||
PrimitiveTypeOverride.Lines => PrimitiveTopology.Lines,
|
||||
PrimitiveTypeOverride.LineStrip => PrimitiveTopology.LineStrip,
|
||||
PrimitiveTypeOverride.Triangles => PrimitiveTopology.Triangles,
|
||||
PrimitiveTypeOverride.TriangleStrip => PrimitiveTopology.TriangleStrip,
|
||||
PrimitiveTypeOverride.TriangleFan => PrimitiveTopology.TriangleFan,
|
||||
PrimitiveTypeOverride.LinesAdjacency => PrimitiveTopology.LinesAdjacency,
|
||||
PrimitiveTypeOverride.LineStripAdjacency => PrimitiveTopology.LineStripAdjacency,
|
||||
PrimitiveTypeOverride.TrianglesAdjacency => PrimitiveTopology.TrianglesAdjacency,
|
||||
PrimitiveTypeOverride.TriangleStripAdjacency => PrimitiveTopology.TriangleStripAdjacency,
|
||||
PrimitiveTypeOverride.Patches => PrimitiveTopology.Patches,
|
||||
_ => PrimitiveTopology.Triangles
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue