InstGenBallot.cs 815 B

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