mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 15:22:04 +00:00
[vulkan] Ensure staging buffer is idle before free
I never actually tested what would happen, but I suspect destroying a staging buffer before it is finished its job would lead to unpleasant issues.
This commit is contained in:
parent
9eef805b7d
commit
6f73a7388b
2 changed files with 11 additions and 2 deletions
|
@ -15,6 +15,9 @@ typedef struct qfv_semaphoreset_s
|
|||
typedef struct qfv_fenceset_s
|
||||
DARRAY_TYPE (VkFence) qfv_fenceset_t;
|
||||
|
||||
#define QFV_AllocFenceSet(num, allocator) \
|
||||
DARRAY_ALLOCFIXED (qfv_fenceset_t, num, allocator)
|
||||
|
||||
typedef struct qfv_bufferimagecopy_s
|
||||
DARRAY_TYPE (VkBufferImageCopy) qfv_bufferimagecopy_t;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
shader.c
|
||||
staging.c
|
||||
|
||||
Vulkan shader manager
|
||||
Vulkan staging buffer manager
|
||||
|
||||
Copyright (C) 2021 Bill Currie <bill@taniwha.org>
|
||||
|
||||
|
@ -97,6 +97,12 @@ QFV_DestroyStagingBuffer (qfv_stagebuf_t *stage)
|
|||
qfv_device_t *device = stage->device;
|
||||
qfv_devfuncs_t *dfunc = device->funcs;
|
||||
|
||||
__auto_type fences = QFV_AllocFenceSet (stage->num_packets, alloca);
|
||||
for (size_t i = 0; i < stage->num_packets; i++) {
|
||||
fences->a[i] = stage->packet[i].fence;
|
||||
}
|
||||
dfunc->vkWaitForFences (device->dev, fences->size, fences->a, VK_TRUE,
|
||||
~0ull);
|
||||
for (size_t i = 0; i < stage->num_packets; i++) {
|
||||
dfunc->vkDestroyFence (device->dev, stage->packet[i].fence, 0);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue