mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-04-13 05:43:18 -07:00
vkd3d: Add a pending execution count to struct d3d12_command_signature.
Buffering of command list commands will depend upon command signatures persisting until the buffer is flushed.
This commit is contained in:
parent
31ff1fa9b6
commit
acc68aef94
Notes:
Alexandre Julliard
2023-07-24 22:54:55 +02:00
Approved-by: Henri Verbeet (@hverbeet) Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/260
@ -1905,6 +1905,28 @@ HRESULT d3d12_command_allocator_create(struct d3d12_device *device,
|
|||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void d3d12_command_signature_incref(struct d3d12_command_signature *signature)
|
||||||
|
{
|
||||||
|
vkd3d_atomic_increment(&signature->internal_refcount);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void d3d12_command_signature_decref(struct d3d12_command_signature *signature)
|
||||||
|
{
|
||||||
|
unsigned int refcount = vkd3d_atomic_decrement(&signature->internal_refcount);
|
||||||
|
|
||||||
|
if (!refcount)
|
||||||
|
{
|
||||||
|
struct d3d12_device *device = signature->device;
|
||||||
|
|
||||||
|
vkd3d_private_store_destroy(&signature->private_store);
|
||||||
|
|
||||||
|
vkd3d_free((void *)signature->desc.pArgumentDescs);
|
||||||
|
vkd3d_free(signature);
|
||||||
|
|
||||||
|
d3d12_device_release(device);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* ID3D12CommandList */
|
/* ID3D12CommandList */
|
||||||
static inline struct d3d12_command_list *impl_from_ID3D12GraphicsCommandList2(ID3D12GraphicsCommandList2 *iface)
|
static inline struct d3d12_command_list *impl_from_ID3D12GraphicsCommandList2(ID3D12GraphicsCommandList2 *iface)
|
||||||
{
|
{
|
||||||
@ -5738,6 +5760,8 @@ static void STDMETHODCALLTYPE d3d12_command_list_ExecuteIndirect(ID3D12GraphicsC
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
d3d12_command_signature_incref(sig_impl);
|
||||||
|
|
||||||
signature_desc = &sig_impl->desc;
|
signature_desc = &sig_impl->desc;
|
||||||
for (i = 0; i < signature_desc->NumArgumentDescs; ++i)
|
for (i = 0; i < signature_desc->NumArgumentDescs; ++i)
|
||||||
{
|
{
|
||||||
@ -5800,6 +5824,7 @@ static void STDMETHODCALLTYPE d3d12_command_list_ExecuteIndirect(ID3D12GraphicsC
|
|||||||
if (!d3d12_command_list_update_compute_state(list))
|
if (!d3d12_command_list_update_compute_state(list))
|
||||||
{
|
{
|
||||||
WARN("Failed to update compute state, ignoring dispatch.\n");
|
WARN("Failed to update compute state, ignoring dispatch.\n");
|
||||||
|
d3d12_command_signature_decref(sig_impl);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5812,6 +5837,8 @@ static void STDMETHODCALLTYPE d3d12_command_list_ExecuteIndirect(ID3D12GraphicsC
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
d3d12_command_signature_decref(sig_impl);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void STDMETHODCALLTYPE d3d12_command_list_AtomicCopyBufferUINT(ID3D12GraphicsCommandList2 *iface,
|
static void STDMETHODCALLTYPE d3d12_command_list_AtomicCopyBufferUINT(ID3D12GraphicsCommandList2 *iface,
|
||||||
@ -7306,16 +7333,7 @@ static ULONG STDMETHODCALLTYPE d3d12_command_signature_Release(ID3D12CommandSign
|
|||||||
TRACE("%p decreasing refcount to %u.\n", signature, refcount);
|
TRACE("%p decreasing refcount to %u.\n", signature, refcount);
|
||||||
|
|
||||||
if (!refcount)
|
if (!refcount)
|
||||||
{
|
d3d12_command_signature_decref(signature);
|
||||||
struct d3d12_device *device = signature->device;
|
|
||||||
|
|
||||||
vkd3d_private_store_destroy(&signature->private_store);
|
|
||||||
|
|
||||||
vkd3d_free((void *)signature->desc.pArgumentDescs);
|
|
||||||
vkd3d_free(signature);
|
|
||||||
|
|
||||||
d3d12_device_release(device);
|
|
||||||
}
|
|
||||||
|
|
||||||
return refcount;
|
return refcount;
|
||||||
}
|
}
|
||||||
@ -7422,6 +7440,7 @@ HRESULT d3d12_command_signature_create(struct d3d12_device *device, const D3D12_
|
|||||||
|
|
||||||
object->ID3D12CommandSignature_iface.lpVtbl = &d3d12_command_signature_vtbl;
|
object->ID3D12CommandSignature_iface.lpVtbl = &d3d12_command_signature_vtbl;
|
||||||
object->refcount = 1;
|
object->refcount = 1;
|
||||||
|
object->internal_refcount = 1;
|
||||||
|
|
||||||
object->desc = *desc;
|
object->desc = *desc;
|
||||||
if (!(object->desc.pArgumentDescs = vkd3d_calloc(desc->NumArgumentDescs, sizeof(*desc->pArgumentDescs))))
|
if (!(object->desc.pArgumentDescs = vkd3d_calloc(desc->NumArgumentDescs, sizeof(*desc->pArgumentDescs))))
|
||||||
|
@ -253,6 +253,11 @@ static inline void vkd3d_cond_destroy(struct vkd3d_cond *cond)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline unsigned int vkd3d_atomic_increment(unsigned int volatile *x)
|
||||||
|
{
|
||||||
|
return InterlockedIncrement((LONG volatile *)x);
|
||||||
|
}
|
||||||
|
|
||||||
static inline unsigned int vkd3d_atomic_decrement(unsigned int volatile *x)
|
static inline unsigned int vkd3d_atomic_decrement(unsigned int volatile *x)
|
||||||
{
|
{
|
||||||
return InterlockedDecrement((LONG volatile *)x);
|
return InterlockedDecrement((LONG volatile *)x);
|
||||||
@ -387,6 +392,15 @@ static inline unsigned int vkd3d_atomic_decrement(unsigned int volatile *x)
|
|||||||
}
|
}
|
||||||
# else
|
# else
|
||||||
# error "vkd3d_atomic_decrement() not implemented for this platform"
|
# error "vkd3d_atomic_decrement() not implemented for this platform"
|
||||||
|
# endif /* HAVE_SYNC_SUB_AND_FETCH */
|
||||||
|
|
||||||
|
# if HAVE_SYNC_ADD_AND_FETCH
|
||||||
|
static inline unsigned int vkd3d_atomic_increment(unsigned int volatile *x)
|
||||||
|
{
|
||||||
|
return __sync_add_and_fetch(x, 1);
|
||||||
|
}
|
||||||
|
# else
|
||||||
|
# error "vkd3d_atomic_increment() not implemented for this platform"
|
||||||
# endif /* HAVE_SYNC_ADD_AND_FETCH */
|
# endif /* HAVE_SYNC_ADD_AND_FETCH */
|
||||||
|
|
||||||
# if HAVE_SYNC_BOOL_COMPARE_AND_SWAP
|
# if HAVE_SYNC_BOOL_COMPARE_AND_SWAP
|
||||||
@ -1579,6 +1593,7 @@ struct d3d12_command_signature
|
|||||||
{
|
{
|
||||||
ID3D12CommandSignature ID3D12CommandSignature_iface;
|
ID3D12CommandSignature ID3D12CommandSignature_iface;
|
||||||
LONG refcount;
|
LONG refcount;
|
||||||
|
unsigned int internal_refcount;
|
||||||
|
|
||||||
D3D12_COMMAND_SIGNATURE_DESC desc;
|
D3D12_COMMAND_SIGNATURE_DESC desc;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user