本文整理汇总了C++中VkLayerDispatchTable::CreateGraphicsPipelines方法的典型用法代码示例。如果您正苦于以下问题:C++ VkLayerDispatchTable::CreateGraphicsPipelines方法的具体用法?C++ VkLayerDispatchTable::CreateGraphicsPipelines怎么用?C++ VkLayerDispatchTable::CreateGraphicsPipelines使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VkLayerDispatchTable
的用法示例。
在下文中一共展示了VkLayerDispatchTable::CreateGraphicsPipelines方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: vkCreateSwapchainKHR
//.........这里部分代码省略.........
memset(&piasci, 0, sizeof(piasci));
piasci.sType = VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO;
piasci.topology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST;
VkViewport viewport;
memset(&viewport, 0, sizeof(viewport));
viewport.width = (float)data->width;
viewport.height = (float)data->height;
viewport.minDepth = 0.0f;
viewport.maxDepth = 1.0f;
VkRect2D scissor;
memset(&scissor, 0, sizeof(scissor));
scissor.extent.width = data->width;
scissor.extent.height = data->height;
VkPipelineViewportStateCreateInfo pvsci;
memset(&pvsci, 0, sizeof(pvsci));
pvsci.sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO;
pvsci.viewportCount = 1;
pvsci.pViewports = &viewport;
pvsci.scissorCount = 1;
pvsci.pScissors = &scissor;
VkPipelineRasterizationStateCreateInfo prsci;
memset(&prsci, 0, sizeof(prsci));
prsci.sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO;
prsci.polygonMode = VK_POLYGON_MODE_FILL;
prsci.cullMode = VK_CULL_MODE_NONE;
prsci.lineWidth = 1.0f;
VkPipelineMultisampleStateCreateInfo pmsci;
memset(&pmsci, 0, sizeof(pmsci));
pmsci.sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO;
pmsci.rasterizationSamples = VK_SAMPLE_COUNT_1_BIT;
VkPipelineDepthStencilStateCreateInfo pdssci;
memset(&pdssci, 0, sizeof(pdssci));
pdssci.sType = VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO;
pdssci.minDepthBounds = 0.0f;
pdssci.maxDepthBounds = 1.0f;
VkPipelineColorBlendAttachmentState pcbas;
memset(&pcbas, 0, sizeof(pcbas));
pcbas.colorWriteMask =
VK_COLOR_COMPONENT_R_BIT | VK_COLOR_COMPONENT_G_BIT | VK_COLOR_COMPONENT_B_BIT | VK_COLOR_COMPONENT_A_BIT;
VkPipelineColorBlendStateCreateInfo pcbsci;
memset(&pcbsci, 0, sizeof(pcbsci));
pcbsci.sType = VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO;
pcbsci.attachmentCount = 1;
pcbsci.pAttachments = &pcbas;
pcbsci.blendConstants[0] = 1.0f;
pcbsci.blendConstants[1] = 1.0f;
pcbsci.blendConstants[2] = 1.0f;
pcbsci.blendConstants[3] = 1.0f;
VkVertexInputBindingDescription bindings[] = {
{0, sizeof(vertex), VK_VERTEX_INPUT_RATE_VERTEX},
};
VkVertexInputAttributeDescription attribs[] = {
{0, 0, VK_FORMAT_R32G32_SFLOAT, offsetof(vertex, x)}, {1, 0, VK_FORMAT_R32G32_SFLOAT, offsetof(vertex, u)},
};
VkPipelineVertexInputStateCreateInfo pvisci;
memset(&pvisci, 0, sizeof(pvisci));
pvisci.sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO;
pvisci.vertexBindingDescriptionCount = sizeof(bindings) / sizeof(*bindings);
pvisci.pVertexBindingDescriptions = &bindings[0];
pvisci.vertexAttributeDescriptionCount = sizeof(attribs) / sizeof(*attribs);
pvisci.pVertexAttributeDescriptions = &attribs[0];
VkGraphicsPipelineCreateInfo gpci;
gpci.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO;
gpci.pNext = nullptr;
gpci.stageCount = sizeof(stages) / sizeof(*stages);
gpci.pStages = &stages[0];
gpci.pVertexInputState = &pvisci;
gpci.pInputAssemblyState = &piasci;
gpci.pTessellationState = nullptr;
gpci.pViewportState = &pvsci;
gpci.pRasterizationState = &prsci;
gpci.pMultisampleState = &pmsci;
gpci.pDepthStencilState = &pdssci;
gpci.pColorBlendState = &pcbsci;
gpci.pDynamicState = nullptr;
gpci.flags = 0;
gpci.layout = my_data->pl;
gpci.renderPass = data->render_pass;
gpci.subpass = 0;
gpci.basePipelineHandle = VK_NULL_HANDLE;
gpci.basePipelineIndex = 0;
pTable->CreateGraphicsPipelines(device, VK_NULL_HANDLE, 1, &gpci, nullptr, &data->pipeline);
}
return result;
}