As the summary says, Mesa/progs/tests/fog.c gives bad results for non-fogcoord fog on r100 with LINEAR and EXP. Attached patch fixes it, though I'd like to get confirmation that others think it's a good idea. It contradicts the documentation, which says that the previous equations were right. What do people think?
Created attachment 3642 [details] [review] fix fog equations for LINEAR, EXP.
I think this has bounced back and forth over the years. If possible test on some broader applications, it seems to me there may be cases where the existing code gives the right behaviour, ie. there may be a need to adjust the sign based on other state (though I've no idea what that might be). At worst, make the switch but add a comment so that next time at least we'll remember what happened before.
This makes me think of an old Michael Abrash quote about graphics programming: If it looks good, it is good. The most likely scenario is that it's a misprint in the DDK. It may also be a chip bug. Which r100-class chip did you test? We may want to get test coverage on other chips in the family before this gets committed. In the worst case, some versions may require the negation and others may not.
And given that the r200 has the same equations as after my patch, I'm more convinced that this is right. Committed.
Actually, this does not work correctly on my radeon 7200 (r100). I don't get any fog for GL_LINEAR and GL_EXP (with GL_FRAGMENT_DEPTH as source) with demos/fogcoord, when tcl is active. Old equations work (for this demo). However, for tests/fog, indeed the new equations must be used. Doesn't make any sense, the two tests should cause pretty much the same state to be set on the chip (regarding fog and lighting) too :-(. Assuming of course that the non-tcl mesa fog calculation is correct for both these tests. (Related to #5682)
Could you provide a demo for the brokenness?
Strangly enough where as GL_EXP and GL_LINEAR fogging were broken, GL_EXP now works in both the fog demo/test and applications for me. GL_LINEAR is still broken, with either the test case working or apps working. I'm using Mesa version: 6.5.
This patch broke LINEAR and EXP fog on my system. lspci says: Radeon Mobility M7 LW [Radeon Mobility 7500] Kudos to the person who thought to leave the comments, that really helped me. Debian bts where I first filed the report, for reference: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=390405
Closing it seems to work here with mesa 7.5, reopen if you still have this issue with recent mesa.
Mass version move, cvs -> git
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.