diff options
author | Axel Davy <davyaxel0@gmail.com> | 2021-03-27 22:33:06 +0100 |
---|---|---|
committer | Marge Bot <eric+marge@anholt.net> | 2021-04-14 08:33:14 +0000 |
commit | 805cedd2077782be329b53bbe8a986301b28d0d6 (patch) | |
tree | 665b302ab7d76e57a1290f0c7738444c588f37c7 | |
parent | 1797a6eb047fcb01cda609046c039c9c6e4e873d (diff) |
st/nine: Have NOOVERWRITE win over DISCARD
I held for a long time the belief DISCARD wins
over NOOVERWRITE, backed by experiments.
But probably both behaviours are ok.
For perf it is better to have NOOVERWRITE win.
Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Acked-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10160>
-rw-r--r-- | src/gallium/frontends/nine/buffer9.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/gallium/frontends/nine/buffer9.c b/src/gallium/frontends/nine/buffer9.c index 0cdc6185d41..54f93c6c537 100644 --- a/src/gallium/frontends/nine/buffer9.c +++ b/src/gallium/frontends/nine/buffer9.c @@ -338,8 +338,15 @@ NineBuffer9_Lock( struct NineBuffer9 *This, * Our tests: On win 7 nvidia, D3DLOCK_DONOTWAIT does return * D3DERR_WASSTILLDRAWING if the resource is in use, except for DYNAMIC. * Our tests: some apps do use both DISCARD and NOOVERWRITE at the same - * time. On windows it seems to return different pointer, thus indicating - * DISCARD is taken into account. */ + * time. On windows it seems to return different pointer in some conditions, + * creation flags and drivers. However these tests indicate having + * NOOVERWRITE win is a valid behaviour (NVidia). + */ + + /* Have NOOVERWRITE win over DISCARD. This is allowed (see above) and + * it prevents overconsuming buffers if apps do use both at the same time. */ + if ((Flags & (D3DLOCK_DISCARD | D3DLOCK_NOOVERWRITE)) == (D3DLOCK_DISCARD | D3DLOCK_NOOVERWRITE)) + Flags &= ~D3DLOCK_DISCARD; if (Flags & D3DLOCK_DISCARD) usage = PIPE_MAP_WRITE | PIPE_MAP_DISCARD_WHOLE_RESOURCE; |