diff options
author | Philip Rebohle <philip.rebohle@tu-dortmund.de> | 2022-08-11 01:38:49 +0300 |
---|---|---|
committer | Philip Rebohle <philip.rebohle@tu-dortmund.de> | 2022-08-11 01:38:49 +0300 |
commit | 85c278f515cd1884d7288f976a4406dde7c79958 (patch) | |
tree | 98bc328918d2f03afe019d60808ffc189f84100f | |
parent | 4c7da80c1410044e548b696ca9f8ad66422bcf17 (diff) |
[dxvk] Don't try to merge buffer ranges in barrier listbarrier-optimizations
Too slow, doesn't work most of the time anyway.
-rw-r--r-- | src/dxvk/dxvk_barrier.h | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/src/dxvk/dxvk_barrier.h b/src/dxvk/dxvk_barrier.h index 27e421cf..9b83ee39 100644 --- a/src/dxvk/dxvk_barrier.h +++ b/src/dxvk/dxvk_barrier.h @@ -321,23 +321,29 @@ namespace dxvk { if (hashEntry) { ListEntry* listEntry = getListEntry(hashEntry->next); - // Only create the linear list if absolutely necessary - if (!listEntry && !hashEntry->data.canMerge(slice)) - listEntry = insertListEntry(hashEntry->data, hashEntry); - if (listEntry) { - while (listEntry) { - // Avoid adding new list entries if possible - if (listEntry->data.canMerge(slice)) { - listEntry->data.merge(slice); - break; - } - - listEntry = getListEntry(listEntry->next); - } - - if (!listEntry) + if (std::is_same_v<T, DxvkBarrierImageSlice>) { + // For images, try to merge the slice with existing + // entries if possible to keep the list small + do { + if (listEntry->data.canMerge(slice)) { + listEntry->data.merge(slice); + break; + } + } while ((listEntry = getListEntry(listEntry->next))); + + if (!listEntry) + insertListEntry(slice, hashEntry); + } else { + // For buffers it's not even worth trying. Most of the + // time we won't be able to merge, and traversing the + // entire list every time is slow. insertListEntry(slice, hashEntry); + } + } else if (!hashEntry->data.canMerge(slice)) { + // Only create the linear list if absolutely necessary + insertListEntry(hashEntry->data, hashEntry); + insertListEntry(slice, hashEntry); } // Merge hash entry data so that it stores |