Rework semaphore sets

This commit is contained in:
Bill Currie 2020-02-17 00:10:32 +09:00
parent 559bd2e636
commit 4b152a4492
2 changed files with 14 additions and 7 deletions

View file

@ -26,7 +26,8 @@ typedef struct qfv_semaphore_s {
typedef struct qfv_semaphoreset_s { typedef struct qfv_semaphoreset_s {
struct qfv_device_s *device; struct qfv_device_s *device;
VkSemaphore *semaphores; qfv_semaphore_t **semaphores;
VkSemaphore *vkSemaphores;
VkPipelineStageFlags *stages; VkPipelineStageFlags *stages;
int numSemaphores; int numSemaphores;
} qfv_semaphoreset_t; } qfv_semaphoreset_t;

View file

@ -237,17 +237,23 @@ QFV_CreateSemaphoreSet (qfv_semaphore_t **semaphores, int numSemaphores)
qfv_device_t *device = semaphores[0]->device; qfv_device_t *device = semaphores[0]->device;
qfv_semaphoreset_t *semaphoreset; qfv_semaphoreset_t *semaphoreset;
semaphoreset = calloc (1, sizeof (*semaphoreset) semaphoreset = calloc (1, sizeof (*semaphoreset)
+ sizeof (qfv_semaphore_t *) * numSemaphores
+ sizeof (VkSemaphore) * numSemaphores + sizeof (VkSemaphore) * numSemaphores
+ sizeof (VkPipelineStageFlags) * numSemaphores); + sizeof (VkPipelineStageFlags) * numSemaphores);
semaphoreset->device = device; semaphoreset->device = device;
semaphoreset->semaphores = (VkSemaphore *) (semaphoreset + 1); semaphoreset->vkSemaphores = (VkSemaphore *) (semaphoreset + 1);
semaphoreset->stages = (VkPipelineStageFlags *) semaphoreset->stages = (VkPipelineStageFlags *)
&semaphoreset->semaphores[numSemaphores]; &semaphoreset->vkSemaphores[numSemaphores];
semaphoreset->semaphores = (qfv_semaphore_t **) (semaphoreset->stages
+ numSemaphores);
semaphoreset->numSemaphores = numSemaphores; semaphoreset->numSemaphores = numSemaphores;
if (semaphores) {
for (int i = 0; i < numSemaphores; i++) { for (int i = 0; i < numSemaphores; i++) {
semaphoreset->semaphores[i] = semaphores[i]->semaphore; semaphoreset->semaphores[i] = semaphores[i];
semaphoreset->vkSemaphores[i] = semaphores[i]->semaphore;
}
} }
return semaphoreset; return semaphoreset;
} }
@ -379,10 +385,10 @@ QFV_QueueSubmit (qfv_queue_t *queue, qfv_semaphoreset_t *waitSemaphores,
VkSubmitInfo submitInfo = { VkSubmitInfo submitInfo = {
VK_STRUCTURE_TYPE_SUBMIT_INFO, 0, VK_STRUCTURE_TYPE_SUBMIT_INFO, 0,
waitSemaphores->numSemaphores, waitSemaphores->numSemaphores,
waitSemaphores->semaphores, waitSemaphores->stages, waitSemaphores->vkSemaphores, waitSemaphores->stages,
buffers->numBuffers, buffers->vkBuffers, buffers->numBuffers, buffers->vkBuffers,
signalSemaphores->numSemaphores, signalSemaphores->numSemaphores,
signalSemaphores->semaphores signalSemaphores->vkSemaphores
}; };
//FIXME multi-batch //FIXME multi-batch
return dfunc->vkQueueSubmit (queue->queue, 1, &submitInfo, return dfunc->vkQueueSubmit (queue->queue, 1, &submitInfo,