forked from MeloNX/MeloNX
* Move shuffle handling out of the backend to a transform pass * Handle subgroup sizes higher than 32 * Stop using the subgroup size control extension * Make GenerateShuffleFunction static * Shader cache version bump
29 lines
921 B
C#
29 lines
921 B
C#
using Ryujinx.Graphics.Shader.StructuredIr;
|
|
using Ryujinx.Graphics.Shader.Translation;
|
|
|
|
using static Ryujinx.Graphics.Shader.CodeGen.Glsl.Instructions.InstGenHelper;
|
|
using static Ryujinx.Graphics.Shader.StructuredIr.InstructionInfo;
|
|
|
|
namespace Ryujinx.Graphics.Shader.CodeGen.Glsl.Instructions
|
|
{
|
|
static class InstGenBallot
|
|
{
|
|
public static string Ballot(CodeGenContext context, AstOperation operation)
|
|
{
|
|
AggregateType dstType = GetSrcVarType(operation.Inst, 0);
|
|
|
|
string arg = GetSoureExpr(context, operation.GetSource(0), dstType);
|
|
char component = "xyzw"[operation.Index];
|
|
|
|
if (context.HostCapabilities.SupportsShaderBallot)
|
|
{
|
|
return $"unpackUint2x32(ballotARB({arg})).{component}";
|
|
}
|
|
else
|
|
{
|
|
return $"subgroupBallot({arg}).{component}";
|
|
}
|
|
}
|
|
}
|
|
}
|