Re: [PATCH 6/6] wined3d: Set z = 0.0 via the projection matrix instead of depth clamping.
2015-02-11 21:53 GMT+01:00 Stefan Dösinger <stefan(a)codeweavers.com>:
This works on cards that don't implement ARB_depth_clamp like r500 cards.
Note that texturing is influenced by position.w, not position.z. --- dlls/wined3d/directx.c | 7 ------- dlls/wined3d/state.c | 33 ++++++++++----------------------- dlls/wined3d/wined3d_gl.h | 2 -- 3 files changed, 10 insertions(+), 32 deletions(-)
It's probably hard to measure and not going to really matter in practice but toggling the depth clamping (where supported) might be slightly faster than updating the projection matrix. I'm not NACKing the patch though.
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Am 2015-02-11 um 23:56 schrieb Matteo Bruni:
It's probably hard to measure and not going to really matter in practice but toggling the depth clamping (where supported) might be slightly faster than updating the projection matrix. I'll try to patch my drawprim overhead tester to test this.
I don't expect it to be faster though. At very least it depends on the game's behavior. One of two switches that needs to be toggled to disable depth clipping is switching to POSITIONT vertices, in which case we update the projection matrix anyway. Even if there's a minor performance advantage of depth clamping in cases where an application constantly uses POSITIONT and switches ZENABLE on an off I prefer to always use the projection matrix to have only one codepath that does this. If there's a huge difference we may think about two alternating codepaths. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBAgAGBQJU3Fo1AAoJEN0/YqbEcdMw558P/ibfOLbJpzYJOfwCWJwLZzY3 7ZiLY1mXNtWGWzys6N/WL+j6Q4YS/3wkMXAdHsXIHtxv6yXoJ+2AOrALgf1dS3M9 6ExnfF7Nt5vgVe+UtjYk4gc0HQ0N4m54pkZbWaY9q1WQ03fK5Lj+owdah96wSd8g rAEUscLNxUzxD3PCdhomxHxnkpz3mSGFwbYkbazROWNpfOAxyILWFKCxgQDbTI+n wpZN1qMCCXQ2SB5c2zIjnyRkmmKmyK9PJM67aHjbMTajgoT8/TRab7AU6GPVLW4L fUuxGcXvz9d+Js9Iq/LVGagahtjFAo1GxAnIfPhboqAydbowDNjDyFbRuxScCTlO PQTDR+EgUoR+mFlcCuYvtHOpnSf1OjcXQOGQf96INtzNqACl9tpJ5ohcUbv61i/h RKk+8F31vZX9NWM4Uk8OrBl4Qr0e5h6jR/6wnJ1/4CAjRUGG4c2EwIPXdhlD4zQW eH8CIzxEzhTRsjJrB5Q1lj1msfGBJPZIbVL4NSYdhIMKwiS6qqBKVdEWg6bzkGQf PPEuCjG5OGtDwYifmlOPvR68fvKyyw9tNzxEFR+qVhOXnrQleaF2+TRjl1DCAIuC TnGPJA7pk1NZiQugDglLmSjqAPF5netp5tpo6o/0LDlGAIArsP0VHjjXanUJ3aq7 g8s8ufXKN3sAVOFx6OL/ =TXZJ -----END PGP SIGNATURE-----
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Am 2015-02-12 um 08:45 schrieb Stefan Dösinger:
Am 2015-02-11 um 23:56 schrieb Matteo Bruni:
It's probably hard to measure and not going to really matter in practice but toggling the depth clamping (where supported) might be slightly faster than updating the projection matrix. I'll try to patch my drawprim overhead tester to test this. Fwiw, I cannot see any performance difference between ARB_depth_clamp and the projection matrix approach in my modified test program.
What I did: Set a POSITIONT vertex while(running) { for(i = 0; i < 1000; i++) { set_rs(ZENABLE, TRUE); draw(); set_rs(ZENABLE, FALSE); draw(); set_rs(ZENABLE, TRUE); draw(); set_rs(ZENABLE, FALSE); draw(); set_rs(ZENABLE, TRUE); draw(); set_rs(ZENABLE, FALSE); draw(); } present(); } I.e., I hit the worst case for the new approach. With ARB_depth_clamp this test program runs at 89.5 fps, with matrices at 89.2. There seems to be a general up and down of +/- 5 fps. Interestingly windows runs this test program at 58 fps. I tested this on Nvidia. I can also test it on r600g if desired, but I don't really expect it to matter. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBAgAGBQJU3GucAAoJEN0/YqbEcdMwpSYP/RlBVxtPygA4fOcbq5/1baV5 Fo/YTjqBgrPq4Y63MKPGEBu6nEi+TrP1UWZyEeh+cYsbgG8pgzHlwNB1aWfeENOv /OkWV1FxfJSJ/rEPZ3mYX0ZSKl2Rwm0LXuxjJR4A1KKkOFTy2sdKcZ/srckQFQM3 IQ7oE59S8Zi7s1YEiVAju4rRhBN1s7f3eiynJ6BhhKNEfdZz9u/WmdhTM0pOC21y NvHMVE/9Vx7VdlWU+gP6vdEMFg14rKoU22lRidcg8s2qiVqtOih4tI6CBN3qdEVw OXqC9AhDg9f7RHm0SQRWE+Oei8cfUAIg9vuHrXW8gWbXKnUkgC782O/siZ4UUZ9Q CEUmURZ2Y9WHtIj0LKu1DjJMdIsn+/iHBSXDkIoO+jvcJ4ckeN2kM4D7XS43/dgE a0vCEMO0OktuLYnRFNc9DRMBifQ5UBzx/yTNvEOcsqvqXW/Jts0GBPd631qYNA/t XEe+XtMQLutOuTyEb8Y2MZRSmXUPLzcoia4rjgN5HEoM/hGZ0j+2xlXVx13YIBFB zzZrJFYicZmUvx+BYtMQ58QWbPl58eJx4THkssdxyyQ3Yse6RnYNqs8o1Zbp3DqZ VFUE2HbVlcQK5/UKIak1Eat3urGcvqcTr3T/OmdWV+Dcqy6dSLpHdC7R5uauMFdr lbjJvudMKUtba2PgMwap =Cev8 -----END PGP SIGNATURE-----
participants (2)
-
Matteo Bruni -
Stefan Dösinger