make render pass a member in init

This commit is contained in:
jacekpoz 2024-09-24 11:21:54 +02:00
parent 854416f651
commit e664c74cb2
Signed by: poz
SSH key fingerprint: SHA256:JyLeVWE4bF3tDnFeUpUaJsPsNlJyBldDGV/dIKSLyN8

View file

@ -100,6 +100,8 @@ static PTK_LIST(VkBuffer) m_uniform_buffers;
static PTK_LIST(VkDeviceMemory) m_uniform_buffers_memory;
static PTK_LIST(voidptr) m_uniform_buffers_mapped;
static VkRenderPass m_render_pass;
static VkDescriptorPool m_descriptor_pool;
static PTK_LIST(VkDescriptorSet) m_descriptor_sets;
@ -385,7 +387,7 @@ bool create_graphics_pipeline(void) {
.pColorBlendState = &color_blending,
.pDynamicState = &dynamic_state,
.layout = m_pipeline_layout,
.renderPass = g_render_pass,
.renderPass = m_render_pass,
.subpass = 0,
.basePipelineHandle = VK_NULL_HANDLE,
.basePipelineIndex = -1,
@ -782,7 +784,7 @@ bool vk_record_command_buffer(const VkCommandBuffer command_buffer, const uint32
&(VkRenderPassBeginInfo){
.sType = VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO,
.pNext = NULL,
.renderPass = g_render_pass,
.renderPass = m_render_pass,
.framebuffer = g_swapchain_framebuffers.data[image_index],
.renderArea = (VkRect2D){
.offset = (VkOffset2D){
@ -920,7 +922,7 @@ bool vk_init(GLFWwindow *window, const size_t width, const size_t height, const
return false;
}
VkRenderPass render_pass = render_pass_opt.value;
m_render_pass = render_pass_opt.value;
if (!create_descriptor_set_layout()) {
PTK_ERR("failed creating descriptor set layout");
@ -932,7 +934,7 @@ bool vk_init(GLFWwindow *window, const size_t width, const size_t height, const
return false;
}
if (!vk_create_framebuffers(render_pass)) {
if (!vk_create_framebuffers(m_render_pass)) {
PTK_ERR("failed creating framebuffers");
return false;
}
@ -986,7 +988,7 @@ void vk_cleanup(void) {
vkDestroyPipeline(g_dev, m_pipeline, NULL);
vkDestroyPipelineLayout(g_dev, m_pipeline_layout, NULL);
vkDestroyRenderPass(g_dev, g_render_pass, NULL);
vkDestroyRenderPass(g_dev, m_render_pass, NULL);
for (size_t i = 0; i < g_max_frames_in_flight; ++i) {
vkDestroyBuffer(g_dev, m_uniform_buffers.data[i], NULL);