diff --git a/include/QF/Vulkan/command.h b/include/QF/Vulkan/command.h index c9ed3021e..d568e03f2 100644 --- a/include/QF/Vulkan/command.h +++ b/include/QF/Vulkan/command.h @@ -44,4 +44,15 @@ int QFV_QueueSubmit (struct qfv_queue_s *queue, qfv_semaphoreset_t *signalSemaphores, VkFence fence); int QFV_QueueWaitIdle (struct qfv_queue_s *queue); +typedef struct { + VkShaderStageFlags stageFlags; + uint32_t offset; + uint32_t size; + const void *data; +} qfv_push_constants_t; + +void QFV_PushConstants (struct qfv_device_s *device, VkCommandBuffer cmd, + VkPipelineLayout layout, uint32_t numPC, + const qfv_push_constants_t *constants); + #endif//__QF_Vulkan_command_h diff --git a/libs/video/renderer/vulkan/command.c b/libs/video/renderer/vulkan/command.c index 5843a15f3..bd21bb8b6 100644 --- a/libs/video/renderer/vulkan/command.c +++ b/libs/video/renderer/vulkan/command.c @@ -162,3 +162,17 @@ QFV_QueueWaitIdle (qfv_queue_t *queue) qfv_devfuncs_t *dfunc = device->funcs; return dfunc->vkQueueWaitIdle (queue->queue) == VK_SUCCESS; } + +void +QFV_PushConstants (qfv_device_t *device, VkCommandBuffer cmd, + VkPipelineLayout layout, uint32_t numPC, + const qfv_push_constants_t *constants) +{ + qfv_devfuncs_t *dfunc = device->funcs; + + for (uint32_t i = 0; i < numPC; i++) { + dfunc->vkCmdPushConstants (cmd, layout, constants[i].stageFlags, + constants[i].offset, constants[i].size, + constants[i].data); + } +} diff --git a/libs/video/renderer/vulkan/vulkan_sprite.c b/libs/video/renderer/vulkan/vulkan_sprite.c index 6b8935e26..a27f9947c 100644 --- a/libs/video/renderer/vulkan/vulkan_sprite.c +++ b/libs/video/renderer/vulkan/vulkan_sprite.c @@ -67,13 +67,6 @@ #include "r_internal.h" #include "vid_vulkan.h" -typedef struct { - VkShaderStageFlags stageFlags; - uint32_t offset; - uint32_t size; - const void *data; -} qfv_push_constants_t; - static const char * __attribute__((used)) sprite_pass_names[] = { "depth", "g-buffer", @@ -96,11 +89,7 @@ emit_commands (VkCommandBuffer cmd, qfv_sprite_t *sprite, qfv_devfuncs_t *dfunc = device->funcs; spritectx_t *sctx = ctx->sprite_context; - for (int i = 0; i < numPC; i++) { - dfunc->vkCmdPushConstants (cmd, sctx->layout, constants[i].stageFlags, - constants[i].offset, constants[i].size, - constants[i].data); - } + QFV_PushConstants (device, cmd, sctx->layout, numPC, constants); VkDescriptorSet sets[] = { sprite->descriptors, };