From c9037d90fa2f59b6be65d1391ca11d345356bad1 Mon Sep 17 00:00:00 2001 From: Ethan Lee Date: Sat, 30 Jan 2021 13:55:25 -0500 Subject: [PATCH] spirv: Work around OpLogicalNot being unsupported for ints --- profiles/mojoshader_profile_spirv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/profiles/mojoshader_profile_spirv.c b/profiles/mojoshader_profile_spirv.c index 0d4aa08..0816f64 100644 --- a/profiles/mojoshader_profile_spirv.c +++ b/profiles/mojoshader_profile_spirv.c @@ -1166,8 +1166,10 @@ static SpirvResult spv_load_srcarg(Context *ctx, const size_t idx, const int wri 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