Module: wine
Branch: master
Commit: c6b9aa7a7c44a97fccc5b5270e90786dfac1eb83
URL: https://gitlab.winehq.org/wine/wine/-/commit/c6b9aa7a7c44a97fccc5b5270e9078…
Author: Zebediah Figura <zfigura(a)codeweavers.com>
Date: Tue Jul 18 00:31:02 2023 -0500
wined3d: Implement a copy-on-write scheme for whole buffer uploads.
For discard maps on deferred contexts, we currently blit from the upload buffer
to the resource. This is necessary because command lists can be reused and
submitted multiple times—we cannot simply have the buffer take ownership, as for
discard maps on immediate contexts.
However, it is very common for applications to use command lists only once
before throwing them away—in essence taking advantage of the feature only for
the multithreading advantages it allows.
Therefore we take advantage of this pattern by trying to rename the buffer
anyway. In order to do this we introduce a refcount for BO pointers. When
writing to a buffer BO, we first check whether the buffer "owns" the BO—i.e.
whether it has a refcount of 1—and if not, we create a new BO for the buffer and
copy the contents of the old BO to the new BO. That is, we perform
mostly-transparent copy-on-write.
This improves performance, and reduces CPU usage, in Assassin's Creed: Unity.
---
dlls/wined3d/buffer.c | 87 +++++++++++++++++++++++++++++++++++++-----
dlls/wined3d/context_gl.c | 3 ++
dlls/wined3d/context_vk.c | 5 +++
dlls/wined3d/cs.c | 7 +++-
dlls/wined3d/device.c | 1 +
dlls/wined3d/view.c | 10 +++++
dlls/wined3d/wined3d_private.h | 7 ++++
7 files changed, 109 insertions(+), 11 deletions(-)
Module: wine
Branch: master
Commit: b2f13103d7d96fc082b91b8e808599836ed4a2b1
URL: https://gitlab.winehq.org/wine/wine/-/commit/b2f13103d7d96fc082b91b8e808599…
Author: Zebediah Figura <zfigura(a)codeweavers.com>
Date: Mon Jul 17 19:36:54 2023 -0500
wined3d: Remove BO users from the list when invalidating them.
This makes it easier to invalidate in the case where multiple resources share
the same BO, which in turn is necessary to implement copy-on-write semantics for
BOs.
This is also necessary if we ever want to evict resources which have views,
although it's not clear if this will ever be necessary. If nothing else, though,
it removes that implicit dependency.
---
dlls/wined3d/adapter_vk.c | 11 +++++------
dlls/wined3d/buffer.c | 26 +++++++++++++-------------
dlls/wined3d/context_gl.c | 24 ++++++++++++------------
dlls/wined3d/context_vk.c | 2 ++
dlls/wined3d/state.c | 6 +++---
dlls/wined3d/texture.c | 3 ++-
dlls/wined3d/view.c | 21 +++++++++++++++++----
dlls/wined3d/wined3d_private.h | 8 ++++++++
8 files changed, 62 insertions(+), 39 deletions(-)