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

softgpu: Correct accuracy of fog calculation #16005

Merged
merged 4 commits into from
Sep 11, 2022

Conversation

unknownbrackets
Copy link
Collaborator

Having figured out how to directly specify the 8-bit fog factor in #15978, I was able to directly verify the fog blending equation on hardware (without Z interpolation and floating point handling questions getting in the way.)

It's the same as the BLEND tex func, i.e. divide by 256 but round up. No halves, no dividing by 255, simple.

I had to do some ugly hacking to get the fog values from imm to the actual verts (not included here, and only working for some prims.) This matches a test of many values/factors exactly,. bit-for-bit. The test included every possible source color + every possible factor + a couple fog colors chosen to catch rounding problems.

-[Unknown]

Its UV checks already should have generally, but let's be safe.  It
doesn't validate state like fog, etc.
This matches values from a PSP exactly, with the help of immediate mode
vertex values (since this directly allows specifying the fog factor
without any floating point math.)
Better this than static.  May be easier to handle imm prims correctly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants