Metal: Compute Shaders (#19)

* check for too bix texture bindings

* implement lod query

* print shader stage name

* always have fragment input

* resolve merge conflicts

* fix: lod query

* fix: casting texture coords

* support non-array memories

* use structure types for buffers

* implement compute pipeline cache

* compute dispatch

* improve error message

* rebind compute state

* bind compute textures

* pass local size as an argument to dispatch

* implement texture buffers

* hack: change vertex index to vertex id

* pass support buffer as an argument to every function

* return at the end of function

* fix: certain missing compute bindings

* implement texture base

* improve texture binding system

* remove useless exception

* move texture handle to texture base

* fix: segfault when using disposed textures

---------

Co-authored-by: Samuliak <samuliak77@gmail.com>
Co-authored-by: SamoZ256 <96914946+SamoZ256@users.noreply.github.com>
This commit is contained in:
Isaac Marovitz
2024-05-29 16:21:59 +01:00
committed by Evan Husted
parent 65da0569a3
commit f00cf8704f
26 changed files with 718 additions and 224 deletions

View File

@@ -25,7 +25,7 @@ namespace Ryujinx.Graphics.GAL
void CopyBuffer(BufferHandle source, BufferHandle destination, int srcOffset, int dstOffset, int size);
void DispatchCompute(int groupsX, int groupsY, int groupsZ);
void DispatchCompute(int groupsX, int groupsY, int groupsZ, int groupSizeX, int groupSizeY, int groupSizeZ);
void Draw(int vertexCount, int instanceCount, int firstVertex, int firstInstance);
void DrawIndexed(

View File

@@ -6,17 +6,23 @@ namespace Ryujinx.Graphics.GAL.Multithreading.Commands
private int _groupsX;
private int _groupsY;
private int _groupsZ;
private int _groupSizeX;
private int _groupSizeY;
private int _groupSizeZ;
public void Set(int groupsX, int groupsY, int groupsZ)
public void Set(int groupsX, int groupsY, int groupsZ, int groupSizeX, int groupSizeY, int groupSizeZ)
{
_groupsX = groupsX;
_groupsY = groupsY;
_groupsZ = groupsZ;
_groupSizeX = groupSizeX;
_groupSizeY = groupSizeY;
_groupSizeZ = groupSizeZ;
}
public static void Run(ref DispatchComputeCommand command, ThreadedRenderer threaded, IRenderer renderer)
{
renderer.Pipeline.DispatchCompute(command._groupsX, command._groupsY, command._groupsZ);
renderer.Pipeline.DispatchCompute(command._groupsX, command._groupsY, command._groupsZ, command._groupSizeX, command._groupSizeY, command._groupSizeZ);
}
}
}

View File

@@ -63,9 +63,9 @@ namespace Ryujinx.Graphics.GAL.Multithreading
_renderer.QueueCommand();
}
public void DispatchCompute(int groupsX, int groupsY, int groupsZ)
public void DispatchCompute(int groupsX, int groupsY, int groupsZ, int groupSizeX, int groupSizeY, int groupSizeZ)
{
_renderer.New<DispatchComputeCommand>().Set(groupsX, groupsY, groupsZ);
_renderer.New<DispatchComputeCommand>().Set(groupsX, groupsY, groupsZ, groupSizeX, groupSizeY, groupSizeZ);
_renderer.QueueCommand();
}