Add a queue type

This commit is contained in:
Bill Currie 2019-07-23 12:37:47 +09:00
parent 411b897f09
commit a165d67dfa
5 changed files with 22 additions and 9 deletions

View file

@ -48,6 +48,7 @@ typedef struct qfv_fenceset_s {
} qfv_fenceset_t;
struct qfv_device_s;
struct qfv_queue_s;
qfv_cmdpool_t *QFV_CreateCommandPool (struct qfv_device_s *device,
uint32_t queueFamily,
int transient, int reset);
@ -70,7 +71,7 @@ qfv_fence_t *QFV_CreateFence (struct qfv_device_s *device, int signaled);
qfv_fenceset_t *QFV_CreateFenceSet (qfv_fence_t **fences, int numFences);
int QFV_WaitForFences (qfv_fenceset_t *fences, int all, uint64_t timeout);
int QFV_ResetFences (qfv_fenceset_t *fences);
int QFV_QueueSubmit (struct qfv_device_s *device,
int QFV_QueueSubmit (struct qfv_queue_s *queue,
qfv_semaphoreset_t *waitSemaphores,
qfv_cmdbufferset_t *buffers,
qfv_semaphoreset_t *signalSemaphores, qfv_fence_t *fence);

View file

@ -7,13 +7,21 @@ typedef struct qfv_devfuncs_s {
#include "QF/Vulkan/funclist.h"
} qfv_devfuncs_t;
struct qfv_device_s;
typedef struct qfv_queue_s {
VkDevice dev;
qfv_devfuncs_t *funcs;
int32_t queueFamily;
VkQueue queue;
} qfv_queue_t;
struct qfv_instance_s;
typedef struct qfv_device_s {
VkDevice dev;
VkPhysicalDevice physDev;
qfv_devfuncs_t *funcs;
int32_t queueFamily;
VkQueue queue;
qfv_queue_t queue;
struct strset_s *enabled_extensions;
int (*extension_enabled) (struct qfv_device_s *inst,
const char *ext);

View file

@ -297,11 +297,11 @@ QFV_ResetFences (qfv_fenceset_t *fences)
}
int
QFV_QueueSubmit (qfv_device_t *device, qfv_semaphoreset_t *waitSemaphores,
QFV_QueueSubmit (qfv_queue_t *queue, qfv_semaphoreset_t *waitSemaphores,
qfv_cmdbufferset_t *buffers,
qfv_semaphoreset_t *signalSemaphores, qfv_fence_t *fence)
{
qfv_devfuncs_t *dfunc = device->funcs;
qfv_devfuncs_t *dfunc = queue->funcs;
VkSubmitInfo submitInfo = {
VK_STRUCTURE_TYPE_SUBMIT_INFO, 0,
waitSemaphores->numSemaphores,
@ -311,6 +311,6 @@ QFV_QueueSubmit (qfv_device_t *device, qfv_semaphoreset_t *waitSemaphores,
signalSemaphores->semaphores
};
//FIXME multi-batch
return dfunc->vkQueueSubmit (device->queue, 1, &submitInfo,
return dfunc->vkQueueSubmit (queue->queue, 1, &submitInfo,
fence->fence) == VK_SUCCESS;
}

View file

@ -191,8 +191,11 @@ QFV_CreateDevice (vulkan_ctx_t *ctx, const char **extensions)
device->physDev = physdev;
load_device_funcs (inst, device);
device->queueFamily = family;
dfunc->vkGetDeviceQueue (device->dev, family, 0, &device->queue);
device->queue.dev = device->dev;
device->queue.funcs = dfunc;
device->queue.queueFamily = family;
dfunc->vkGetDeviceQueue (device->dev, family, 0,
&device->queue.queue);
ctx->device = device;
return device;
}

View file

@ -27,10 +27,11 @@ QFV_CreateSwapchain (vulkan_ctx_t *ctx, VkSwapchainKHR old_swapchain)
{
qfv_instfuncs_t *ifuncs = ctx->instance->funcs;
qfv_devfuncs_t *dfuncs = ctx->device->funcs;
qfv_queue_t *queue = &ctx->device->queue;
VkBool32 supported;
ifuncs->vkGetPhysicalDeviceSurfaceSupportKHR (ctx->device->physDev,
ctx->device->queueFamily,
queue->queueFamily,
ctx->surface,
&supported);
if (!supported) {