emit_glsl_not_implemented.cpp 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652
  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. #ifdef _MSC_VER
  8. #pragma warning(disable : 4100)
  9. #endif
  10. namespace Shader::Backend::GLSL {
  11. static void NotImplemented() {
  12. throw NotImplementedException("GLSL instruction");
  13. }
  14. void EmitPhi(EmitContext& ctx, IR::Inst& phi) {
  15. const size_t num_args{phi.NumArgs()};
  16. for (size_t i = 0; i < num_args; ++i) {
  17. ctx.reg_alloc.Consume(phi.Arg(i));
  18. }
  19. if (!phi.Definition<Id>().is_valid) {
  20. // The phi node wasn't forward defined
  21. ctx.Add("{};", ctx.reg_alloc.Define(phi, phi.Arg(0).Type()));
  22. }
  23. }
  24. void EmitVoid(EmitContext& ctx) {
  25. // NotImplemented();
  26. }
  27. void EmitReference(EmitContext&) {
  28. // NotImplemented();
  29. }
  30. void EmitPhiMove(EmitContext& ctx, const IR::Value& phi_value, const IR::Value& value) {
  31. IR::Inst& phi{*phi_value.InstRecursive()};
  32. const auto phi_type{phi.Arg(0).Type()};
  33. if (!phi.Definition<Id>().is_valid) {
  34. // The phi node wasn't forward defined
  35. ctx.Add("{};", ctx.reg_alloc.Define(phi, phi_type));
  36. }
  37. const auto phi_reg{ctx.reg_alloc.Consume(IR::Value{&phi})};
  38. const auto val_reg{ctx.reg_alloc.Consume(value)};
  39. if (phi_reg == val_reg) {
  40. return;
  41. }
  42. ctx.Add("{}={};", phi_reg, val_reg);
  43. }
  44. void EmitBranch(EmitContext& ctx, std::string_view label) {
  45. NotImplemented();
  46. }
  47. void EmitBranchConditional(EmitContext& ctx, std::string_view condition,
  48. std::string_view true_label, std::string_view false_label) {
  49. NotImplemented();
  50. }
  51. void EmitLoopMerge(EmitContext& ctx, std::string_view merge_label,
  52. std::string_view continue_label) {
  53. NotImplemented();
  54. }
  55. void EmitSelectionMerge(EmitContext& ctx, std::string_view merge_label) {
  56. NotImplemented();
  57. }
  58. void EmitReturn(EmitContext& ctx) {
  59. NotImplemented();
  60. }
  61. void EmitJoin(EmitContext& ctx) {
  62. NotImplemented();
  63. }
  64. void EmitUnreachable(EmitContext& ctx) {
  65. NotImplemented();
  66. }
  67. void EmitDemoteToHelperInvocation(EmitContext& ctx, std::string_view continue_label) {
  68. ctx.Add("discard;");
  69. }
  70. void EmitBarrier(EmitContext& ctx) {
  71. NotImplemented();
  72. }
  73. void EmitWorkgroupMemoryBarrier(EmitContext& ctx) {
  74. NotImplemented();
  75. }
  76. void EmitDeviceMemoryBarrier(EmitContext& ctx) {
  77. NotImplemented();
  78. }
  79. void EmitPrologue(EmitContext& ctx) {
  80. // NotImplemented();
  81. }
  82. void EmitEpilogue(EmitContext& ctx) {
  83. // NotImplemented();
  84. }
  85. void EmitEmitVertex(EmitContext& ctx, const IR::Value& stream) {
  86. NotImplemented();
  87. }
  88. void EmitEndPrimitive(EmitContext& ctx, const IR::Value& stream) {
  89. NotImplemented();
  90. }
  91. void EmitGetRegister(EmitContext& ctx) {
  92. NotImplemented();
  93. }
  94. void EmitSetRegister(EmitContext& ctx) {
  95. NotImplemented();
  96. }
  97. void EmitGetPred(EmitContext& ctx) {
  98. NotImplemented();
  99. }
  100. void EmitSetPred(EmitContext& ctx) {
  101. NotImplemented();
  102. }
  103. void EmitSetGotoVariable(EmitContext& ctx) {
  104. NotImplemented();
  105. }
  106. void EmitGetGotoVariable(EmitContext& ctx) {
  107. NotImplemented();
  108. }
  109. void EmitSetIndirectBranchVariable(EmitContext& ctx) {
  110. NotImplemented();
  111. }
  112. void EmitGetIndirectBranchVariable(EmitContext& ctx) {
  113. NotImplemented();
  114. }
  115. void EmitGetAttributeIndexed(EmitContext& ctx, std::string_view offset, std::string_view vertex) {
  116. NotImplemented();
  117. }
  118. void EmitSetAttributeIndexed(EmitContext& ctx, std::string_view offset, std::string_view value,
  119. std::string_view vertex) {
  120. NotImplemented();
  121. }
  122. void EmitGetPatch(EmitContext& ctx, IR::Patch patch) {
  123. NotImplemented();
  124. }
  125. void EmitSetPatch(EmitContext& ctx, IR::Patch patch, std::string_view value) {
  126. NotImplemented();
  127. }
  128. void EmitSetSampleMask(EmitContext& ctx, std::string_view value) {
  129. NotImplemented();
  130. }
  131. void EmitSetFragDepth(EmitContext& ctx, std::string_view value) {
  132. NotImplemented();
  133. }
  134. void EmitGetZFlag(EmitContext& ctx) {
  135. NotImplemented();
  136. }
  137. void EmitGetSFlag(EmitContext& ctx) {
  138. NotImplemented();
  139. }
  140. void EmitGetCFlag(EmitContext& ctx) {
  141. NotImplemented();
  142. }
  143. void EmitGetOFlag(EmitContext& ctx) {
  144. NotImplemented();
  145. }
  146. void EmitSetZFlag(EmitContext& ctx) {
  147. NotImplemented();
  148. }
  149. void EmitSetSFlag(EmitContext& ctx) {
  150. NotImplemented();
  151. }
  152. void EmitSetCFlag(EmitContext& ctx) {
  153. NotImplemented();
  154. }
  155. void EmitSetOFlag(EmitContext& ctx) {
  156. NotImplemented();
  157. }
  158. void EmitWorkgroupId(EmitContext& ctx) {
  159. NotImplemented();
  160. }
  161. void EmitLocalInvocationId(EmitContext& ctx) {
  162. NotImplemented();
  163. }
  164. void EmitInvocationId(EmitContext& ctx) {
  165. NotImplemented();
  166. }
  167. void EmitSampleId(EmitContext& ctx) {
  168. NotImplemented();
  169. }
  170. void EmitIsHelperInvocation(EmitContext& ctx) {
  171. NotImplemented();
  172. }
  173. void EmitYDirection(EmitContext& ctx, IR::Inst& inst) {
  174. ctx.uses_y_direction = true;
  175. ctx.AddF32("{}=gl_FrontMaterial.ambient.a;", inst);
  176. }
  177. void EmitLoadLocal(EmitContext& ctx, std::string_view word_offset) {
  178. NotImplemented();
  179. }
  180. void EmitWriteLocal(EmitContext& ctx, std::string_view word_offset, std::string_view value) {
  181. NotImplemented();
  182. }
  183. void EmitUndefU1(EmitContext& ctx, IR::Inst& inst) {
  184. ctx.AddU1("{}=false;", inst);
  185. }
  186. void EmitUndefU8(EmitContext& ctx, IR::Inst& inst) {
  187. NotImplemented();
  188. }
  189. void EmitUndefU16(EmitContext& ctx, IR::Inst& inst) {
  190. NotImplemented();
  191. }
  192. void EmitUndefU32(EmitContext& ctx, IR::Inst& inst) {
  193. ctx.AddU32("{}=0u;", inst);
  194. }
  195. void EmitUndefU64(EmitContext& ctx, IR::Inst& inst) {
  196. NotImplemented();
  197. }
  198. void EmitLoadGlobalU8(EmitContext& ctx) {
  199. NotImplemented();
  200. }
  201. void EmitLoadGlobalS8(EmitContext& ctx) {
  202. NotImplemented();
  203. }
  204. void EmitLoadGlobalU16(EmitContext& ctx) {
  205. NotImplemented();
  206. }
  207. void EmitLoadGlobalS16(EmitContext& ctx) {
  208. NotImplemented();
  209. }
  210. void EmitLoadGlobal32(EmitContext& ctx, std::string_view address) {
  211. NotImplemented();
  212. }
  213. void EmitLoadGlobal64(EmitContext& ctx, std::string_view address) {
  214. NotImplemented();
  215. }
  216. void EmitLoadGlobal128(EmitContext& ctx, std::string_view address) {
  217. NotImplemented();
  218. }
  219. void EmitWriteGlobalU8(EmitContext& ctx) {
  220. NotImplemented();
  221. }
  222. void EmitWriteGlobalS8(EmitContext& ctx) {
  223. NotImplemented();
  224. }
  225. void EmitWriteGlobalU16(EmitContext& ctx) {
  226. NotImplemented();
  227. }
  228. void EmitWriteGlobalS16(EmitContext& ctx) {
  229. NotImplemented();
  230. }
  231. void EmitWriteGlobal32(EmitContext& ctx, std::string_view address, std::string_view value) {
  232. NotImplemented();
  233. }
  234. void EmitWriteGlobal64(EmitContext& ctx, std::string_view address, std::string_view value) {
  235. NotImplemented();
  236. }
  237. void EmitWriteGlobal128(EmitContext& ctx, std::string_view address, std::string_view value) {
  238. NotImplemented();
  239. }
  240. void EmitLoadSharedU8(EmitContext& ctx, std::string_view offset) {
  241. NotImplemented();
  242. }
  243. void EmitLoadSharedS8(EmitContext& ctx, std::string_view offset) {
  244. NotImplemented();
  245. }
  246. void EmitLoadSharedU16(EmitContext& ctx, std::string_view offset) {
  247. NotImplemented();
  248. }
  249. void EmitLoadSharedS16(EmitContext& ctx, std::string_view offset) {
  250. NotImplemented();
  251. }
  252. void EmitLoadSharedU32(EmitContext& ctx, std::string_view offset) {
  253. NotImplemented();
  254. }
  255. void EmitLoadSharedU64(EmitContext& ctx, std::string_view offset) {
  256. NotImplemented();
  257. }
  258. void EmitLoadSharedU128(EmitContext& ctx, std::string_view offset) {
  259. NotImplemented();
  260. }
  261. void EmitWriteSharedU8(EmitContext& ctx, std::string_view offset, std::string_view value) {
  262. NotImplemented();
  263. }
  264. void EmitWriteSharedU16(EmitContext& ctx, std::string_view offset, std::string_view value) {
  265. NotImplemented();
  266. }
  267. void EmitWriteSharedU32(EmitContext& ctx, std::string_view offset, std::string_view value) {
  268. NotImplemented();
  269. }
  270. void EmitWriteSharedU64(EmitContext& ctx, std::string_view offset, std::string_view value) {
  271. NotImplemented();
  272. }
  273. void EmitWriteSharedU128(EmitContext& ctx, std::string_view offset, std::string_view value) {
  274. NotImplemented();
  275. }
  276. void EmitGetZeroFromOp(EmitContext& ctx) {
  277. NotImplemented();
  278. }
  279. void EmitGetSignFromOp(EmitContext& ctx) {
  280. NotImplemented();
  281. }
  282. void EmitGetCarryFromOp(EmitContext& ctx) {
  283. NotImplemented();
  284. }
  285. void EmitGetOverflowFromOp(EmitContext& ctx) {
  286. NotImplemented();
  287. }
  288. void EmitGetSparseFromOp(EmitContext& ctx) {
  289. NotImplemented();
  290. }
  291. void EmitGetInBoundsFromOp(EmitContext& ctx) {
  292. NotImplemented();
  293. }
  294. void EmitSharedAtomicIAdd32(EmitContext& ctx, std::string_view pointer_offset,
  295. std::string_view value) {
  296. NotImplemented();
  297. }
  298. void EmitSharedAtomicSMin32(EmitContext& ctx, std::string_view pointer_offset,
  299. std::string_view value) {
  300. NotImplemented();
  301. }
  302. void EmitSharedAtomicUMin32(EmitContext& ctx, std::string_view pointer_offset,
  303. std::string_view value) {
  304. NotImplemented();
  305. }
  306. void EmitSharedAtomicSMax32(EmitContext& ctx, std::string_view pointer_offset,
  307. std::string_view value) {
  308. NotImplemented();
  309. }
  310. void EmitSharedAtomicUMax32(EmitContext& ctx, std::string_view pointer_offset,
  311. std::string_view value) {
  312. NotImplemented();
  313. }
  314. void EmitSharedAtomicInc32(EmitContext& ctx, std::string_view pointer_offset,
  315. std::string_view value) {
  316. NotImplemented();
  317. }
  318. void EmitSharedAtomicDec32(EmitContext& ctx, std::string_view pointer_offset,
  319. std::string_view value) {
  320. NotImplemented();
  321. }
  322. void EmitSharedAtomicAnd32(EmitContext& ctx, std::string_view pointer_offset,
  323. std::string_view value) {
  324. NotImplemented();
  325. }
  326. void EmitSharedAtomicOr32(EmitContext& ctx, std::string_view pointer_offset,
  327. std::string_view value) {
  328. NotImplemented();
  329. }
  330. void EmitSharedAtomicXor32(EmitContext& ctx, std::string_view pointer_offset,
  331. std::string_view value) {
  332. NotImplemented();
  333. }
  334. void EmitSharedAtomicExchange32(EmitContext& ctx, std::string_view pointer_offset,
  335. std::string_view value) {
  336. NotImplemented();
  337. }
  338. void EmitSharedAtomicExchange64(EmitContext& ctx, std::string_view pointer_offset,
  339. std::string_view value) {
  340. NotImplemented();
  341. }
  342. void EmitBindlessImageAtomicIAdd32(EmitContext&) {
  343. NotImplemented();
  344. }
  345. void EmitBindlessImageAtomicSMin32(EmitContext&) {
  346. NotImplemented();
  347. }
  348. void EmitBindlessImageAtomicUMin32(EmitContext&) {
  349. NotImplemented();
  350. }
  351. void EmitBindlessImageAtomicSMax32(EmitContext&) {
  352. NotImplemented();
  353. }
  354. void EmitBindlessImageAtomicUMax32(EmitContext&) {
  355. NotImplemented();
  356. }
  357. void EmitBindlessImageAtomicInc32(EmitContext&) {
  358. NotImplemented();
  359. }
  360. void EmitBindlessImageAtomicDec32(EmitContext&) {
  361. NotImplemented();
  362. }
  363. void EmitBindlessImageAtomicAnd32(EmitContext&) {
  364. NotImplemented();
  365. }
  366. void EmitBindlessImageAtomicOr32(EmitContext&) {
  367. NotImplemented();
  368. }
  369. void EmitBindlessImageAtomicXor32(EmitContext&) {
  370. NotImplemented();
  371. }
  372. void EmitBindlessImageAtomicExchange32(EmitContext&) {
  373. NotImplemented();
  374. }
  375. void EmitBoundImageAtomicIAdd32(EmitContext&) {
  376. NotImplemented();
  377. }
  378. void EmitBoundImageAtomicSMin32(EmitContext&) {
  379. NotImplemented();
  380. }
  381. void EmitBoundImageAtomicUMin32(EmitContext&) {
  382. NotImplemented();
  383. }
  384. void EmitBoundImageAtomicSMax32(EmitContext&) {
  385. NotImplemented();
  386. }
  387. void EmitBoundImageAtomicUMax32(EmitContext&) {
  388. NotImplemented();
  389. }
  390. void EmitBoundImageAtomicInc32(EmitContext&) {
  391. NotImplemented();
  392. }
  393. void EmitBoundImageAtomicDec32(EmitContext&) {
  394. NotImplemented();
  395. }
  396. void EmitBoundImageAtomicAnd32(EmitContext&) {
  397. NotImplemented();
  398. }
  399. void EmitBoundImageAtomicOr32(EmitContext&) {
  400. NotImplemented();
  401. }
  402. void EmitBoundImageAtomicXor32(EmitContext&) {
  403. NotImplemented();
  404. }
  405. void EmitBoundImageAtomicExchange32(EmitContext&) {
  406. NotImplemented();
  407. }
  408. void EmitImageAtomicIAdd32(EmitContext& ctx, IR::Inst& inst, const IR::Value& index,
  409. std::string_view coords, std::string_view value) {
  410. NotImplemented();
  411. }
  412. void EmitImageAtomicSMin32(EmitContext& ctx, IR::Inst& inst, const IR::Value& index,
  413. std::string_view coords, std::string_view value) {
  414. NotImplemented();
  415. }
  416. void EmitImageAtomicUMin32(EmitContext& ctx, IR::Inst& inst, const IR::Value& index,
  417. std::string_view coords, std::string_view value) {
  418. NotImplemented();
  419. }
  420. void EmitImageAtomicSMax32(EmitContext& ctx, IR::Inst& inst, const IR::Value& index,
  421. std::string_view coords, std::string_view value) {
  422. NotImplemented();
  423. }
  424. void EmitImageAtomicUMax32(EmitContext& ctx, IR::Inst& inst, const IR::Value& index,
  425. std::string_view coords, std::string_view value) {
  426. NotImplemented();
  427. }
  428. void EmitImageAtomicInc32(EmitContext& ctx, IR::Inst& inst, const IR::Value& index,
  429. std::string_view coords, std::string_view value) {
  430. NotImplemented();
  431. }
  432. void EmitImageAtomicDec32(EmitContext& ctx, IR::Inst& inst, const IR::Value& index,
  433. std::string_view coords, std::string_view value) {
  434. NotImplemented();
  435. }
  436. void EmitImageAtomicAnd32(EmitContext& ctx, IR::Inst& inst, const IR::Value& index,
  437. std::string_view coords, std::string_view value) {
  438. NotImplemented();
  439. }
  440. void EmitImageAtomicOr32(EmitContext& ctx, IR::Inst& inst, const IR::Value& index,
  441. std::string_view coords, std::string_view value) {
  442. NotImplemented();
  443. }
  444. void EmitImageAtomicXor32(EmitContext& ctx, IR::Inst& inst, const IR::Value& index,
  445. std::string_view coords, std::string_view value) {
  446. NotImplemented();
  447. }
  448. void EmitImageAtomicExchange32(EmitContext& ctx, IR::Inst& inst, const IR::Value& index,
  449. std::string_view coords, std::string_view value) {
  450. NotImplemented();
  451. }
  452. void EmitLaneId(EmitContext& ctx) {
  453. NotImplemented();
  454. }
  455. void EmitVoteAll(EmitContext& ctx, std::string_view pred) {
  456. NotImplemented();
  457. }
  458. void EmitVoteAny(EmitContext& ctx, std::string_view pred) {
  459. NotImplemented();
  460. }
  461. void EmitVoteEqual(EmitContext& ctx, std::string_view pred) {
  462. NotImplemented();
  463. }
  464. void EmitSubgroupBallot(EmitContext& ctx, std::string_view pred) {
  465. NotImplemented();
  466. }
  467. void EmitSubgroupEqMask(EmitContext& ctx) {
  468. NotImplemented();
  469. }
  470. void EmitSubgroupLtMask(EmitContext& ctx) {
  471. NotImplemented();
  472. }
  473. void EmitSubgroupLeMask(EmitContext& ctx) {
  474. NotImplemented();
  475. }
  476. void EmitSubgroupGtMask(EmitContext& ctx) {
  477. NotImplemented();
  478. }
  479. void EmitSubgroupGeMask(EmitContext& ctx) {
  480. NotImplemented();
  481. }
  482. void EmitShuffleIndex(EmitContext& ctx, IR::Inst& inst, std::string_view value,
  483. std::string_view index, std::string_view clamp,
  484. std::string_view segmentation_mask) {
  485. NotImplemented();
  486. }
  487. void EmitShuffleUp(EmitContext& ctx, IR::Inst& inst, std::string_view value, std::string_view index,
  488. std::string_view clamp, std::string_view segmentation_mask) {
  489. NotImplemented();
  490. }
  491. void EmitShuffleDown(EmitContext& ctx, IR::Inst& inst, std::string_view value,
  492. std::string_view index, std::string_view clamp,
  493. std::string_view segmentation_mask) {
  494. NotImplemented();
  495. }
  496. void EmitShuffleButterfly(EmitContext& ctx, IR::Inst& inst, std::string_view value,
  497. std::string_view index, std::string_view clamp,
  498. std::string_view segmentation_mask) {
  499. NotImplemented();
  500. }
  501. } // namespace Shader::Backend::GLSL