MCPcopy Create free account
hub / github.com/comaps/comaps / GetPipeline

Method GetPipeline

libs/drape/vulkan/vulkan_pipeline.cpp:279–462  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

277}
278
279VkPipeline VulkanPipeline::GetPipeline(VkDevice device, PipelineKey const & key)
280{
281 CHECK(key.m_renderPass != VK_NULL_HANDLE, ());
282
283 auto const it = m_pipelineCache.find(key);
284 if (it != m_pipelineCache.end())
285 return it->second;
286
287 // Primitives.
288 VkPipelineInputAssemblyStateCreateInfo inputAssemblyStateCreateInfo = {};
289 inputAssemblyStateCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO;
290 inputAssemblyStateCreateInfo.topology = key.m_primitiveTopology;
291
292 // Rasterization.
293 VkPipelineRasterizationStateCreateInfo rasterizationStateCreateInfo = {};
294 rasterizationStateCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO;
295 rasterizationStateCreateInfo.polygonMode = VK_POLYGON_MODE_FILL;
296 rasterizationStateCreateInfo.cullMode = key.m_cullingEnabled ? VK_CULL_MODE_BACK_BIT : VK_CULL_MODE_NONE;
297 rasterizationStateCreateInfo.frontFace = VK_FRONT_FACE_CLOCKWISE;
298 rasterizationStateCreateInfo.lineWidth = 1.0f;
299
300 // Blending.
301 VkPipelineColorBlendAttachmentState pipelineColorBlendAttachmentState = {};
302 pipelineColorBlendAttachmentState.colorWriteMask =
303 VK_COLOR_COMPONENT_R_BIT | VK_COLOR_COMPONENT_G_BIT | VK_COLOR_COMPONENT_B_BIT | VK_COLOR_COMPONENT_A_BIT;
304 pipelineColorBlendAttachmentState.blendEnable = key.m_blendingEnabled ? VK_TRUE : VK_FALSE;
305 if (key.m_blendingEnabled)
306 {
307 pipelineColorBlendAttachmentState.colorBlendOp = VK_BLEND_OP_ADD;
308 pipelineColorBlendAttachmentState.alphaBlendOp = VK_BLEND_OP_ADD;
309 pipelineColorBlendAttachmentState.srcColorBlendFactor = VK_BLEND_FACTOR_SRC_ALPHA;
310 pipelineColorBlendAttachmentState.srcAlphaBlendFactor = VK_BLEND_FACTOR_SRC_ALPHA;
311 pipelineColorBlendAttachmentState.dstColorBlendFactor = VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA;
312 pipelineColorBlendAttachmentState.dstAlphaBlendFactor = VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA;
313 }
314 VkPipelineColorBlendStateCreateInfo colorBlendStateCreateInfo = {};
315 colorBlendStateCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO;
316 colorBlendStateCreateInfo.attachmentCount = 1;
317 colorBlendStateCreateInfo.pAttachments = &pipelineColorBlendAttachmentState;
318
319 // Viewport.
320 VkPipelineViewportStateCreateInfo viewportStateCreateInfo = {};
321 viewportStateCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO;
322 viewportStateCreateInfo.viewportCount = 1;
323 viewportStateCreateInfo.scissorCount = 1;
324
325 // Multisampling.
326 VkPipelineMultisampleStateCreateInfo multisampleStateCreateInfo = {};
327 multisampleStateCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO;
328 multisampleStateCreateInfo.rasterizationSamples = VK_SAMPLE_COUNT_1_BIT;
329
330 // Dynamic.
331 static std::array<VkDynamicState, 4> dynamicState = {VK_DYNAMIC_STATE_VIEWPORT, VK_DYNAMIC_STATE_SCISSOR,
332 VK_DYNAMIC_STATE_LINE_WIDTH, VK_DYNAMIC_STATE_STENCIL_REFERENCE};
333 VkPipelineDynamicStateCreateInfo dynamicStateCreateInfo = {};
334 dynamicStateCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO;
335 dynamicStateCreateInfo.pDynamicStates = dynamicState.data();
336 dynamicStateCreateInfo.dynamicStateCount = static_cast<uint32_t>(dynamicState.size());

Callers 1

GetCurrentPipelineMethod · 0.80

Calls 14

GetAttributeFormatFunction · 0.85
GetStateByteFunction · 0.85
GetPipelineLayoutMethod · 0.80
GetShadersMethod · 0.80
ForbidVulkanMethod · 0.80
DecodeTestFunctionFunction · 0.70
DecodeStencilActionFunction · 0.70
findMethod · 0.45
endMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45
GetElementSizeMethod · 0.45

Tested by

no test coverage detected