| 30 | } |
| 31 | |
| 32 | void SimpleRenderSystem::createPipelineLayout(VkDescriptorSetLayout globalSetLayout) { |
| 33 | VkPushConstantRange pushConstantRange{}; |
| 34 | pushConstantRange.stageFlags = VK_SHADER_STAGE_VERTEX_BIT | VK_SHADER_STAGE_FRAGMENT_BIT; |
| 35 | pushConstantRange.offset = 0; |
| 36 | pushConstantRange.size = sizeof(SimplePushConstantData); |
| 37 | |
| 38 | std::vector<VkDescriptorSetLayout> descriptorSetLayouts{globalSetLayout}; |
| 39 | |
| 40 | VkPipelineLayoutCreateInfo pipelineLayoutInfo{}; |
| 41 | pipelineLayoutInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO; |
| 42 | pipelineLayoutInfo.setLayoutCount = static_cast<uint32_t>(descriptorSetLayouts.size()); |
| 43 | pipelineLayoutInfo.pSetLayouts = descriptorSetLayouts.data(); |
| 44 | pipelineLayoutInfo.pushConstantRangeCount = 1; |
| 45 | pipelineLayoutInfo.pPushConstantRanges = &pushConstantRange; |
| 46 | if (vkCreatePipelineLayout(lveDevice.device(), &pipelineLayoutInfo, nullptr, &pipelineLayout) != |
| 47 | VK_SUCCESS) { |
| 48 | throw std::runtime_error("failed to create pipeline layout!"); |
| 49 | } |
| 50 | } |
| 51 | |
| 52 | void SimpleRenderSystem::createPipeline(VkRenderPass renderPass) { |
| 53 | assert(pipelineLayout != nullptr && "Cannot create pipeline before pipeline layout"); |