emit_glsl_convert.cpp 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. // Copyright 2021 yuzu Emulator Project
  2. // Licensed under GPLv2 or any later version
  3. // Refer to the license.txt file included.
  4. #include <string_view>
  5. #include "shader_recompiler/backend/glsl/emit_context.h"
  6. #include "shader_recompiler/frontend/ir/value.h"
  7. namespace Shader::Backend::GLSL {
  8. void EmitConvertS16F16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
  9. [[maybe_unused]] std::string_view value) {
  10. throw NotImplementedException("GLSL Instruction");
  11. }
  12. void EmitConvertS16F32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
  13. [[maybe_unused]] std::string_view value) {
  14. throw NotImplementedException("GLSL Instruction");
  15. }
  16. void EmitConvertS16F64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
  17. [[maybe_unused]] std::string_view value) {
  18. throw NotImplementedException("GLSL Instruction");
  19. }
  20. void EmitConvertS32F16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
  21. [[maybe_unused]] std::string_view value) {
  22. throw NotImplementedException("GLSL Instruction");
  23. }
  24. void EmitConvertS32F32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
  25. [[maybe_unused]] std::string_view value) {
  26. ctx.AddS32("{}=int({});", inst, value);
  27. }
  28. void EmitConvertS32F64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
  29. [[maybe_unused]] std::string_view value) {
  30. ctx.AddS32("{}=int({});", inst, value);
  31. }
  32. void EmitConvertS64F16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
  33. [[maybe_unused]] std::string_view value) {
  34. throw NotImplementedException("GLSL Instruction");
  35. }
  36. void EmitConvertS64F32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
  37. [[maybe_unused]] std::string_view value) {
  38. ctx.AddS64("{}=int64_t(double({}));", inst, value);
  39. }
  40. void EmitConvertS64F64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
  41. [[maybe_unused]] std::string_view value) {
  42. ctx.AddS64("{}=int64_t({});", inst, value);
  43. }
  44. void EmitConvertU16F16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
  45. [[maybe_unused]] std::string_view value) {
  46. throw NotImplementedException("GLSL Instruction");
  47. }
  48. void EmitConvertU16F32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
  49. [[maybe_unused]] std::string_view value) {
  50. throw NotImplementedException("GLSL Instruction");
  51. }
  52. void EmitConvertU16F64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
  53. [[maybe_unused]] std::string_view value) {
  54. throw NotImplementedException("GLSL Instruction");
  55. }
  56. void EmitConvertU32F16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
  57. [[maybe_unused]] std::string_view value) {
  58. throw NotImplementedException("GLSL Instruction");
  59. }
  60. void EmitConvertU32F32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
  61. [[maybe_unused]] std::string_view value) {
  62. ctx.AddU32("{}=uint({});", inst, value);
  63. }
  64. void EmitConvertU32F64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
  65. [[maybe_unused]] std::string_view value) {
  66. ctx.AddU32("{}=uint({});", inst, value);
  67. }
  68. void EmitConvertU64F16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
  69. [[maybe_unused]] std::string_view value) {
  70. throw NotImplementedException("GLSL Instruction");
  71. }
  72. void EmitConvertU64F32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
  73. [[maybe_unused]] std::string_view value) {
  74. ctx.AddU64("{}=uint64_t(double({}));", inst, value);
  75. }
  76. void EmitConvertU64F64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
  77. [[maybe_unused]] std::string_view value) {
  78. ctx.AddU64("{}=uint64_t({});", inst, value);
  79. }
  80. void EmitConvertU64U32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
  81. [[maybe_unused]] std::string_view value) {
  82. ctx.AddU64("{}=uint64_t({});", inst, value);
  83. }
  84. void EmitConvertU32U64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
  85. [[maybe_unused]] std::string_view value) {
  86. ctx.AddU32("{}=uint({});", inst, value);
  87. }
  88. void EmitConvertF16F32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
  89. [[maybe_unused]] std::string_view value) {
  90. throw NotImplementedException("GLSL Instruction");
  91. }
  92. void EmitConvertF32F16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
  93. [[maybe_unused]] std::string_view value) {
  94. throw NotImplementedException("GLSL Instruction");
  95. }
  96. void EmitConvertF32F64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
  97. [[maybe_unused]] std::string_view value) {
  98. ctx.AddF32("{}=float({});", inst, value);
  99. }
  100. void EmitConvertF64F32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
  101. [[maybe_unused]] std::string_view value) {
  102. ctx.AddF64("{}=double({});", inst, value);
  103. }
  104. void EmitConvertF16S8([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
  105. [[maybe_unused]] std::string_view value) {
  106. throw NotImplementedException("GLSL Instruction");
  107. }
  108. void EmitConvertF16S16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
  109. [[maybe_unused]] std::string_view value) {
  110. throw NotImplementedException("GLSL Instruction");
  111. }
  112. void EmitConvertF16S32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
  113. [[maybe_unused]] std::string_view value) {
  114. throw NotImplementedException("GLSL Instruction");
  115. }
  116. void EmitConvertF16S64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
  117. [[maybe_unused]] std::string_view value) {
  118. throw NotImplementedException("GLSL Instruction");
  119. }
  120. void EmitConvertF16U8([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
  121. [[maybe_unused]] std::string_view value) {
  122. throw NotImplementedException("GLSL Instruction");
  123. }
  124. void EmitConvertF16U16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
  125. [[maybe_unused]] std::string_view value) {
  126. throw NotImplementedException("GLSL Instruction");
  127. }
  128. void EmitConvertF16U32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
  129. [[maybe_unused]] std::string_view value) {
  130. throw NotImplementedException("GLSL Instruction");
  131. }
  132. void EmitConvertF16U64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
  133. [[maybe_unused]] std::string_view value) {
  134. throw NotImplementedException("GLSL Instruction");
  135. }
  136. void EmitConvertF32S8([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
  137. [[maybe_unused]] std::string_view value) {
  138. throw NotImplementedException("GLSL Instruction");
  139. }
  140. void EmitConvertF32S16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
  141. [[maybe_unused]] std::string_view value) {
  142. throw NotImplementedException("GLSL Instruction");
  143. }
  144. void EmitConvertF32S32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
  145. [[maybe_unused]] std::string_view value) {
  146. ctx.AddF32("{}=float({});", inst, value);
  147. }
  148. void EmitConvertF32S64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
  149. [[maybe_unused]] std::string_view value) {
  150. ctx.AddF32("{}=float({});", inst, value);
  151. }
  152. void EmitConvertF32U8([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
  153. [[maybe_unused]] std::string_view value) {
  154. throw NotImplementedException("GLSL Instruction");
  155. }
  156. void EmitConvertF32U16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
  157. [[maybe_unused]] std::string_view value) {
  158. ctx.AddF32("{}=float({});", inst, value);
  159. }
  160. void EmitConvertF32U32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
  161. [[maybe_unused]] std::string_view value) {
  162. ctx.AddF32("{}=float({});", inst, value);
  163. }
  164. void EmitConvertF32U64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
  165. [[maybe_unused]] std::string_view value) {
  166. ctx.AddF32("{}=float({});", inst, value);
  167. }
  168. void EmitConvertF64S8([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
  169. [[maybe_unused]] std::string_view value) {
  170. throw NotImplementedException("GLSL Instruction");
  171. }
  172. void EmitConvertF64S16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
  173. [[maybe_unused]] std::string_view value) {
  174. throw NotImplementedException("GLSL Instruction");
  175. }
  176. void EmitConvertF64S32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
  177. [[maybe_unused]] std::string_view value) {
  178. ctx.AddF64("{}=double({});", inst, value);
  179. }
  180. void EmitConvertF64S64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
  181. [[maybe_unused]] std::string_view value) {
  182. ctx.AddF64("{}=double({});", inst, value);
  183. }
  184. void EmitConvertF64U8([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
  185. [[maybe_unused]] std::string_view value) {
  186. throw NotImplementedException("GLSL Instruction");
  187. }
  188. void EmitConvertF64U16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
  189. [[maybe_unused]] std::string_view value) {
  190. throw NotImplementedException("GLSL Instruction");
  191. }
  192. void EmitConvertF64U32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
  193. [[maybe_unused]] std::string_view value) {
  194. ctx.AddF64("{}=double({});", inst, value);
  195. }
  196. void EmitConvertF64U64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
  197. [[maybe_unused]] std::string_view value) {
  198. ctx.AddF64("{}=double({});", inst, value);
  199. }
  200. } // namespace Shader::Backend::GLSL