2021-09-19 14:38:39 +02:00
|
|
|
using Ryujinx.Graphics.Shader.StructuredIr;
|
2022-12-29 16:09:34 +01:00
|
|
|
using Ryujinx.Graphics.Shader.Translation;
|
2021-09-19 14:38:39 +02:00
|
|
|
|
|
|
|
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)
|
|
|
|
{
|
2022-12-29 16:09:34 +01:00
|
|
|
AggregateType dstType = GetSrcVarType(operation.Inst, 0);
|
2021-09-19 14:38:39 +02:00
|
|
|
|
|
|
|
string arg = GetSoureExpr(context, operation.GetSource(0), dstType);
|
|
|
|
|
|
|
|
if (context.Config.GpuAccessor.QueryHostSupportsShaderBallot())
|
|
|
|
{
|
|
|
|
return $"unpackUint2x32(ballotARB({arg})).x";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return $"subgroupBallot({arg}).x";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|