mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-04-13 05:43:18 -07:00
vkd3d: Don't copy an entire descriptor when destroying a view.
Based on a vkd3d-proton patch by Philip Rebohle. Signed-off-by: Conor McCarthy <cmccarthy@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
committed by
Alexandre Julliard
parent
726bf72b07
commit
b252693043
@ -2121,26 +2121,24 @@ void vkd3d_view_decref(struct vkd3d_view *view, struct d3d12_device *device)
|
|||||||
void d3d12_desc_write_atomic(struct d3d12_desc *dst, const struct d3d12_desc *src,
|
void d3d12_desc_write_atomic(struct d3d12_desc *dst, const struct d3d12_desc *src,
|
||||||
struct d3d12_device *device)
|
struct d3d12_device *device)
|
||||||
{
|
{
|
||||||
struct d3d12_desc destroy_desc;
|
struct vkd3d_view *defunct_view = NULL;
|
||||||
pthread_mutex_t *mutex;
|
pthread_mutex_t *mutex;
|
||||||
|
|
||||||
destroy_desc.u.view = NULL;
|
|
||||||
|
|
||||||
mutex = d3d12_device_get_descriptor_mutex(device, dst);
|
mutex = d3d12_device_get_descriptor_mutex(device, dst);
|
||||||
pthread_mutex_lock(mutex);
|
pthread_mutex_lock(mutex);
|
||||||
|
|
||||||
/* Nothing to do for VKD3D_DESCRIPTOR_MAGIC_CBV. */
|
/* Nothing to do for VKD3D_DESCRIPTOR_MAGIC_CBV. */
|
||||||
if ((dst->magic & VKD3D_DESCRIPTOR_MAGIC_HAS_VIEW)
|
if ((dst->magic & VKD3D_DESCRIPTOR_MAGIC_HAS_VIEW)
|
||||||
&& !InterlockedDecrement(&dst->u.view->refcount))
|
&& !InterlockedDecrement(&dst->u.view->refcount))
|
||||||
destroy_desc = *dst;
|
defunct_view = dst->u.view;
|
||||||
|
|
||||||
*dst = *src;
|
*dst = *src;
|
||||||
|
|
||||||
pthread_mutex_unlock(mutex);
|
pthread_mutex_unlock(mutex);
|
||||||
|
|
||||||
/* Destroy the view after unlocking to reduce wait time. */
|
/* Destroy the view after unlocking to reduce wait time. */
|
||||||
if (destroy_desc.u.view)
|
if (defunct_view)
|
||||||
vkd3d_view_destroy(destroy_desc.u.view, device);
|
vkd3d_view_destroy(defunct_view, device);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void d3d12_desc_destroy(struct d3d12_desc *descriptor, struct d3d12_device *device)
|
static void d3d12_desc_destroy(struct d3d12_desc *descriptor, struct d3d12_device *device)
|
||||||
|
Reference in New Issue
Block a user