wined3d: Take abs() of vertex z coordinate as FFP fog coordinate and remove oFog clamp for vertex shaders

Stefan Dösinger stefandoesinger at gmail.com
Wed Oct 22 09:26:41 CDT 2014


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Am 2014-10-22 14:53, schrieb Joachim Priesner:
> Okay, so the fog clamp is not wrong. I'll be happy to re-add it and modify the test so it accepts both variants.
There's D3DPMISCCAPS_FOGVERTEXCLAMPED. I can't find any docs with a quick google search, but it sounds related.

> +        /* No vertex shader */
> +        {0, D3DFOG_NONE,   D3DFOG_LINEAR, C_UNFOGGED, C_HALF_FOGGED, C_HALF_FOGGED, C_FOGGED},
> +        {0, D3DFOG_LINEAR, D3DFOG_LINEAR, C_UNFOGGED, C_HALF_FOGGED, C_HALF_FOGGED, C_FOGGED},
> +        {0, D3DFOG_LINEAR, D3DFOG_NONE,   C_FOGGED,   C_UNFOGGED,    C_FOGGED,      C_FOGGED},
> +        {0, D3DFOG_NONE,   D3DFOG_NONE,   C_FOGGED,   C_FOGGED,      C_FOGGED,      C_FOGGED},
I am wondering about the table fog = linear cases. As far as I understand it they are different from the table fog = none, vertex fog = linear case because of the "w fog" functionality, which is called ortho_fog in wined3d.

The trouble is that the vfog=linear, tfog=none case has an open question: What exactly do the d3d docs mean with "applies fog calculations at each vertex in a polygon". Does that mean no fog factor (oFog) is written by the fixed function pipeline, and the fog color merged into oD0 right away? In other words, assume fixed function vertex processing with an 1.x pixel shader. The vertex input color is red, the fog color green, the Z coordinate results in a fully fogged quad and the pixel shader writes blue. Does that produce a blue or green output? (We may have a test that deliberately or accidentally tests this. I will check.)

If you bypass the W fog thing e.g. by using 1.000001f in proj_matrix[3][3] you get a fully fogged quad in the table fog case as well. But then your sanity check with quad2/quad3 is fully green as well, and I don't yet understand why.

Gosh this is complicated. So much for a simple abs().

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBAgAGBQJUR76hAAoJEN0/YqbEcdMwyVgP/jRyHlc+MT7IDYFmHEBpqPOD
TD0Uqi6MRQAFmV68Gb38KGqwxQJGUPEjOI+cUPEfaZMSa8UzrD6zpHmUz0CGxpHy
2e28m105HoHqi+JIWdkIN+SK8brSSrkqtW4qDxsndCahdREFfJvBbaUq9C64KUDR
ecSwiZLD6MeoSbBHeWYcntNtqwNfI2DdrwTYQYG5hgBbhIQ0rFE60WTdywpf6Fj4
mdkJFY8TkBewQ4zzfT0cox3UOFMqZdCwPLV7K+Q1w4QmpK1w6QAPUz8NflSgAEa7
b6cVfoCLQUkhZmWEh74/LSp90hJ+9AABx7ck4kRkIsalcOn3ysQ0DY937J1NJzgl
WKYrOzR7o75lupYGpKHBFw9iU+SLMMJcIO6ZFSRhony1NSU2TxhNex/gptP02jKh
sJxTyV1+klyanbTHuC4osK8+OuX6BDy0Jw/WVFrLzbi7x6rJ5XXK3uN/9gq60qsS
WGEnbaQWN550mFxC0RthwKCmPxcg6NkKS4Tr9q0PiFVtKcrkOddIQAAn5swtYio0
HPwOpKhYmiALHWnTK0ZP0tgpltfoxQDARg/COosiIZ9ppiirEahz/ls7US6kqCul
+5MJ62JdL9O/jZIU6MHNpaUT75WWdn++HdczKIMx4uZJbobHmrkiChhbzTn2rrbs
DPaPifzYm9AmAxeyxFue
=Yhnk
-----END PGP SIGNATURE-----



More information about the wine-devel mailing list