mirror of
https://github.com/w23/xash3d-fwgs
synced 2025-01-18 23:00:01 +01:00
create command pool and buffer
This commit is contained in:
parent
5600cf45ef
commit
e7a99c2558
@ -540,6 +540,26 @@ static qboolean createSwapchain( void )
|
||||
return true;
|
||||
}
|
||||
|
||||
static qboolean createCommandPool( void ) {
|
||||
VkCommandPoolCreateInfo cpci = {
|
||||
.sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO,
|
||||
.queueFamilyIndex = 0,
|
||||
.flags = VK_COMMAND_POOL_CREATE_TRANSIENT_BIT | VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT,
|
||||
};
|
||||
|
||||
VkCommandBufferAllocateInfo cbai = {
|
||||
.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO,
|
||||
.commandBufferCount = 1,
|
||||
.level = VK_COMMAND_BUFFER_LEVEL_PRIMARY,
|
||||
};
|
||||
|
||||
XVK_CHECK(vkCreateCommandPool(vk_core.device, &cpci, NULL, &vk_core.command_pool));
|
||||
cbai.commandPool = vk_core.command_pool;
|
||||
XVK_CHECK(vkAllocateCommandBuffers(vk_core.device, &cbai, &vk_core.cb));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
qboolean R_VkInit( void )
|
||||
{
|
||||
vk_core.debug = !!(gEngine.Sys_CheckParm("-vkdebug") || gEngine.Sys_CheckParm("-gldebug"));
|
||||
@ -592,6 +612,9 @@ qboolean R_VkInit( void )
|
||||
if (!createSwapchain())
|
||||
return false;
|
||||
|
||||
if (!createCommandPool())
|
||||
return false;
|
||||
|
||||
// TODO initAllocator()
|
||||
// TODO initPipelines()
|
||||
|
||||
|
@ -41,6 +41,9 @@ typedef struct vulkan_core_s {
|
||||
VkImageView *image_views;
|
||||
VkFramebuffer *framebuffers;
|
||||
} swapchain;
|
||||
|
||||
VkCommandPool command_pool;
|
||||
VkCommandBuffer cb;
|
||||
} vulkan_core_t;
|
||||
|
||||
extern vulkan_core_t vk_core;
|
||||
@ -68,6 +71,8 @@ const char *resultName(VkResult result);
|
||||
X(vkCreatePipelineLayout) \
|
||||
X(vkCreateGraphicsPipelines) \
|
||||
X(vkCreateShaderModule) \
|
||||
X(vkCreateCommandPool) \
|
||||
X(vkAllocateCommandBuffers) \
|
||||
|
||||
#define X(f) extern PFN_##f f;
|
||||
DEVICE_FUNCS(X)
|
||||
|
Loading…
x
Reference in New Issue
Block a user