Instruction.cs 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. using System;
  2. namespace Ryujinx.Graphics.Shader.IntermediateRepresentation
  3. {
  4. [Flags]
  5. enum Instruction
  6. {
  7. Absolute = 1,
  8. Add,
  9. AtomicAdd,
  10. AtomicAnd,
  11. AtomicCompareAndSwap,
  12. AtomicMinS32,
  13. AtomicMinU32,
  14. AtomicMaxS32,
  15. AtomicMaxU32,
  16. AtomicOr,
  17. AtomicSwap,
  18. AtomicXor,
  19. Ballot,
  20. BitCount,
  21. BitfieldExtractS32,
  22. BitfieldExtractU32,
  23. BitfieldInsert,
  24. BitfieldReverse,
  25. BitwiseAnd,
  26. BitwiseExclusiveOr,
  27. BitwiseNot,
  28. BitwiseOr,
  29. Branch,
  30. BranchIfFalse,
  31. BranchIfTrue,
  32. Ceiling,
  33. Clamp,
  34. ClampU32,
  35. Comment,
  36. CompareEqual,
  37. CompareGreater,
  38. CompareGreaterOrEqual,
  39. CompareGreaterOrEqualU32,
  40. CompareGreaterU32,
  41. CompareLess,
  42. CompareLessOrEqual,
  43. CompareLessOrEqualU32,
  44. CompareLessU32,
  45. CompareNotEqual,
  46. ConditionalSelect,
  47. ConvertFPToS32,
  48. ConvertS32ToFP,
  49. ConvertU32ToFP,
  50. Copy,
  51. Cosine,
  52. Ddx,
  53. Ddy,
  54. Discard,
  55. Divide,
  56. EmitVertex,
  57. EndPrimitive,
  58. ExponentB2,
  59. FindFirstSetS32,
  60. FindFirstSetU32,
  61. Floor,
  62. FusedMultiplyAdd,
  63. ImageLoad,
  64. ImageStore,
  65. IsNan,
  66. LoadAttribute,
  67. LoadConstant,
  68. LoadGlobal,
  69. LoadLocal,
  70. LoadShared,
  71. LoadStorage,
  72. LogarithmB2,
  73. LogicalAnd,
  74. LogicalExclusiveOr,
  75. LogicalNot,
  76. LogicalOr,
  77. LoopBreak,
  78. LoopContinue,
  79. MarkLabel,
  80. Maximum,
  81. MaximumU32,
  82. Minimum,
  83. MinimumU32,
  84. Multiply,
  85. Negate,
  86. PackDouble2x32,
  87. PackHalf2x16,
  88. ReciprocalSquareRoot,
  89. Return,
  90. Round,
  91. ShiftLeft,
  92. ShiftRightS32,
  93. ShiftRightU32,
  94. Shuffle,
  95. ShuffleDown,
  96. ShuffleUp,
  97. ShuffleXor,
  98. Sine,
  99. SquareRoot,
  100. StoreGlobal,
  101. StoreLocal,
  102. StoreShared,
  103. StoreStorage,
  104. Subtract,
  105. SwizzleAdd,
  106. TextureSample,
  107. TextureSize,
  108. Truncate,
  109. UnpackDouble2x32,
  110. UnpackHalf2x16,
  111. VoteAll,
  112. VoteAllEqual,
  113. VoteAny,
  114. Count,
  115. FP = 1 << 16,
  116. MrShift = 17,
  117. MrGlobal = 0 << MrShift,
  118. MrShared = 1 << MrShift,
  119. MrStorage = 2 << MrShift,
  120. MrMask = 3 << MrShift,
  121. Mask = 0xffff
  122. }
  123. static class InstructionExtensions
  124. {
  125. public static bool IsAtomic(this Instruction inst)
  126. {
  127. switch (inst & Instruction.Mask)
  128. {
  129. case Instruction.AtomicAdd:
  130. case Instruction.AtomicAnd:
  131. case Instruction.AtomicCompareAndSwap:
  132. case Instruction.AtomicMaxS32:
  133. case Instruction.AtomicMaxU32:
  134. case Instruction.AtomicMinS32:
  135. case Instruction.AtomicMinU32:
  136. case Instruction.AtomicOr:
  137. case Instruction.AtomicSwap:
  138. case Instruction.AtomicXor:
  139. return true;
  140. }
  141. return false;
  142. }
  143. }
  144. }