Создание шейдерных стадий
This commit is contained in:
parent
a61e644b80
commit
e20066344b
24
src/vk.cpp
24
src/vk.cpp
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue