Skip to content

Commit

Permalink
spirv: Work around OpLogicalNot being unsupported for ints
Browse files Browse the repository at this point in the history
  • Loading branch information
flibitijibibo committed Jan 30, 2021
1 parent 2615f81 commit c9037d9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion profiles/mojoshader_profile_spirv.c
Expand Up @@ -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
Expand Down

0 comments on commit c9037d9

Please sign in to comment.