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