mirror of
https://git.naxdy.org/Mirror/Ryujinx.git
synced 2024-12-27 11:03:04 +00:00
Consolodate barriers
This commit is contained in:
parent
a31e461db8
commit
558752594c
3 changed files with 6 additions and 15 deletions
|
@ -122,8 +122,6 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl.Instructions
|
||||||
{
|
{
|
||||||
case Instruction.Ballot:
|
case Instruction.Ballot:
|
||||||
return Ballot(context, operation);
|
return Ballot(context, operation);
|
||||||
case Instruction.Barrier:
|
|
||||||
return Barrier(context, operation);
|
|
||||||
case Instruction.Call:
|
case Instruction.Call:
|
||||||
return Call(context, operation);
|
return Call(context, operation);
|
||||||
case Instruction.FSIBegin:
|
case Instruction.FSIBegin:
|
||||||
|
@ -132,7 +130,8 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl.Instructions
|
||||||
return "|| FSI END ||";
|
return "|| FSI END ||";
|
||||||
case Instruction.GroupMemoryBarrier:
|
case Instruction.GroupMemoryBarrier:
|
||||||
case Instruction.MemoryBarrier:
|
case Instruction.MemoryBarrier:
|
||||||
return MemoryBarrier(context, operation);
|
case Instruction.Barrier:
|
||||||
|
return Barrier(context, operation);
|
||||||
case Instruction.ImageLoad:
|
case Instruction.ImageLoad:
|
||||||
case Instruction.ImageStore:
|
case Instruction.ImageStore:
|
||||||
case Instruction.ImageAtomic:
|
case Instruction.ImageAtomic:
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
|
using Ryujinx.Graphics.Shader.IntermediateRepresentation;
|
||||||
using Ryujinx.Graphics.Shader.StructuredIr;
|
using Ryujinx.Graphics.Shader.StructuredIr;
|
||||||
using Ryujinx.Graphics.Shader.Translation;
|
|
||||||
|
|
||||||
using static Ryujinx.Graphics.Shader.CodeGen.Msl.Instructions.InstGenHelper;
|
|
||||||
using static Ryujinx.Graphics.Shader.StructuredIr.InstructionInfo;
|
|
||||||
|
|
||||||
namespace Ryujinx.Graphics.Shader.CodeGen.Msl.Instructions
|
namespace Ryujinx.Graphics.Shader.CodeGen.Msl.Instructions
|
||||||
{
|
{
|
||||||
|
@ -10,7 +7,9 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl.Instructions
|
||||||
{
|
{
|
||||||
public static string Barrier(CodeGenContext context, AstOperation operation)
|
public static string Barrier(CodeGenContext context, AstOperation operation)
|
||||||
{
|
{
|
||||||
return "threadgroup_barrier(mem_flags::mem_threadgroup)";
|
var device = (operation.Inst & Instruction.Mask) == Instruction.MemoryBarrier;
|
||||||
|
|
||||||
|
return $"threadgroup_barrier(mem_flags::mem_{(device ? "device" : "threadgroup")})";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -600,13 +600,6 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl.Instructions
|
||||||
return $"float2(as_type<half2>({srcExpr})){GetMask(operation.Index)}";
|
return $"float2(as_type<half2>({srcExpr})){GetMask(operation.Index)}";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string MemoryBarrier(CodeGenContext context, AstOperation operation)
|
|
||||||
{
|
|
||||||
var grouped = (operation.Inst & Instruction.Mask) == Instruction.GroupMemoryBarrier;
|
|
||||||
|
|
||||||
return $"threadgroup_barrier(mem_flags::mem_{(grouped ? "threadgroup" : "device")})";
|
|
||||||
}
|
|
||||||
|
|
||||||
private static string GetMask(int index)
|
private static string GetMask(int index)
|
||||||
{
|
{
|
||||||
return $".{"xy".AsSpan(index, 1)}";
|
return $".{"xy".AsSpan(index, 1)}";
|
||||||
|
|
Loading…
Reference in a new issue