Создание шейдерных стадий

This commit is contained in:
parent a61e644b80
commit e20066344b
1 changed files with 24 additions and 0 deletions

View File

@ -670,4 +670,28 @@ void Vulkan::createGraphicPipeline()
throw std::runtime_error("Unable to create pipeline layout"); throw std::runtime_error("Unable to create pipeline layout");
} }
// Создание шейдеров
VkShaderModule vertShaderModule = createShaderModule("shaders/vert.spv");
VkShaderModule fragShaderModule = createShaderModule("shaders/frag.spv");
VkPipelineShaderStageCreateInfo vertShaderStageInfo{};
vertShaderStageInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO;
vertShaderStageInfo.stage = VK_SHADER_STAGE_VERTEX_BIT;
vertShaderStageInfo.module = vertShaderModule;
vertShaderStageInfo.pName = "main";
VkPipelineShaderStageCreateInfo fragShaderStageInfo{};
fragShaderStageInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO;
fragShaderStageInfo.stage = VK_SHADER_STAGE_FRAGMENT_BIT;
fragShaderStageInfo.module = fragShaderModule;
fragShaderStageInfo.pName = "main";
// Шейдерные стадии
VkPipelineShaderStageCreateInfo shaderStages[] = {vertShaderStageInfo, fragShaderStageInfo};
// Тут создание графического конвейера
// Удаление шейдерных модулей
vkDestroyShaderModule(logicalDevice, fragShaderModule, nullptr);
vkDestroyShaderModule(logicalDevice, vertShaderModule, nullptr);
} }