Vulkan ImGui functional - Issue with pipeline creation

This commit is contained in:
Ben Kyd
2023-11-30 19:06:23 +00:00
parent 73b4a9c901
commit c9a8a786b6
8 changed files with 166 additions and 158 deletions

101
.vims
View File

@@ -17,14 +17,14 @@ badd +693 src/graphics/vulkan_tutorial.cpp
badd +100 src/inferno.cpp
badd +45 src/scene/mesh.hpp
badd +75 src/scene/mesh.cpp
badd +64 src/graphics/pipeline.cpp
badd +248 src/graphics/vkrenderer.cpp
badd +34 src/graphics/pipeline.cpp
badd +52 src/graphics/vkrenderer.cpp
badd +18 src/graphics/pipeline.hpp
badd +1 src/graphics/device.cpp
badd +19 src/graphics/device.hpp
badd +20 src/graphics/device.hpp
badd +54 src/graphics/renderpass.cpp
badd +20 src/graphics/renderpass.hpp
badd +16 src/graphics/swapchain.hpp
badd +13 src/graphics/swapchain.hpp
badd +56 src/inferno.hpp
badd +1 src/main.cpp
badd +1 ~/dprog/active/inferno-hart/src/graphics/descriptor.cpp
@@ -35,16 +35,18 @@ badd +173 src/graphics/buffer.cpp
badd +5 res/shaders/vulkan_test.vert
badd +46 src/graphics/buffer.hpp
badd +54 src/renderer/renderer.cpp
badd +295 src/graphics/swapchain.cpp
badd +279 src/graphics/swapchain.cpp
badd +22 res/shaders/basic.vert
badd +181 src/graphics/shader.cpp
badd +51 src/graphics/shader.hpp
badd +1 src/scene/scene.hpp
badd +2 src/scene/scene.hpp
badd +240 src/scene/camera.cpp
badd +59 libhart/scene/camera.hpp
badd +30 src/graphics.hpp
badd +64 src/gui/gui.hpp
badd +70 src/gui/gui.hpp
badd +130 src/window.cpp
badd +111 src/thirdparty/imgui/imgui_impl_vulkan.cpp
badd +66 ~/dprog/active/inferno-hart/src/thirdparty/imgui/imgui_impl_vulkan.h
argglobal
%argdel
edit src/gui/gui.hpp
@@ -71,12 +73,12 @@ set winminheight=0
set winheight=1
set winminwidth=0
set winwidth=1
exe 'vert 1resize ' . ((&columns * 124 + 191) / 383)
exe 'vert 2resize ' . ((&columns * 138 + 191) / 383)
exe '3resize ' . ((&lines * 36 + 33) / 67)
exe 'vert 3resize ' . ((&columns * 119 + 191) / 383)
exe '4resize ' . ((&lines * 27 + 33) / 67)
exe 'vert 4resize ' . ((&columns * 119 + 191) / 383)
exe 'vert 1resize ' . ((&columns * 91 + 191) / 383)
exe 'vert 2resize ' . ((&columns * 173 + 191) / 383)
exe '3resize ' . ((&lines * 20 + 33) / 67)
exe 'vert 3resize ' . ((&columns * 117 + 191) / 383)
exe '4resize ' . ((&lines * 43 + 33) / 67)
exe 'vert 4resize ' . ((&columns * 117 + 191) / 383)
argglobal
balt src/window.cpp
setlocal fdm=manual
@@ -89,19 +91,42 @@ setlocal fdn=20
setlocal fen
silent! normal! zE
let &fdl = &fdl
let s:l = 64 - ((51 * winheight(0) + 32) / 64)
let s:l = 81 - ((61 * winheight(0) + 32) / 64)
if s:l < 1 | let s:l = 1 | endif
keepjumps exe s:l
normal! zt
keepjumps 64
keepjumps 81
normal! 0
wincmd w
argglobal
if bufexists(fnamemodify("src/graphics/pipeline.cpp", ":p")) | buffer src/graphics/pipeline.cpp | else | edit src/graphics/pipeline.cpp | endif
if &buftype ==# 'terminal'
silent file src/graphics/pipeline.cpp
endif
balt src/graphics/device.hpp
setlocal fdm=manual
setlocal fde=0
setlocal fmr={{{,}}}
setlocal fdi=#
setlocal fdl=0
setlocal fml=1
setlocal fdn=20
setlocal fen
silent! normal! zE
let &fdl = &fdl
let s:l = 34 - ((33 * winheight(0) + 32) / 64)
if s:l < 1 | let s:l = 1 | endif
keepjumps exe s:l
normal! zt
keepjumps 34
normal! 05|
wincmd w
argglobal
if bufexists(fnamemodify("src/graphics/vkrenderer.cpp", ":p")) | buffer src/graphics/vkrenderer.cpp | else | edit src/graphics/vkrenderer.cpp | endif
if &buftype ==# 'terminal'
silent file src/graphics/vkrenderer.cpp
endif
balt src/graphics/pipeline.cpp
balt src/graphics/swapchain.cpp
setlocal fdm=manual
setlocal fde=0
setlocal fmr={{{,}}}
@@ -112,34 +137,11 @@ setlocal fdn=20
setlocal fen
silent! normal! zE
let &fdl = &fdl
let s:l = 248 - ((38 * winheight(0) + 32) / 64)
let s:l = 53 - ((17 * winheight(0) + 10) / 20)
if s:l < 1 | let s:l = 1 | endif
keepjumps exe s:l
normal! zt
keepjumps 248
normal! 026|
wincmd w
argglobal
if bufexists(fnamemodify("src/scene/scene.hpp", ":p")) | buffer src/scene/scene.hpp | else | edit src/scene/scene.hpp | endif
if &buftype ==# 'terminal'
silent file src/scene/scene.hpp
endif
balt src/graphics/shader.hpp
setlocal fdm=manual
setlocal fde=0
setlocal fmr={{{,}}}
setlocal fdi=#
setlocal fdl=0
setlocal fml=1
setlocal fdn=20
setlocal fen
silent! normal! zE
let &fdl = &fdl
let s:l = 2 - ((0 * winheight(0) + 18) / 36)
if s:l < 1 | let s:l = 1 | endif
keepjumps exe s:l
normal! zt
keepjumps 2
keepjumps 53
normal! 0
wincmd w
argglobal
@@ -158,19 +160,20 @@ setlocal fdn=20
setlocal fen
silent! normal! zE
let &fdl = &fdl
let s:l = 18 - ((9 * winheight(0) + 13) / 27)
let s:l = 18 - ((17 * winheight(0) + 21) / 43)
if s:l < 1 | let s:l = 1 | endif
keepjumps exe s:l
normal! zt
keepjumps 18
normal! 048|
normal! 047|
wincmd w
exe 'vert 1resize ' . ((&columns * 124 + 191) / 383)
exe 'vert 2resize ' . ((&columns * 138 + 191) / 383)
exe '3resize ' . ((&lines * 36 + 33) / 67)
exe 'vert 3resize ' . ((&columns * 119 + 191) / 383)
exe '4resize ' . ((&lines * 27 + 33) / 67)
exe 'vert 4resize ' . ((&columns * 119 + 191) / 383)
2wincmd w
exe 'vert 1resize ' . ((&columns * 91 + 191) / 383)
exe 'vert 2resize ' . ((&columns * 173 + 191) / 383)
exe '3resize ' . ((&lines * 20 + 33) / 67)
exe 'vert 3resize ' . ((&columns * 117 + 191) / 383)
exe '4resize ' . ((&lines * 43 + 33) / 67)
exe 'vert 4resize ' . ((&columns * 117 + 191) / 383)
tabnext 1
if exists('s:wipebuf') && len(win_findbuf(s:wipebuf)) == 0 && getbufvar(s:wipebuf, '&buftype') isnot# 'terminal'
silent exe 'bwipe ' . s:wipebuf

