5 VkPushConstantRange pushConstantRange{};
6 pushConstantRange.stageFlags = VK_SHADER_STAGE_VERTEX_BIT | VK_SHADER_STAGE_FRAGMENT_BIT;
7 pushConstantRange.offset = 0;
8 pushConstantRange.size = pushConstantSize;
14 VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER,
15 VK_SHADER_STAGE_VERTEX_BIT | VK_SHADER_STAGE_FRAGMENT_BIT)
16 .
addBinding(1, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, VK_SHADER_STAGE_FRAGMENT_BIT)
19 const std::vector<VkDescriptorSetLayout> descriptorSetLayouts{
23 VkPipelineLayoutCreateInfo pipelineLayoutInfo{};
24 pipelineLayoutInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO;
25 pipelineLayoutInfo.setLayoutCount =
static_cast<uint32_t
>(descriptorSetLayouts.size());
26 pipelineLayoutInfo.pSetLayouts = descriptorSetLayouts.data();
27 pipelineLayoutInfo.pushConstantRangeCount = 1;
28 pipelineLayoutInfo.pPushConstantRanges = &pushConstantRange;
31 throw std::runtime_error(
"Failed to create pipeline layout");
37 assert(m_pipelineLayout &&
"Cannot create pipeline before pipeline layout");
41 pipelineConfig.attributeDescriptions.clear();
42 pipelineConfig.bindingDescriptions.clear();
44 pipelineConfig.renderPass = renderPass;
45 pipelineConfig.pipelineLayout = m_pipelineLayout;
46 m_shaders = std::make_unique<Shaders>(m_device, shadersVertPath, shadersFragPath, pipelineConfig);