Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nv2a: Implement v1r0_sum flags #770

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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