wined3d: Correctly display fog for right-handed projection matrix (try 3)

Matteo Bruni matteo.mystral at
Tue Sep 30 15:45:42 CDT 2014

2014-09-30 11:33 GMT+02:00 Joachim Priesner <joachim.priesner at>:

Hi Joachim,

> When using a right-handed projection matrix, z coordinates of vertices may be negative. This is not considered in the code generating the GLSL fog shader for fixed-function fog. The patch fixes that and adds a test.
> Tested on openSUSE 13.1 and Windows 8.1.
> Try 3 with tests using pixel shaders and tests for d3d8. I have not included tests using vertex shaders since the bug is in Wine's FFP implementation, so using vertex shaders would not touch the relevant code path.

If I understood Henri's comment to the previous iteration of this
patch correctly, the point of the additional test is to make sure that
the bug is really in the vertex FFP replacement code (as opposed to
the pixel pipeline part). You could verify that by writing a negative
value into oFog via a vertex shader (see e.g. vertex_shader_code_2 in
visual.c) and checking the results of the rendering.
For example you could draw a quad setting oFog to -0.5 for the
vertices on the left side and 0.5 on the right side. If the pixel
pipeline uses the value output by the vertex pipeline with no changes
then you should get an horizontal fog gradient. If, on the other hand,
it's the pixel pipe that takes the absolute value of the
(interpolated) fog coefficient, you would get two mirrored gradients
in the two halves of the quad.

I'm sure Henri will correct me if I got it wrong.

> Also I have not included ddraw tests since I could not even get the unchanged tests to run on either Linux or Windows and I feel I have spent *way* too much time on this one-line fix already, sorry :-)

Sorry you feel like that but we'd really like to have such fixes
backed by tests, too many times "obvious" fixes turned out to be wrong
when actually tested thoroughly.

More information about the wine-devel mailing list