diff options
author | Axel Davy <[email protected]> | 2019-04-24 23:24:40 +0200 |
---|---|---|
committer | Axel Davy <[email protected]> | 2019-04-30 19:18:52 +0200 |
commit | 562f5a35c88f0de62bb6f6c65fa668b6211e4bd0 (patch) | |
tree | 485887d9227f763db9d1acf3f8c14726a02823f8 | |
parent | 92117c989ca46ec01b58aec630bcca8cab1e8d15 (diff) |
st/nine: Optimize a bit writeonly buffers
Optimize writeonly by passing PIPE_TRANSFER_WRITE
for these buffers instead of the safer
PIPE_TRANSFER_READ_WRITE.
This seems to improve the performance of d3d8 games
using d3d8to9.
Signed-off-by: Axel Davy <[email protected]>
-rw-r--r-- | src/gallium/state_trackers/nine/buffer9.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/gallium/state_trackers/nine/buffer9.c b/src/gallium/state_trackers/nine/buffer9.c index 30066f11c83..f93abaa5c84 100644 --- a/src/gallium/state_trackers/nine/buffer9.c +++ b/src/gallium/state_trackers/nine/buffer9.c @@ -283,7 +283,12 @@ NineBuffer9_Lock( struct NineBuffer9 *This, else if (Flags & D3DLOCK_NOOVERWRITE) usage = PIPE_TRANSFER_WRITE | PIPE_TRANSFER_UNSYNCHRONIZED; else - usage = PIPE_TRANSFER_READ_WRITE; + /* Do not ask for READ if writeonly and default pool (should be safe enough, + * as the doc says app shouldn't expect reading to work with writeonly). + * Ignore for Systemmem as it has special behaviours. */ + usage = ((This->base.usage & D3DUSAGE_WRITEONLY) && This->base.pool == D3DPOOL_DEFAULT) ? + PIPE_TRANSFER_WRITE : + PIPE_TRANSFER_READ_WRITE; if (Flags & D3DLOCK_DONOTWAIT && !(This->base.usage & D3DUSAGE_DYNAMIC)) usage |= PIPE_TRANSFER_DONTBLOCK; |