JayFoxRox / xqemu

Personal development repository for XQEMU (original Xbox Emulator)
14 stars 1 forks source link

Refactor register combiner code #21

Open JayFoxRox opened 5 years ago

JayFoxRox commented 5 years ago

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:

JayFoxRox commented 5 years ago

I've rebased this on the latest master

dracc commented 4 years ago

"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 commented 4 years ago

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 commented 4 years ago

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).