mirror of
https://git.naxdy.org/Mirror/Ryujinx.git
synced 2024-12-27 02:53:04 +00:00
Fix counted indirect draws
Fixes Monster Hunter Rise and Apollo Justice
This commit is contained in:
parent
bb917a4aa4
commit
6fed9b51b5
1 changed files with 22 additions and 10 deletions
|
@ -521,6 +521,11 @@ namespace Ryujinx.Graphics.Metal
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DrawIndexedIndirect(BufferRange indirectBuffer)
|
public void DrawIndexedIndirect(BufferRange indirectBuffer)
|
||||||
|
{
|
||||||
|
DrawIndexedIndirectOffset(indirectBuffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DrawIndexedIndirectOffset(BufferRange indirectBuffer, int offset = 0)
|
||||||
{
|
{
|
||||||
// TODO: Reindex unsupported topologies
|
// TODO: Reindex unsupported topologies
|
||||||
if (TopologyUnsupported(_encoderStateManager.Topology))
|
if (TopologyUnsupported(_encoderStateManager.Topology))
|
||||||
|
@ -534,7 +539,7 @@ namespace Ryujinx.Graphics.Metal
|
||||||
|
|
||||||
var primitiveType = TopologyRemap(_encoderStateManager.Topology).Convert();
|
var primitiveType = TopologyRemap(_encoderStateManager.Topology).Convert();
|
||||||
|
|
||||||
(MTLBuffer indexBuffer, int offset, MTLIndexType type) = _encoderStateManager.IndexBuffer.GetIndexBuffer(_renderer, Cbs);
|
(MTLBuffer indexBuffer, int indexOffset, MTLIndexType type) = _encoderStateManager.IndexBuffer.GetIndexBuffer(_renderer, Cbs);
|
||||||
|
|
||||||
if (indexBuffer.NativePtr != IntPtr.Zero && buffer.NativePtr != IntPtr.Zero)
|
if (indexBuffer.NativePtr != IntPtr.Zero && buffer.NativePtr != IntPtr.Zero)
|
||||||
{
|
{
|
||||||
|
@ -544,20 +549,26 @@ namespace Ryujinx.Graphics.Metal
|
||||||
primitiveType,
|
primitiveType,
|
||||||
type,
|
type,
|
||||||
indexBuffer,
|
indexBuffer,
|
||||||
(ulong)offset,
|
(ulong)indexOffset,
|
||||||
buffer,
|
buffer,
|
||||||
(ulong)indirectBuffer.Offset);
|
(ulong)(indirectBuffer.Offset + offset));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DrawIndexedIndirectCount(BufferRange indirectBuffer, BufferRange parameterBuffer, int maxDrawCount, int stride)
|
public void DrawIndexedIndirectCount(BufferRange indirectBuffer, BufferRange parameterBuffer, int maxDrawCount, int stride)
|
||||||
{
|
{
|
||||||
// TODO: Properly support count
|
for (int i = 0; i < maxDrawCount; i++)
|
||||||
|
{
|
||||||
DrawIndexedIndirect(indirectBuffer);
|
DrawIndexedIndirectOffset(indirectBuffer, stride * i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DrawIndirect(BufferRange indirectBuffer)
|
public void DrawIndirect(BufferRange indirectBuffer)
|
||||||
|
{
|
||||||
|
DrawIndirectOffset(indirectBuffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DrawIndirectOffset(BufferRange indirectBuffer, int offset = 0)
|
||||||
{
|
{
|
||||||
if (TopologyUnsupported(_encoderStateManager.Topology))
|
if (TopologyUnsupported(_encoderStateManager.Topology))
|
||||||
{
|
{
|
||||||
|
@ -575,14 +586,15 @@ namespace Ryujinx.Graphics.Metal
|
||||||
renderCommandEncoder.DrawPrimitives(
|
renderCommandEncoder.DrawPrimitives(
|
||||||
primitiveType,
|
primitiveType,
|
||||||
buffer,
|
buffer,
|
||||||
(ulong)indirectBuffer.Offset);
|
(ulong)(indirectBuffer.Offset + offset));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DrawIndirectCount(BufferRange indirectBuffer, BufferRange parameterBuffer, int maxDrawCount, int stride)
|
public void DrawIndirectCount(BufferRange indirectBuffer, BufferRange parameterBuffer, int maxDrawCount, int stride)
|
||||||
{
|
{
|
||||||
// TODO: Properly support count
|
for (int i = 0; i < maxDrawCount; i++)
|
||||||
|
{
|
||||||
DrawIndirect(indirectBuffer);
|
DrawIndirectOffset(indirectBuffer, stride * i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DrawTexture(ITexture texture, ISampler sampler, Extents2DF srcRegion, Extents2DF dstRegion)
|
public void DrawTexture(ITexture texture, ISampler sampler, Extents2DF srcRegion, Extents2DF dstRegion)
|
||||||
|
|
Loading…
Reference in a new issue