Skip to content

Commit

Permalink
nv2a: Implement v1r0_sum flags
Browse files Browse the repository at this point in the history
  • Loading branch information
abaire authored and mborgerson committed Mar 17, 2022
1 parent 4cff9c2 commit 2ff5f23
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion hw/xbox/nv2a/psh.c
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,17 @@ static MString* get_var(struct PixelShader *ps, int reg, bool is_dest)
return mstring_from_str("r1");
case PS_REGISTER_V1R0_SUM:
add_var_ref(ps, "r0");
return mstring_from_str("vec4(v1.rgb + r0.rgb, 0.0)");
if (ps->final_input.clamp_sum) {
return mstring_from_fmt(
"clamp(vec4(%s.rgb + %s.rgb, 0.0), 0.0, 1.0)",
ps->final_input.inv_v1 ? "(1.0 - v1)" : "v1",
ps->final_input.inv_r0 ? "(1.0 - r0)" : "r0");
} else {
return mstring_from_fmt(
"vec4(%s.rgb + %s.rgb, 0.0)",
ps->final_input.inv_v1 ? "(1.0 - v1)" : "v1",
ps->final_input.inv_r0 ? "(1.0 - r0)" : "r0");
}
case PS_REGISTER_EF_PROD:
return mstring_from_fmt("vec4(%s * %s, 0.0)",
mstring_get_str(ps->varE),
Expand Down

0 comments on commit 2ff5f23

Please sign in to comment.