wined3d: Implement vertex fog with pixel shaders

Fabian Bieler der.fabe at
Fri Mar 16 04:10:25 CDT 2007

On Friday 16 March 2007 08:40, H. Verbeet wrote:
> Did you check if the clamping is required?
Which clamping do you mean, the clamping in the vertexshader I removed or the 
clamping in the fragmentshader I added?

The clamping I removed in the vertexshader is not required:
If we use opengl's fixed function rasterization pipeline in combination with a 
vertexshader the shader should pass the fog coordinate to the rasterizer 
(which is there used as input for the fog equation and clamped afterwards, 
regardless of the fog hint).
If we use use a fragmentshader, the blending factor is clamped by it.

The clamping I added in the fragmentshader is required:
For one, I use it to disable fog to avoid shader recompilation or 2 gl shaders 
per d3d shader. Also, the value has to be clamped before mixing, as values 
outside of [0:1] result in bogus data.


More information about the wine-devel mailing list