54 VkPipelineShaderStageCreateInfo *ssCreateInfos = (VkPipelineShaderStageCreateInfo *)malloc(shaderCount *
sizeof(VkPipelineShaderStageCreateInfo));
55 for (
int i = 0;
i < shaderCount;
i++)
60 VkPipelineInputAssemblyStateCreateInfo iaCreateInfo = {
61 .sType = VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO,
65 .primitiveRestartEnable = VK_FALSE
68 VkViewport viewport = {
83 VkPipelineViewportStateCreateInfo vpCreateInfo = {
84 .sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO,
88 .pViewports = &viewport,
93 VkPipelineRasterizationStateCreateInfo rCreateInfo = {
94 .sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO,
97 .depthClampEnable = VK_FALSE,
98 .rasterizerDiscardEnable = VK_FALSE,
99 .polygonMode = pipeline->
mode,
101 .frontFace = VK_FRONT_FACE_CLOCKWISE,
102 .depthBiasEnable = VK_FALSE,
103 .depthBiasConstantFactor = 0.f,
104 .depthBiasClamp = 0.f,
105 .depthBiasSlopeFactor = 0.f,
109 VkPipelineMultisampleStateCreateInfo msCreateInfo = {
110 .sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO,
117 .alphaToCoverageEnable = VK_FALSE,
118 .alphaToOneEnable = VK_FALSE
121 VkPipelineDepthStencilStateCreateInfo dCreateInfo = {
122 .sType = VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO,
127 .depthCompareOp = VK_COMPARE_OP_LESS,
128 .depthBoundsTestEnable = VK_FALSE,
129 .stencilTestEnable = VK_FALSE,
130 .front = { VK_STENCIL_OP_KEEP, VK_STENCIL_OP_KEEP, VK_STENCIL_OP_KEEP, VK_COMPARE_OP_NEVER, 0, 0, 0 },
131 .back = { VK_STENCIL_OP_KEEP, VK_STENCIL_OP_KEEP, VK_STENCIL_OP_KEEP, VK_COMPARE_OP_NEVER, 0, 0, 0 },
132 .minDepthBounds = 0.f,
133 .maxDepthBounds = 1.f
136 VkPipelineColorBlendStateCreateInfo cbsCreateInfo = {
137 .sType = VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO,
140 .logicOpEnable = VK_FALSE,
141 .logicOp = VK_LOGIC_OP_COPY,
142 .attachmentCount = 1,
144 .blendConstants[0] = 0.f,
145 .blendConstants[1] = 0.f,
146 .blendConstants[2] = 0.f,
147 .blendConstants[3] = 0.f
150 VkDynamicState dynamicStates[] = { VK_DYNAMIC_STATE_VIEWPORT, VK_DYNAMIC_STATE_SCISSOR };
151 VkPipelineDynamicStateCreateInfo dsCreateInfo = {
152 .sType = VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO,
155 .dynamicStateCount = 2,
156 .pDynamicStates = dynamicStates
159 VkPipelineLayoutCreateInfo plCreateInfo = {
160 .sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO,
163 .setLayoutCount = descLayoutCount,
164 .pSetLayouts = descriptorLayout,
165 .pushConstantRangeCount = pcRange ? 1 : 0,
166 .pPushConstantRanges = pcRange
172 VkGraphicsPipelineCreateInfo pCreateInfo = {
173 .sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO,
175 .flags = pipeline->
flags,
176 .stageCount = shaderCount,
177 .pStages = ssCreateInfos,
178 .pVertexInputState = vertexInputInfo,
179 .pInputAssemblyState = &iaCreateInfo,
180 .pTessellationState =
NULL,
181 .pViewportState = &vpCreateInfo,
182 .pRasterizationState = &rCreateInfo,
183 .pMultisampleState = &msCreateInfo,
184 .pDepthStencilState = &dCreateInfo,
185 .pColorBlendState = &cbsCreateInfo,
186 .pDynamicState = &dsCreateInfo,
187 .layout = pipeline->
layout,
188 .renderPass = renderpass->
rp,
190 .basePipelineHandle = VK_NULL_HANDLE,
191 .basePipelineIndex = -1