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