mirror of
https://github.com/libretro/RetroArch
synced 2025-01-26 09:35:21 +00:00
Add some HAVE_THREADS ifdefs
This commit is contained in:
parent
78783cc2aa
commit
fc56f6ebdb
@ -481,7 +481,9 @@ struct vk_texture vulkan_create_texture(vk_t *vk,
|
||||
submit_info.commandBufferCount = 1;
|
||||
submit_info.pCommandBuffers = &staging;
|
||||
|
||||
#ifdef HAVE_THREADS
|
||||
slock_lock(vk->context->queue_lock);
|
||||
#endif
|
||||
VKFUNC(vkQueueSubmit)(vk->context->queue,
|
||||
1, &submit_info, VK_NULL_HANDLE);
|
||||
|
||||
@ -489,7 +491,9 @@ struct vk_texture vulkan_create_texture(vk_t *vk,
|
||||
* during init, so waiting for GPU to complete transfer
|
||||
* and blocking isn't a big deal. */
|
||||
VKFUNC(vkQueueWaitIdle)(vk->context->queue);
|
||||
#ifdef HAVE_THREADS
|
||||
slock_unlock(vk->context->queue_lock);
|
||||
#endif
|
||||
|
||||
VKFUNC(vkFreeCommandBuffers)(vk->context->device, vk->staging_pool, 1, &staging);
|
||||
vulkan_destroy_texture(
|
||||
@ -1423,9 +1427,11 @@ bool vulkan_context_init(gfx_ctx_vulkan_data_t *vk,
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef HAVE_THREADS
|
||||
vk->context.queue_lock = slock_new();
|
||||
if (!vk->context.queue_lock)
|
||||
return false;
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -1577,7 +1583,9 @@ void vulkan_present(gfx_ctx_vulkan_data_t *vk, unsigned index)
|
||||
present.pWaitSemaphores = &vk->context.swapchain_semaphores[index];
|
||||
|
||||
/* Better hope QueuePresent doesn't block D: */
|
||||
#ifdef HAVE_THREADS
|
||||
slock_lock(vk->context.queue_lock);
|
||||
#endif
|
||||
err = VKFUNC(vkQueuePresentKHR)(vk->context.queue, &present);
|
||||
|
||||
if (err != VK_SUCCESS || result != VK_SUCCESS)
|
||||
@ -1586,7 +1594,9 @@ void vulkan_present(gfx_ctx_vulkan_data_t *vk, unsigned index)
|
||||
vk->context.invalid_swapchain = true;
|
||||
}
|
||||
|
||||
#ifdef HAVE_THREADS
|
||||
slock_unlock(vk->context.queue_lock);
|
||||
#endif
|
||||
}
|
||||
|
||||
void vulkan_context_destroy(gfx_ctx_vulkan_data_t *vk,
|
||||
|
@ -3786,6 +3786,7 @@ static void video_texture_load_gl(
|
||||
);
|
||||
}
|
||||
|
||||
#ifdef HAVE_THREADS
|
||||
static int video_texture_load_wrap_gl_mipmap(void *data)
|
||||
{
|
||||
uintptr_t id = 0;
|
||||
@ -3807,6 +3808,7 @@ static int video_texture_load_wrap_gl(void *data)
|
||||
TEXTURE_FILTER_LINEAR, &id);
|
||||
return id;
|
||||
}
|
||||
#endif
|
||||
|
||||
static uintptr_t gl_load_texture(void *video_data, void *data,
|
||||
bool threaded, enum texture_filter_type filter_type)
|
||||
|
@ -885,13 +885,17 @@ static void vulkan_set_command_buffers(void *handle, uint32_t num_cmd,
|
||||
static void vulkan_lock_queue(void *handle)
|
||||
{
|
||||
vk_t *vk = (vk_t*)handle;
|
||||
#ifdef HAVE_THREADS
|
||||
slock_lock(vk->context->queue_lock);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void vulkan_unlock_queue(void *handle)
|
||||
{
|
||||
vk_t *vk = (vk_t*)handle;
|
||||
#ifdef HAVE_THREADS
|
||||
slock_unlock(vk->context->queue_lock);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void vulkan_init_hw_render(vk_t *vk)
|
||||
@ -1741,10 +1745,14 @@ static bool vulkan_frame(void *data, const void *frame,
|
||||
|
||||
retro_perf_start(&queue_submit);
|
||||
|
||||
#ifdef HAVE_THREADS
|
||||
slock_lock(vk->context->queue_lock);
|
||||
#endif
|
||||
VKFUNC(vkQueueSubmit)(vk->context->queue, 1,
|
||||
&submit_info, vk->context->swapchain_fences[frame_index]);
|
||||
#ifdef HAVE_THREADS
|
||||
slock_unlock(vk->context->queue_lock);
|
||||
#endif
|
||||
retro_perf_stop(&queue_submit);
|
||||
|
||||
retro_perf_start(&swapbuffers);
|
||||
@ -2263,9 +2271,13 @@ static bool vulkan_overlay_load(void *data,
|
||||
if (!vk)
|
||||
return false;
|
||||
|
||||
#ifdef HAVE_THREADS
|
||||
slock_lock(vk->context->queue_lock);
|
||||
#endif
|
||||
VKFUNC(vkQueueWaitIdle)(vk->context->queue);
|
||||
#ifdef HAVE_THREADS
|
||||
slock_unlock(vk->context->queue_lock);
|
||||
#endif
|
||||
vulkan_overlay_free(vk);
|
||||
|
||||
vk->overlay.images = (struct vk_texture*)
|
||||
|
Loading…
x
Reference in New Issue
Block a user