View File

@@ -17,6 +17,7 @@ const std::vector<const char*> DEVICE_EXTENSIONS = {
VK_KHR_SWAPCHAIN_EXTENSION_NAME,
VK_KHR_DYNAMIC_RENDERING_EXTENSION_NAME,
VK_EXT_DYNAMIC_RENDERING_UNUSED_ATTACHMENTS_EXTENSION_NAME,
VK_KHR_GET_MEMORY_REQUIREMENTS_2_EXTENSION_NAME,
};
typedef struct GraphicsDevice {

View File

@@ -18,6 +18,19 @@ Pipeline* pipeline_create(GraphicsDevice* device, SwapChain* swap, Shader* shade
{
Pipeline* pipeline = new Pipeline();
// memset(descriptorSetLayouts, 0, sizeof(VkDescriptorSetLayout));
// memset(&layout, 0, sizeof(VkPipelineLayout));
// memset(&graphicsPipeline, 0, sizeof(VkPipeline));
// memset(&dynamicStates, 0, sizeof(VkPipelineDynamicStateCreateInfo));
// memset(&vertexInputInfo, 0, sizeof(VkPipelineVertexInputStateCreateInfo));
// memset(&inputAssembly, 0, sizeof(VkPipelineInputAssemblyStateCreateInfo));
// memset(&viewportState, 0, sizeof(VkPipelineViewportStateCreateInfo));
// memset(&rasterizer, 0, sizeof(VkPipelineRasterizationStateCreateInfo));
// memset(&multisampling, 0, sizeof(VkPipelineMultisampleStateCreateInfo));
// memset(&colorBlendAttachment, 0, sizeof(VkPipelineColorBlendAttachmentState));
// memset(&colorBlending, 0, sizeof(VkPipelineColorBlendStateCreateInfo));
// memset(&depthState, 0, sizeof(VkPipelineDepthStencilStateCreateInfo));
pipeline->Device = device;
pipeline->Swap = swap;
pipeline->RelaventShader = shader;
@@ -30,88 +43,88 @@ Pipeline* pipeline_create(GraphicsDevice* device, SwapChain* swap, Shader* shade
auto attributeDescriptions = new std::array<VkVertexInputAttributeDescription, 2>(
scene::get_vert_attribute_descriptions());
pipeline->VertexInputInfo.sType
= VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO;
pipeline->VertexInputInfo.vertexBindingDescriptionCount = 1;
pipeline->VertexInputInfo.vertexAttributeDescriptionCount
VkPipelineVertexInputStateCreateInfo vertexInputInfo {};
vertexInputInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO;
vertexInputInfo.vertexBindingDescriptionCount = 1;
vertexInputInfo.vertexAttributeDescriptionCount
= static_cast<uint32_t>(attributeDescriptions->size());
pipeline->VertexInputInfo.pVertexBindingDescriptions = bindingDescription;
pipeline->VertexInputInfo.pVertexAttributeDescriptions
= attributeDescriptions->data();
vertexInputInfo.pVertexBindingDescriptions = bindingDescription;
vertexInputInfo.pVertexAttributeDescriptions = attributeDescriptions->data();
pipeline->InputAssembly.sType
= VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO;
pipeline->InputAssembly.topology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST;
pipeline->InputAssembly.primitiveRestartEnable = VK_FALSE;
VkPipelineInputAssemblyStateCreateInfo inputAssembly {};
inputAssembly.sType = VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO;
inputAssembly.topology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST;
inputAssembly.primitiveRestartEnable = VK_FALSE;
pipeline->ViewportState.sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO;
pipeline->ViewportState.viewportCount = 1;
// pipeline->ViewportState.pViewports = &viewport;
pipeline->ViewportState.scissorCount = 1;
// pipeline->ViewportState.pScissors = &scissor;
VkPipelineViewportStateCreateInfo viewportState {};
viewportState.sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO;
viewportState.viewportCount = 1;
viewportState.scissorCount = 1;
pipeline->Rasterizer.sType
= VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO;
pipeline->Rasterizer.depthClampEnable = VK_FALSE; // NOTE: This is for shadow mapping
pipeline->Rasterizer.rasterizerDiscardEnable = VK_FALSE;
pipeline->Rasterizer.polygonMode = VK_POLYGON_MODE_FILL;
pipeline->Rasterizer.lineWidth = 1.f;
pipeline->Rasterizer.cullMode = VK_CULL_MODE_BACK_BIT;
pipeline->Rasterizer.frontFace = VK_FRONT_FACE_COUNTER_CLOCKWISE;
pipeline->Rasterizer.depthBiasEnable = VK_FALSE;
pipeline->Rasterizer.depthBiasConstantFactor = 0.f; // Optional
pipeline->Rasterizer.depthBiasClamp = 0.f; // Optional
pipeline->Rasterizer.depthBiasSlopeFactor = 0.f; // Optional
VkPipelineRasterizationStateCreateInfo rasterizer {};
rasterizer.sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO;
rasterizer.depthClampEnable = VK_FALSE; // NOTE: This is for shadow mapping
rasterizer.rasterizerDiscardEnable = VK_FALSE;
rasterizer.polygonMode = VK_POLYGON_MODE_FILL;
rasterizer.lineWidth = 1.f;
rasterizer.cullMode = VK_CULL_MODE_BACK_BIT;
rasterizer.frontFace = VK_FRONT_FACE_COUNTER_CLOCKWISE;
rasterizer.depthBiasEnable = VK_FALSE;
pipeline->Multisampling.sType
= VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO;
pipeline->Multisampling.sampleShadingEnable = VK_FALSE;
pipeline->Multisampling.rasterizationSamples = VK_SAMPLE_COUNT_1_BIT;
pipeline->Multisampling.minSampleShading = 1.0f; // Optional
pipeline->Multisampling.pSampleMask = nullptr; // Optional
pipeline->Multisampling.alphaToCoverageEnable = VK_FALSE; // Optional
VkPipelineMultisampleStateCreateInfo multisampling {};
multisampling.sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO;
multisampling.sampleShadingEnable = VK_FALSE;
multisampling.rasterizationSamples = VK_SAMPLE_COUNT_1_BIT;
pipeline->ColorBlendAttachment.colorWriteMask = VK_COLOR_COMPONENT_R_BIT
VkPipelineColorBlendAttachmentState colorBlendAttachment {};
colorBlendAttachment.colorWriteMask = VK_COLOR_COMPONENT_R_BIT
| VK_COLOR_COMPONENT_G_BIT | VK_COLOR_COMPONENT_B_BIT | VK_COLOR_COMPONENT_A_BIT;
// Alpha pipeline->Blending basically
pipeline->ColorBlendAttachment.blendEnable = VK_TRUE;
pipeline->ColorBlendAttachment.srcColorBlendFactor = VK_BLEND_FACTOR_SRC_ALPHA;
pipeline->ColorBlendAttachment.dstColorBlendFactor
= VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA;
pipeline->ColorBlendAttachment.colorBlendOp = VK_BLEND_OP_ADD;
pipeline->ColorBlendAttachment.srcAlphaBlendFactor = VK_BLEND_FACTOR_ONE;
pipeline->ColorBlendAttachment.dstAlphaBlendFactor = VK_BLEND_FACTOR_ZERO;
pipeline->ColorBlendAttachment.alphaBlendOp = VK_BLEND_OP_ADD;
// Alpha blending basically
colorBlendAttachment.blendEnable = VK_FALSE;
// colorBlendAttachment.srcColorBlendFactor = VK_BLEND_FACTOR_SRC_ALPHA;
// colorBlendAttachment.dstColorBlendFactor
// = VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA;
// colorBlendAttachment.colorBlendOp = VK_BLEND_OP_ADD;
// colorBlendAttachment.srcAlphaBlendFactor = VK_BLEND_FACTOR_ONE;
// colorBlendAttachment.dstAlphaBlendFactor = VK_BLEND_FACTOR_ZERO;
// colorBlendAttachment.alphaBlendOp = VK_BLEND_OP_ADD;
pipeline->ColorBlending.sType
= VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO;
pipeline->ColorBlending.logicOpEnable = VK_FALSE;
pipeline->ColorBlending.logicOp = VK_LOGIC_OP_COPY; // Optional
pipeline->ColorBlending.attachmentCount = 1;
pipeline->ColorBlending.pAttachments = &pipeline->ColorBlendAttachment;
pipeline->ColorBlending.blendConstants[0] = 0.0f; // Optional
pipeline->ColorBlending.blendConstants[1] = 0.0f; // Optional
pipeline->ColorBlending.blendConstants[2] = 0.0f; // Optional
pipeline->ColorBlending.blendConstants[3] = 0.0f; // pipeline->Optional
VkPipelineColorBlendStateCreateInfo colorBlending {};
colorBlending.sType = VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO;
colorBlending.logicOpEnable = VK_FALSE;
colorBlending.logicOp = VK_LOGIC_OP_COPY; // Optional
colorBlending.attachmentCount = 1;
colorBlending.pAttachments = &colorBlendAttachment;
colorBlending.blendConstants[0] = 0.0f; // Optional
colorBlending.blendConstants[1] = 0.0f; // Optional
colorBlending.blendConstants[2] = 0.0f; // Optional
colorBlending.blendConstants[3] = 0.0f; // pipeline->Optional
pipeline->DepthState.sType
= VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO;
pipeline->DepthState.depthTestEnable = VK_TRUE;
pipeline->DepthState.depthWriteEnable = VK_TRUE;
pipeline->DepthState.depthCompareOp = VK_COMPARE_OP_LESS;
pipeline->DepthState.depthBoundsTestEnable = VK_FALSE;
pipeline->DepthState.minDepthBounds = 0.0f;
pipeline->DepthState.maxDepthBounds = 1.0f;
pipeline->DepthState.stencilTestEnable = VK_FALSE;
pipeline->DepthState.front = {};
pipeline->DepthState.back = {};
VkPipelineDepthStencilStateCreateInfo depthState {};
depthState.sType = VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO;
depthState.depthTestEnable = VK_TRUE;
depthState.depthWriteEnable = VK_TRUE;
depthState.depthCompareOp = VK_COMPARE_OP_LESS;
depthState.depthBoundsTestEnable = VK_FALSE;
depthState.minDepthBounds = 0.0f;
depthState.maxDepthBounds = 1.0f;
depthState.stencilTestEnable = VK_FALSE;
depthState.front = {};
depthState.back = {};
VkPipelineDynamicStateCreateInfo dynamicStatesCreateInfo {};
std::vector<VkDynamicState> dynamicStates
= { VK_DYNAMIC_STATE_VIEWPORT, VK_DYNAMIC_STATE_SCISSOR };
dynamicStatesCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO;
dynamicStatesCreateInfo.dynamicStateCount
= static_cast<uint32_t>(dynamicStates.size());
dynamicStatesCreateInfo.pDynamicStates = dynamicStates.data();
VkPipelineLayoutCreateInfo pipelineLayoutInfo {};
pipelineLayoutInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO;
pipelineLayoutInfo.setLayoutCount = descriptorSetLayoutCount;
pipelineLayoutInfo.pSetLayouts = layouts;
pipelineLayoutInfo.pushConstantRangeCount = 0; // Optional
pipelineLayoutInfo.pPushConstantRanges = nullptr; // Optional
if (vkCreatePipelineLayout(
device->VulkanDevice, &pipelineLayoutInfo, nullptr, &pipeline->Layout)
@@ -120,55 +133,48 @@ Pipeline* pipeline_create(GraphicsDevice* device, SwapChain* swap, Shader* shade
return nullptr;
}
VkPipelineRenderingCreateInfoKHR renderingPipelineInfo = {};
VkPipelineRenderingCreateInfo renderingPipelineInfo = {};
renderingPipelineInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_RENDERING_CREATE_INFO_KHR;
renderingPipelineInfo.colorAttachmentCount = 1;
renderingPipelineInfo.pColorAttachmentFormats = &pipeline->Swap->ImageFormat;
renderingPipelineInfo.pColorAttachmentFormats = &swap->ImageFormat;
renderingPipelineInfo.depthAttachmentFormat = find_depth_format(device);
renderingPipelineInfo.pNext = nullptr;
VkGraphicsPipelineCreateInfo pipelineInfo = {};
pipelineInfo.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO;
pipelineInfo.stageCount = 2;
pipelineInfo.stageCount = SHADER_STAGES;
pipelineInfo.pStages = shader->ShaderStages;
pipelineInfo.pNext = &renderingPipelineInfo;
std::vector<VkDynamicState> dynamicStates
= { VK_DYNAMIC_STATE_VIEWPORT, VK_DYNAMIC_STATE_SCISSOR };
pipeline->DynamicStates.sType = VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO;
pipeline->DynamicStates.dynamicStateCount
= static_cast<uint32_t>(dynamicStates.size());
pipeline->DynamicStates.pDynamicStates = dynamicStates.data();
pipelineInfo.pVertexInputState = &pipeline->VertexInputInfo;
pipelineInfo.pInputAssemblyState = &pipeline->InputAssembly;
pipelineInfo.pViewportState = &pipeline->ViewportState;
pipelineInfo.pRasterizationState = &pipeline->Rasterizer;
pipelineInfo.pMultisampleState = &pipeline->Multisampling;
pipelineInfo.pColorBlendState = &pipeline->ColorBlending;
pipelineInfo.pDynamicState = &pipeline->DynamicStates;
pipelineInfo.pDepthStencilState = &pipeline->DepthState;
pipelineInfo.pVertexInputState = &vertexInputInfo;
pipelineInfo.pInputAssemblyState = &inputAssembly;
pipelineInfo.pViewportState = &viewportState;
pipelineInfo.pRasterizationState = &rasterizer;
pipelineInfo.pMultisampleState = &multisampling;
pipelineInfo.pColorBlendState = &colorBlending;
pipelineInfo.pDynamicState = &dynamicStatesCreateInfo;
pipelineInfo.pDepthStencilState = &depthState;
pipelineInfo.pTessellationState = VK_NULL_HANDLE; // Optional
pipelineInfo.layout = pipeline->Layout;
pipelineInfo.subpass = 0;
// pipelineInfo.basePipelineHandle = VK_NULL_HANDLE; // Optional
pipelineInfo.basePipelineHandle = VK_NULL_HANDLE; // Optional
// yolo::debug("All Binding Description: {} stride: {}",
// pipeline->VertexInputInfo.pVertexBindingDescriptions->binding,
// pipeline->VertexInputInfo.pVertexBindingDescriptions->stride);
// vertexInputInfo.pVertexBindingDescriptions->binding,
// vertexInputInfo.pVertexBindingDescriptions->stride);
// yolo::debug("All Attribute Description0: {} location: {} format: {} offset: {}",
// pipeline->VertexInputInfo.pVertexAttributeDescriptions[0].binding,
// pipeline->VertexInputInfo.pVertexAttributeDescriptions[0].location,
// pipeline->VertexInputInfo.pVertexAttributeDescriptions[0].format,
// pipeline->VertexInputInfo.pVertexAttributeDescriptions[0].offset);
// vertexInputInfo.pVertexAttributeDescriptions[0].binding,
// vertexInputInfo.pVertexAttributeDescriptions[0].location,
// vertexInputInfo.pVertexAttributeDescriptions[0].format,
// vertexInputInfo.pVertexAttributeDescriptions[0].offset);
// yolo::debug("All Attribute Description1: {} location: {} format: {} offset: {}",
// pipeline->VertexInputInfo.pVertexAttributeDescriptions[1].binding,
// pipeline->VertexInputInfo.pVertexAttributeDescriptions[1].location,
// pipeline->VertexInputInfo.pVertexAttributeDescriptions[1].format,
// pipeline->VertexInputInfo.pVertexAttributeDescriptions[1].offset);
// vertexInputInfo.pVertexAttributeDescriptions[1].binding,
// vertexInputInfo.pVertexAttributeDescriptions[1].location,
// vertexInputInfo.pVertexAttributeDescriptions[1].format,
// vertexInputInfo.pVertexAttributeDescriptions[1].offset);
if (vkCreateGraphicsPipelines(pipeline->Device->VulkanDevice, VK_NULL_HANDLE, 1,
&pipelineInfo, nullptr, &pipeline->GraphicsPipeline)
if (vkCreateGraphicsPipelines(device->VulkanDevice, VK_NULL_HANDLE, 1, &pipelineInfo,
nullptr, &pipeline->GraphicsPipeline)
!= VK_SUCCESS) {
yolo::error("failed to create graphics pipeline!");
}
@@ -193,7 +199,7 @@ void pipeline_recreate(Pipeline* pipeline)
swapchain_recreate(swap);
Shader* shader = pipeline->RelaventShader;
uint32_t descriptorSetLayoutCount = pipeline->DescriptorSetLayoutCount;
uint32_t descriptorSetLayoutCount = descriptorSetLayoutCount;
VkDescriptorSetLayout* layouts = pipeline->DescriptorSetLayouts;
pipeline_cleanup(pipeline);

View File

@@ -19,16 +19,6 @@ typedef struct Pipeline {
VkPipeline GraphicsPipeline;
VkPipelineLayout Layout;
VkPipelineDynamicStateCreateInfo DynamicStates;
VkPipelineVertexInputStateCreateInfo VertexInputInfo;
VkPipelineInputAssemblyStateCreateInfo InputAssembly;
VkPipelineViewportStateCreateInfo ViewportState;
VkPipelineRasterizationStateCreateInfo Rasterizer;
VkPipelineMultisampleStateCreateInfo Multisampling;
VkPipelineColorBlendAttachmentState ColorBlendAttachment;
VkPipelineColorBlendStateCreateInfo ColorBlending;
VkPipelineDepthStencilStateCreateInfo DepthState;
} Pipeline;
Pipeline* pipeline_create(GraphicsDevice* device, SwapChain* swap, Shader* shader,

View File

@@ -276,6 +276,7 @@ void swapchain_image_view_create(SwapChain* swapchain)
}
VkFormat depthFormat = find_depth_format(swapchain->Device);
swapchain->DepthFormat = depthFormat;
create_image(swapchain->Device, swapchain->Extent.width, swapchain->Extent.height,
depthFormat, VK_IMAGE_TILING_OPTIMAL, VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT,

View File

@@ -11,6 +11,7 @@ struct RenderPass;
typedef struct SwapChain {
VkSwapchainKHR Handle;
VkFormat ImageFormat;
VkFormat DepthFormat;
VkExtent2D Extent;
std::vector<VkImage> Images;

View File

@@ -256,6 +256,9 @@ bool renderer_draw_frame(VulkanRenderer* renderer)
work_queue(renderer, &renderer->SubmitQueuePreFrame, false);
ImGui::End();
ImGui::ShowDemoWindow();
gui::imgui_render_frame(*renderer->CommandBufferInFlight);
vkCmdEndRendering(*renderer->CommandBufferInFlight);
@@ -277,6 +280,7 @@ bool renderer_draw_frame(VulkanRenderer* renderer)
VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT, 0, 0, nullptr, 0, nullptr, 1,
&imageMemoryBarrier);
if (vkEndCommandBuffer(renderer->CommandBuffersInFlight[renderer->CurrentFrameIndex])
!= VK_SUCCESS) {
yolo::error("failed to record command buffer!");

View File

@@ -3,6 +3,7 @@
#include "graphics.hpp"
#include "graphics/device.hpp"
#include "graphics/swapchain.hpp"
#include "graphics/vkrenderer.hpp"
#include "window.hpp"
@@ -52,6 +53,7 @@ inline void imgui_init(graphics::VulkanRenderer* renderer)
init_info.ImageCount = 3;
init_info.MSAASamples = VK_SAMPLE_COUNT_1_BIT;
init_info.UseDynamicRendering = true;
init_info.ColorAttachmentFormat = renderer->Swap->ImageFormat;
ImGui_ImplVulkan_Init(&init_info, VK_NULL_HANDLE);
yolo::info("Initialized ImGUI");