diff --git a/libs/vkd3d/command.c b/libs/vkd3d/command.c index d3feb785..31a5d203 100644 --- a/libs/vkd3d/command.c +++ b/libs/vkd3d/command.c @@ -247,6 +247,7 @@ static HRESULT vkd3d_enqueue_gpu_fence(struct vkd3d_fence_worker *worker, VkFence vk_fence, struct d3d12_fence *fence, uint64_t value, struct vkd3d_queue *queue, uint64_t queue_sequence_number) { + struct vkd3d_waiting_fence *waiting_fence; int rc; TRACE("worker %p, fence %p, value %#"PRIx64".\n", worker, fence, value); @@ -266,10 +267,11 @@ static HRESULT vkd3d_enqueue_gpu_fence(struct vkd3d_fence_worker *worker, } worker->enqueued_fences[worker->enqueued_fence_count].vk_fence = vk_fence; - worker->enqueued_fences[worker->enqueued_fence_count].fence = fence; - worker->enqueued_fences[worker->enqueued_fence_count].value = value; - worker->enqueued_fences[worker->enqueued_fence_count].queue = queue; - worker->enqueued_fences[worker->enqueued_fence_count].queue_sequence_number = queue_sequence_number; + waiting_fence = &worker->enqueued_fences[worker->enqueued_fence_count].waiting_fence; + waiting_fence->fence = fence; + waiting_fence->value = value; + waiting_fence->queue = queue; + waiting_fence->queue_sequence_number = queue_sequence_number; ++worker->enqueued_fence_count; InterlockedIncrement(&fence->pending_worker_operation_count); @@ -337,12 +339,7 @@ static void vkd3d_fence_worker_move_enqueued_fences_locked(struct vkd3d_fence_wo struct vkd3d_enqueued_fence *current = &worker->enqueued_fences[i]; worker->vk_fences[worker->fence_count] = current->vk_fence; - - worker->fences[worker->fence_count].fence = current->fence; - worker->fences[worker->fence_count].value = current->value; - worker->fences[worker->fence_count].queue = current->queue; - worker->fences[worker->fence_count].queue_sequence_number = current->queue_sequence_number; - + worker->fences[worker->fence_count] = current->waiting_fence; ++worker->fence_count; } assert(worker->fence_count == count); diff --git a/libs/vkd3d/vkd3d_private.h b/libs/vkd3d/vkd3d_private.h index 97b5de52..7cbf0d83 100644 --- a/libs/vkd3d/vkd3d_private.h +++ b/libs/vkd3d/vkd3d_private.h @@ -152,6 +152,14 @@ HRESULT vkd3d_create_thread(struct vkd3d_instance *instance, PFN_vkd3d_thread thread_main, void *data, union vkd3d_thread_handle *thread) DECLSPEC_HIDDEN; HRESULT vkd3d_join_thread(struct vkd3d_instance *instance, union vkd3d_thread_handle *thread) DECLSPEC_HIDDEN; +struct vkd3d_waiting_fence +{ + struct d3d12_fence *fence; + uint64_t value; + struct vkd3d_queue *queue; + uint64_t queue_sequence_number; +}; + struct vkd3d_fence_worker { union vkd3d_thread_handle thread; @@ -165,23 +173,14 @@ struct vkd3d_fence_worker struct vkd3d_enqueued_fence { VkFence vk_fence; - struct d3d12_fence *fence; - uint64_t value; - struct vkd3d_queue *queue; - uint64_t queue_sequence_number; + struct vkd3d_waiting_fence waiting_fence; } *enqueued_fences; size_t enqueued_fences_size; size_t fence_count; VkFence *vk_fences; size_t vk_fences_size; - struct vkd3d_waiting_fence - { - struct d3d12_fence *fence; - uint64_t value; - struct vkd3d_queue *queue; - uint64_t queue_sequence_number; - } *fences; + struct vkd3d_waiting_fence *fences; size_t fences_size; struct d3d12_device *device;