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