quakeforge/include/QF/Vulkan/init.h
Bill Currie ab08e4f207 Create a logical device with a single queue
A single graphics-capable queue should be enough for now. However, I'm
not sure I'm happy with a lot of the code: it's a bit difficult to write
flexibly configured code for Vulkan (or seems to be at this stage),
especially in C.
2019-07-07 01:28:05 +09:00

77 lines
2.2 KiB
C

/*
Copyright (C) 2019 Bill Currie <bill@taniwha.org>
Author: Bill Currie
Date: 2019/6/29
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to:
Free Software Foundation, Inc.
59 Temple Place - Suite 330
Boston, MA 02111-1307, USA
*/
#ifndef __QF_Vulkan_init_h
#define __QF_Vulkan_init_h
#include <vulkan/vulkan.h>
#include "QF/qtypes.h"
#include "QF/Vulkan/funcs.h"
typedef struct {
VkDevice device;
VkQueue queue;
#define DEVICE_LEVEL_VULKAN_FUNCTION(name) PFN_##name name;
#define DEVICE_LEVEL_VULKAN_FUNCTION_EXTENSION(name) PFN_##name name;
#include "QF/Vulkan/funclist.h"
} VulkanDevice_t;
typedef struct {
VkPhysicalDevice device;
VkPhysicalDeviceFeatures features;
VkPhysicalDeviceProperties properties;
uint32_t numLayers;
VkLayerProperties *layers;
uint32_t numExtensions;
VkExtensionProperties *extensions;
VkPhysicalDeviceMemoryProperties memory;
uint32_t numQueueFamilies;
VkQueueFamilyProperties *queueFamilies;
} VulkanPhysDevice_t;
typedef struct {
VkInstance instance;
VkDebugUtilsMessengerEXT debug_callback;
uint32_t numDevices;
VulkanPhysDevice_t *devices;
#define INSTANCE_LEVEL_VULKAN_FUNCTION(name) PFN_##name name;
#define INSTANCE_LEVEL_VULKAN_FUNCTION_EXTENSION(name) PFN_##name name;
#include "QF/Vulkan/funclist.h"
} VulkanInstance_t;
void Vulkan_Init_Cvars (void);
VulkanInstance_t *Vulkan_CreateInstance (const char *appName,
uint32_t appVersion,
const char **layers,
const char **extensions);
void Vulkan_DestroyInstance (VulkanInstance_t *instance);
int Vulkan_ExtensionsSupported (const VkExtensionProperties *extensions,
int numExtensions,
const char * const *requested);
#endif // __QF_Vulkan_init_h