Skip to content

Commit

Permalink
spirv: FrontFacing should return 1 or -1, not 0
Browse files Browse the repository at this point in the history
  • Loading branch information
flibitijibibo committed Oct 3, 2024
1 parent 0516cfe commit 9cf39ae
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions profiles/mojoshader_profile_spirv.c
Original file line number Diff line number Diff line change
Expand Up @@ -1753,7 +1753,7 @@ static void spv_link_ps_attributes(Context *ctx, uint32 id, RegisterType regtype
uint32 tid_pvec4p = spv_get_type(ctx, STI_PTR_VEC4_P);

uint32 id_1_0 = spv_getscalarf(ctx, 1.0f);
uint32 id_0_0 = spv_getscalarf(ctx, 0.0f);
uint32 id_n1_0 = spv_getscalarf(ctx, -1.0f);

uint32 id_var_frontfacing = spv_bumpid(ctx);
uint32 id_var_vface = id;
Expand All @@ -1771,7 +1771,7 @@ static void spv_link_ps_attributes(Context *ctx, uint32 id, RegisterType regtype

push_output(ctx, &ctx->mainline_top);
spv_emit(ctx, 4, SpvOpLoad, tid_bool, id_frontfacing, id_var_frontfacing);
spv_emit(ctx, 6, SpvOpSelect, tid_float, id_tmp, id_frontfacing, id_1_0, id_0_0);
spv_emit(ctx, 6, SpvOpSelect, tid_float, id_tmp, id_frontfacing, id_1_0, id_n1_0);
spv_emit(ctx, 3 + 4, SpvOpCompositeConstruct, tid_vec4, id_vface, id_tmp, id_tmp, id_tmp, id_tmp);
spv_emit(ctx, 3, SpvOpStore, id_var_vface, id_vface);
pop_output(ctx);
Expand Down

0 comments on commit 9cf39ae

Please sign in to comment.