[PATCH 1/5] wined3d: Clamp fog coordinate in the vertex shader.

Stefan Dösinger stefandoesinger at gmx.at
Thu Mar 8 15:10:12 CST 2012


Am Donnerstag, 8. März 2012, 18:22:15 schrieb Matteo Bruni:
> -                shader_addline(buffer, "gl_FogFragCoord = OUT[%u].%c;\n",
> i, reg_mask[1]);
> +                shader_addline(buffer, "gl_FogFragCoord =
> clamp(OUT[%u].%c, 0.0, 1.0);\n", i, reg_mask[1]);
Is it correct to clamp the fog coord in the vertex shader, or should this be 
done in the pixel shader? The tests do not answer this question because they 
write the same fog coordinate for each vertex.

Imagine for example two lines. In each of those lines, one vertex has oFog = 
0.0. The other vertex has oFog = 1.1 in one line, and oFog = 100 in the other. 
If the value is clamped per vertex, those lines will look the same. If it's 
clamped per pixel, the latter line will have much steeper gradient

Also, what happens to shaders that do not write oFog, but use oPos.z, 
especially in the situations where the near and far clipping planes are 
disabled?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20120308/233ab914/attachment.pgp>


More information about the wine-devel mailing list