lavu/vulkan: remove threadsafe buffer index load and fix a signed overflow

It's not needed anymore.
This commit is contained in:
Lynne 2023-07-19 04:54:37 +02:00
parent c06ad641ec
commit 97890c2b55
No known key found for this signature in database
GPG Key ID: A2FEA5F03F034464
2 changed files with 2 additions and 4 deletions

View File

@ -282,8 +282,6 @@ int ff_vk_exec_pool_init(FFVulkanContext *s, FFVkQueueFamilyCtx *qf,
VkCommandPoolCreateInfo cqueue_create; VkCommandPoolCreateInfo cqueue_create;
VkCommandBufferAllocateInfo cbuf_create; VkCommandBufferAllocateInfo cbuf_create;
atomic_init(&pool->idx, 0);
/* Create command pool */ /* Create command pool */
cqueue_create = (VkCommandPoolCreateInfo) { cqueue_create = (VkCommandPoolCreateInfo) {
.sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO, .sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO,
@ -472,7 +470,7 @@ VkResult ff_vk_exec_get_query(FFVulkanContext *s, FFVkExecContext *e,
FFVkExecContext *ff_vk_exec_get(FFVkExecPool *pool) FFVkExecContext *ff_vk_exec_get(FFVkExecPool *pool)
{ {
int idx = atomic_fetch_add_explicit(&pool->idx, 1, memory_order_relaxed); uint32_t idx = pool->idx++;
idx %= pool->pool_size; idx %= pool->pool_size;
return &pool->contexts[idx]; return &pool->contexts[idx];
} }

View File

@ -151,7 +151,7 @@ typedef struct FFVulkanPipeline {
} FFVulkanPipeline; } FFVulkanPipeline;
typedef struct FFVkExecContext { typedef struct FFVkExecContext {
int idx; uint32_t idx;
const struct FFVkExecPool *parent; const struct FFVkExecPool *parent;
pthread_mutex_t lock; pthread_mutex_t lock;