Re: [PATCH 2/8] wined3d: Avoid potential division by 0 when computing fog scale.
On 16 June 2015 at 22:45, Matteo Bruni <mbruni(a)codeweavers.com> wrote:
get_fog_start_end(context, state, &start, &end); - scale = 1.0f / (end - start); + scale = end == start ? INFINITY : 1.0f / (end - start);
Do we really need this? It almost feels nicer to just pass "end - start" to the shader and handle the division there, or perhaps even just pass "start".
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Am 2015-06-17 um 11:36 schrieb Henri Verbeet:
Do we really need this? It almost feels nicer to just pass "end - start" to the shader and handle the division there, or perhaps even just pass "start". I like the idea of calculating this once per draw rather than once per fragment. I did notice a performance difference when I wrote ba61730daa6a614ef07128a69a0bbca819e716b4, although it was only visible in a test application I wrote for World of Tanks performance, not in a real world game.
I think Matteo's patch comment should be put inside the code to explain why the explicit check and INFINITE are there. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBAgAGBQJVgUSaAAoJEN0/YqbEcdMwjLIQAJCC+QAUteQU+ycsHl2Qm3by FebLPToQNg0mfUCXbOAGgEL7zXxGl2aRNC73x9kld/gwD9HuTPi36HFA/f7E6ddd 1xMjDWqzmlywaBI1+GyPSYn6C/7Xto1ESN6ytxrUa4xPi2f9M0iRmUdbWykIeg+a u89gznGVv3BZuVF+CEPbvbHbEir6tuUPHsLzb5Ue0tZVSf4MuSBXDvE8PKE4Jqv8 11Uphn03ZXMEKDV/b6LkZJrcR99WgxgIbGIo0DG/aNnDHT0NWYOJV8dCrk0/BAx5 iwtxsiQj8wybTaho/eFRsMqhij9yzvWDpg5gBB9ufGdqiZDd4MiKt+OIHa7DIkwa 0mQAM+3NXh/dSzWsEQJgubqmF4EMAO9dMPhsI5qAc7hAtDOziOiI7pYj3x6HGFML mFJ5q1mZe26viA9zGWduPCY3N7ltZzyngLcNleVv3M/AttBwWOD6cNFeZjGd0uUl Jei9S290PCaU+IGZ1FoJnqK14JnlisZngvDWG7slXxnh6Dj0Q394MWM/YCWb3Bfu ywnFCvjsy01SY0/9rxHBytlJAsdtp5DgXh98Ucj+yDeY1iswDIjP38F61+Fk03N/ T/i/AB1pJqcGRln7bOn6c66ZGTkxsIEu0BmR4pFlom582QYdwHlwa/6NjL1GZgye Ue4jfMUyGKNIDf8EH2Ua =gosR -----END PGP SIGNATURE-----
2015-06-17 11:57 GMT+02:00 Stefan Dösinger <stefandoesinger(a)gmail.com>:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Am 2015-06-17 um 11:36 schrieb Henri Verbeet:
Do we really need this? It almost feels nicer to just pass "end - start" to the shader and handle the division there, or perhaps even just pass "start". I like the idea of calculating this once per draw rather than once per fragment. I did notice a performance difference when I wrote ba61730daa6a614ef07128a69a0bbca819e716b4, although it was only visible in a test application I wrote for World of Tanks performance, not in a real world game.
Yeah, that was the reasoning for passing scale instead of start to the shader (actually I used start in my initial implementation of the fog emulation).
I think Matteo's patch comment should be put inside the code to explain why the explicit check and INFINITE are there.
That's a good idea. I don't know of any specific application requiring this right now. I guess I can defer resending the patch in any form until (and if) we get any indication that this is a problem.
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Am 2015-06-17 um 15:35 schrieb Matteo Bruni:
I don't know of any specific application requiring this right now. I guess I can defer resending the patch in any form until (and if) we get any indication that this is a problem. The game in question is called Risk of Rain. The bug applies to any game made with Game Maker from YoYo Games. Unfortunately that problem was never reported to us, it was reported to Nvidia and I got the information from them.
Note that there's a demo of the game that is not affected by the problem. It seems an update to the game later introduced the issue. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBAgAGBQJVgX6YAAoJEN0/YqbEcdMwcEQP/04rmw63B8A4VN1h7/jPkYal wv6Ckneec4z+lEAdpHG3SANg1dmdMmjeJvUWi4zlyAs59J2xcPSO4NEF2Mfk45kL 38q3WASAOUWq37Q8/hiQTCbJz913TaddbNF/e0FyEaaL1Wf/hkPytY81J9RxwGTt eY/OdUL4df3/He3RKegvI0mDc+THIM70/OG9WbNSj5Z7npXJityc4dPQUYrvn7wS 0mjCol5mwuNsd5QD76Th8rsSZnJcO10T/C0v/ymUfZxq9/VS8gASbEgy1UwKP2Zp 3qsBfjjY3SIFhgYeCjQU9eqAejqVs9VT/+iYt32EPQyhX31EbVrLCdJHKA5JriMM 8WygKXhTz0VOHkv57nR2OuHyUTHO02Tb91WCaYt0eIA7rncdKP/AeTd3YXobxgw/ 1OCGLNyM+JYUkl87p3qa8qVeXOeAhn4QvRGOn792ML/pbG7EZRb7LeO50JkNP7cQ 7kS1f+tIQn7Vnz8P6q5PaNFe5yiEk163NFsqGfH4U3WD3DVMcAlv0+jIp2YVxiV5 +Drvhe4NkW+6Tt/eDHviOx245lb0K0gfa2LE4BmAL0/jp73/r11PZHM1eKb1WzE8 RveN+5f1kwDEhNXrTSieyqtiiFKW71gpVbNC2FBgVGFFIilQlk1aa0jGuCmDzfDg Bj/Lv0rfnHlEKwVkh81O =+5+n -----END PGP SIGNATURE-----
participants (3)
-
Henri Verbeet -
Matteo Bruni -
Stefan Dösinger