2014-11-07 20:05 GMT+01:00 Matteo Bruni <matteo.mystral@gmail.com>:
2014-11-07 19:53 GMT+01:00 Joachim Priesner <joachim.priesner@web.de>:

> I could move the vertex declaration directly before the shader code like in test_scalar_instructions, would that make it clear enough?

I think that would be nicer, yes.
I don't think the ordering of the variable declaration is why Henri didn't ack this patch. Maybe he didn't have time to look at it yet or maybe there's something else he doesn't like.

I spotted another problem though: Please test negative fog start or end values, e.g. fogstart = -1 and fogend = 0. As the attached (unfinished) test shows, vertex fog evaluates the fog equation in the vertex pipeline and then linearly interpolates the result into the fragment pipeline, which mixes the colors. This means we have to know if the abs() happens before the fog equation or afterwards. In my quick testing it seems that the abs happens before the fog equation, so your change in glsl_shader.c shouldn't need any changes. I expect that when you set start = -1 and end = 0 all your tests except the NONE/NONE and foggy shader test should come up with a fully fogged quad.

The way vertex fog is evaluated also explains the different handling of fogstart == fogend for vertex and table fog. The attached patch still has problems with table fog on the Radeon X1600 - for some reason it picks a static depth = 1.0, and I don't see why. I suspect a driver bug, but I am not sure yet. The test works on the Radeon 9000 and GeForce 7 GPUs.