Instruction.cs 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  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. ConvertFPToU32,
  49. ConvertS32ToFP,
  50. ConvertU32ToFP,
  51. Copy,
  52. Cosine,
  53. Ddx,
  54. Ddy,
  55. Discard,
  56. Divide,
  57. EmitVertex,
  58. EndPrimitive,
  59. ExponentB2,
  60. FindFirstSetS32,
  61. FindFirstSetU32,
  62. Floor,
  63. FusedMultiplyAdd,
  64. ImageLoad,
  65. ImageStore,
  66. IsNan,
  67. LoadAttribute,
  68. LoadConstant,
  69. LoadGlobal,
  70. LoadLocal,
  71. LoadShared,
  72. LoadStorage,
  73. Lod,
  74. LogarithmB2,
  75. LogicalAnd,
  76. LogicalExclusiveOr,
  77. LogicalNot,
  78. LogicalOr,
  79. LoopBreak,
  80. LoopContinue,
  81. MarkLabel,
  82. Maximum,
  83. MaximumU32,
  84. Minimum,
  85. MinimumU32,
  86. Multiply,
  87. MultiplyHighS32,
  88. MultiplyHighU32,
  89. Negate,
  90. PackDouble2x32,
  91. PackHalf2x16,
  92. ReciprocalSquareRoot,
  93. Return,
  94. Round,
  95. ShiftLeft,
  96. ShiftRightS32,
  97. ShiftRightU32,
  98. Shuffle,
  99. ShuffleDown,
  100. ShuffleUp,
  101. ShuffleXor,
  102. Sine,
  103. SquareRoot,
  104. StoreGlobal,
  105. StoreLocal,
  106. StoreShared,
  107. StoreStorage,
  108. Subtract,
  109. SwizzleAdd,
  110. TextureSample,
  111. TextureSize,
  112. Truncate,
  113. UnpackDouble2x32,
  114. UnpackHalf2x16,
  115. VoteAll,
  116. VoteAllEqual,
  117. VoteAny,
  118. Count,
  119. FP = 1 << 16,
  120. MrShift = 17,
  121. MrGlobal = 0 << MrShift,
  122. MrShared = 1 << MrShift,
  123. MrStorage = 2 << MrShift,
  124. MrMask = 3 << MrShift,
  125. Mask = 0xffff
  126. }
  127. static class InstructionExtensions
  128. {
  129. public static bool IsAtomic(this Instruction inst)
  130. {
  131. switch (inst & Instruction.Mask)
  132. {
  133. case Instruction.AtomicAdd:
  134. case Instruction.AtomicAnd:
  135. case Instruction.AtomicCompareAndSwap:
  136. case Instruction.AtomicMaxS32:
  137. case Instruction.AtomicMaxU32:
  138. case Instruction.AtomicMinS32:
  139. case Instruction.AtomicMinU32:
  140. case Instruction.AtomicOr:
  141. case Instruction.AtomicSwap:
  142. case Instruction.AtomicXor:
  143. return true;
  144. }
  145. return false;
  146. }
  147. }
  148. }