spirv: Work around OpLogicalNot being unsupported for ints default tip
authorEthan Lee <flibitijibibo@flibitijibibo.com>
Sat, 30 Jan 2021 13:55:25 -0500
changeset 1321 02f2aafb103c
parent 1320 f9036699b53a
spirv: Work around OpLogicalNot being unsupported for ints
profiles/mojoshader_profile_spirv.c
--- a/profiles/mojoshader_profile_spirv.c	Sun Jan 10 15:02:29 2021 -0500
+++ b/profiles/mojoshader_profile_spirv.c	Sat Jan 30 13:55:25 2021 -0500
@@ -1166,8 +1166,10 @@
 
         case SRCMOD_NOT:
         {
+            // We can't do OpLogicalNot on ints, so do (x ^ 1) instead
+            uint32 id_one = spv_getscalari(ctx, 1);
             uint32 id_not = spv_bumpid(ctx);
-            spv_emit(ctx, 4, SpvOpLogicalNot, result.tid, id_not, result.id);
+            spv_emit(ctx, 5, SpvOpBitwiseXor, result.tid, id_not, result.id, id_one);
             result.id = id_not;
             break;
         } // case