InstGenBallot.cs 859 B

123456789101112131415161718192021222324252627
  1. using Ryujinx.Graphics.Shader.StructuredIr;
  2. using Ryujinx.Graphics.Shader.Translation;
  3. using static Ryujinx.Graphics.Shader.CodeGen.Glsl.Instructions.InstGenHelper;
  4. using static Ryujinx.Graphics.Shader.StructuredIr.InstructionInfo;
  5. namespace Ryujinx.Graphics.Shader.CodeGen.Glsl.Instructions
  6. {
  7. static class InstGenBallot
  8. {
  9. public static string Ballot(CodeGenContext context, AstOperation operation)
  10. {
  11. AggregateType dstType = GetSrcVarType(operation.Inst, 0);
  12. string arg = GetSoureExpr(context, operation.GetSource(0), dstType);
  13. if (context.Config.GpuAccessor.QueryHostSupportsShaderBallot())
  14. {
  15. return $"unpackUint2x32(ballotARB({arg})).x";
  16. }
  17. else
  18. {
  19. return $"subgroupBallot({arg}).x";
  20. }
  21. }
  22. }
  23. }