Create command pool and allocate command buffer
This commit is contained in:
parent
b1ac87d304
commit
d30b37bfbd
@ -25,6 +25,8 @@ namespace nf::client::render {
|
|||||||
, m_swapchainFramebuffers()
|
, m_swapchainFramebuffers()
|
||||||
, m_pipelineLayoutOutput()
|
, m_pipelineLayoutOutput()
|
||||||
, m_pipelineOutput()
|
, m_pipelineOutput()
|
||||||
|
, m_commandPool()
|
||||||
|
, m_commandBuffer()
|
||||||
{
|
{
|
||||||
NFLog("Initializing render engine");
|
NFLog("Initializing render engine");
|
||||||
m_window->setDisplay(m_display);
|
m_window->setDisplay(m_display);
|
||||||
@ -36,6 +38,7 @@ namespace nf::client::render {
|
|||||||
createSwapchain();
|
createSwapchain();
|
||||||
createOutputRenderPass();
|
createOutputRenderPass();
|
||||||
createOutputPipeline();
|
createOutputPipeline();
|
||||||
|
createCommandBuffer();
|
||||||
|
|
||||||
m_window->show();
|
m_window->show();
|
||||||
}
|
}
|
||||||
@ -377,7 +380,25 @@ namespace nf::client::render {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RenderEngine::createCommandBuffer() {
|
||||||
|
VkCommandPoolCreateInfo commandPoolCI = { VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO };
|
||||||
|
commandPoolCI.flags = VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT;
|
||||||
|
commandPoolCI.queueFamilyIndex = m_queueFIGraphics;
|
||||||
|
|
||||||
|
if (vkCreateCommandPool(m_device, &commandPoolCI, nullptr, &m_commandPool) != VK_SUCCESS)
|
||||||
|
NFError("Could not create command pool.");
|
||||||
|
|
||||||
|
VkCommandBufferAllocateInfo commandBufferAI = { VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO };
|
||||||
|
commandBufferAI.commandPool = m_commandPool;
|
||||||
|
commandBufferAI.commandBufferCount = 1;
|
||||||
|
|
||||||
|
if (vkAllocateCommandBuffers(m_device, &commandBufferAI, &m_commandBuffer) != VK_SUCCESS)
|
||||||
|
NFError("Could not create command buffer.");
|
||||||
|
}
|
||||||
|
|
||||||
RenderEngine::~RenderEngine() {
|
RenderEngine::~RenderEngine() {
|
||||||
|
vkDestroyCommandPool(m_device, m_commandPool, nullptr);
|
||||||
|
|
||||||
for (int i = 0; i < m_swapchainFramebuffers.size(); i++)
|
for (int i = 0; i < m_swapchainFramebuffers.size(); i++)
|
||||||
vkDestroyFramebuffer(m_device, m_swapchainFramebuffers[i], nullptr);
|
vkDestroyFramebuffer(m_device, m_swapchainFramebuffers[i], nullptr);
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@ namespace nf::client::render {
|
|||||||
void createSwapchain();
|
void createSwapchain();
|
||||||
void createOutputRenderPass();
|
void createOutputRenderPass();
|
||||||
void createOutputPipeline();
|
void createOutputPipeline();
|
||||||
|
void createCommandBuffer();
|
||||||
|
|
||||||
std::shared_ptr<Window> m_window;
|
std::shared_ptr<Window> m_window;
|
||||||
DisplayConfig m_display;
|
DisplayConfig m_display;
|
||||||
@ -41,5 +42,9 @@ namespace nf::client::render {
|
|||||||
// Pipelines
|
// Pipelines
|
||||||
VkPipelineLayout m_pipelineLayoutOutput;
|
VkPipelineLayout m_pipelineLayoutOutput;
|
||||||
VkPipeline m_pipelineOutput;
|
VkPipeline m_pipelineOutput;
|
||||||
|
|
||||||
|
// Command buffers
|
||||||
|
VkCommandPool m_commandPool;
|
||||||
|
VkCommandBuffer m_commandBuffer;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user