Hello again
now that the lighting bugs are finally mostly gone, I've just gone ahead and changed the lighting code a bit more... (patch against cvs, without the earlier colormat fix).
This patch causes the driver to no longer use the PREMULT lighting, instead it will use the SOURCE_MATERIAL stuff. Looking at r200_reg.h it looked to me like the chip can handle a lot what is currently done in software. So I changed that ;-)
Most of the restrictions in the r200 code are caused by the driver being forked off the original radeon - the restrictions relate to that chip, not the r200. Lifting them has been a long-time todo item. The new tnl code which treats materials in much the same way as other vertex attributes was a step in this direction.
What's new:
- no more bazillion calls of update_light_colors with lots of color multiplications, since the chip handles that now itself.
- two-side-lighting with different materials no longer causes a tcl fallback (so samples/fog now runs correctly, of course if you use tcl_mode=0 it is still hosed - it looks like the tcl fallback if both fog and two-side lighting are enabled is broken on both radeon and r200, but that's another topic. It was the starting point for this patch however, but I was unable to figure out what's wrong with the fallback. The tnl stuff is scary :-().
- removed the strange fallback if materials between begin / end were discovered. Couldn't figure out why it was there (the comment said the chip handles it just fine?), I thought maybe because material changes caused for instance lighting updates, which now no longer happens. Well so far it didn't lock up...
Another hangover from the r100, which can't handle this at all. The r200 should do just fine.
There are some things I'm unsure about. For one, the update_global_ambient now has an impossible if condition, but I have no idea if the function works correctly now or not - it could also work better than before, who knows ;-). There's also a lot of guesswork involved, but at first glance things seemed to look quite good - the patch passes the nwn and glxgears test ;-) (and some others too, but didn't test extensively yet).
Maybe I missed something important and this lighting code fails in some cases horribly, but if not I think this lighting code would be much nicer (it should likely also help TNL performance quite a bit, unless you run on a P5 10Ghz). The code is also quite a bit simpler than before IMHO, most of the code is just two large copy/paste if statements.
No, just clearing out the cobwebs. Good work. I'll try and have a closer look at the patch.
Keith
------------------------------------------------------- The SF.Net email is sponsored by EclipseCon 2004 Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA. http://www.eclipsecon.org/osdn -- _______________________________________________ Dri-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/dri-devel