|
@@ -6,7 +6,6 @@
|
|
|
#include "GLFW.h"
|
|
|
#include "VulkanUtils.h"
|
|
|
|
|
|
-// VkCommandPool commandPool;
|
|
|
// VkCommandBuffer* commandsBuffers;
|
|
|
// VkSemaphore semaphore;
|
|
|
// VkSemaphore renderSemaphore;
|
|
@@ -28,6 +27,7 @@ static VkPipelineLayout pipelineLayout;
|
|
|
static VkRenderPass renderPass;
|
|
|
static VkPipeline pipeline;
|
|
|
static VkFramebuffer* framebuffers;
|
|
|
+static VkCommandPool commandPool;
|
|
|
|
|
|
static int getSurfaceFormatPoints(const VkSurfaceFormatKHR* sf) {
|
|
|
if(sf->format == VK_FORMAT_B8G8R8A8_UNORM &&
|
|
@@ -343,6 +343,15 @@ static bool initRenderPass() {
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
+static bool initCommandPool() {
|
|
|
+ VkCommandPoolCreateInfo info = {
|
|
|
+ .sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO,
|
|
|
+ .flags = VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT,
|
|
|
+ .queueFamilyIndex = graphicsFamily};
|
|
|
+ VK_ASSERT(vkCreateCommandPool(device, &info, nullptr, &commandPool));
|
|
|
+ return false;
|
|
|
+}
|
|
|
+
|
|
|
bool initVulkan() {
|
|
|
return initVulkanInstance() || initVulkanDebugging() ||
|
|
|
initVulkanSurface(&surface, getWindow()) || initPhysicalDevice() ||
|
|
@@ -351,9 +360,10 @@ bool initVulkan() {
|
|
|
initRenderPass() || initPipeline() ||
|
|
|
initVulkanFramebuffers(
|
|
|
&framebuffers, &images, device, renderPass, swapchainSize.width,
|
|
|
- swapchainSize.height);
|
|
|
+ swapchainSize.height) ||
|
|
|
+ initCommandPool();
|
|
|
/* || initSemaphore(&vk.semaphore) ||
|
|
|
- initSemaphore(&vk.renderSemaphore) || initCommandBuffers() ||
|
|
|
+ initSemaphore(&vk.renderSemaphore)
|
|
|
*/
|
|
|
}
|
|
|
|
|
@@ -365,6 +375,7 @@ void destroyVulkan(void) {
|
|
|
// destroyCommandBuffers();
|
|
|
// destroySemaphore(vk.semaphore);
|
|
|
// destroySemaphore(vk.renderSemaphore);
|
|
|
+ vkDestroyCommandPool(device, commandPool, nullptr);
|
|
|
destroyVulkanFramebuffers(&framebuffers, images.amount, device);
|
|
|
vkDestroyPipeline(device, pipeline, nullptr);
|
|
|
vkDestroyRenderPass(device, renderPass, nullptr);
|