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

Refactor register combiner code #21

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

JayFoxRox
Copy link
Owner

@JayFoxRox JayFoxRox commented Oct 31, 2018

Does a lot of smaller changes to bring our implementation closer to NV_register_combiners.

Addressed problems

Clamping in in- and outputs Upstreamed

Number of components for inputs

WTF did I mean by this? vector sizes?

V1R0_SUM flags

Final Combiner G is alpha Upstreamed

Re-evaluation of GLSL expressions

Fix broken GLSL in case of MUX, also use correct types and avoid casts if not necessary

Data hazards

Variables might be overwritten before they get used as input because AB, CD and SUM should run in parallel and fill outputs for the next stage.

I've attempted to fix this, but the code is horrible.

This change makes the emulation more accurate and faster.

Many GL errors (possibly conflicting hardware states) are not checked

Someone will eventually have to try each of them.


TODO:

  • Rebase onto the PSH cleanup and fix PR desc
  • Testing

@JayFoxRox
Copy link
Owner Author

I've rebased this on the latest master

write_mask, write_mask, write_mask);
} else {
assert(ps->flags & PS_COMBINERCOUNT_MUX_MSB);
qstring_append_fmt(ps->code, "sum_in.%s = mix(ab_in.%s, cd_in.%s, %s(r0.a < 0.5));\n",
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check is the wrong way around

if (output.muxsum != PS_REGISTER_DISCARD) {

assert(output.ab_op != PS_COMBINEROUTPUT_AB_DOT_PRODUCT);
assert(output.cd_op != PS_COMBINEROUTPUT_CD_DOT_PRODUCT);
Copy link

@dracc dracc Feb 8, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add comment that these might be wrong

@dracc
Copy link

dracc commented Feb 8, 2020

"psh: Use vec3 for rgb, float for alpha and vec4 for registers" -> "disallow-dot-in-alpha" was accidentally renamed - hopefully not modified much more

@dracc
Copy link

dracc commented Feb 8, 2020

Using qstring_append(vars, "vec4 pFog = vec4(fogColor.rgb, 1.0 + 0.0 * clamp(vtx.Fog / vtx.inv_w, 0.0, 1.0));\n"); fixes the colors of the menu text in tony hawks americans wasteland

@dracc
Copy link

dracc commented Feb 8, 2020

For time reasons, I should PR those changes which don't modify behaviour upstream asap.
I can then fix the others in a second step (changes I'm sure about) or third (changes I'm not so sure about).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants