MCPcopy Create free account
hub / github.com/DiligentGraphics/DiligentFX / CreatePSO

Method CreatePSO

PBR/src/PBR_Renderer.cpp:1533–1767  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1531)";
1532
1533void PBR_Renderer::CreatePSO(PsoHashMapType& PsoHashMap,
1534 const GraphicsPipelineDesc& GraphicsDesc,
1535 const PSOKey& Key,
1536 bool AsyncCompile)
1537{
1538 GraphicsPipelineStateCreateInfo PSOCreateInfo;
1539 PipelineStateDesc& PSODesc = PSOCreateInfo.PSODesc;
1540 GraphicsPipelineDesc& GraphicsPipeline = PSOCreateInfo.GraphicsPipeline;
1541
1542 if (AsyncCompile)
1543 PSOCreateInfo.Flags |= PSO_CREATE_FLAG_ASYNCHRONOUS;
1544
1545 const PSO_FLAGS PSOFlags = Key.GetFlags();
1546 const bool IsUnshaded = (PSOFlags & PSO_FLAG_UNSHADED) != 0;
1547
1548#ifdef DILIGENT_DEVELOPMENT
1549 {
1550 std::stringstream msg_ss;
1551 msg_ss << "PBR Renderer: creating PSO with flags: " << GetPSOFlagsString(PSOFlags)
1552 << ": cull: " << GetCullModeLiteralName(Key.GetCullMode())
1553 << "; alpha: " << GetAlphaModeString(Key.GetAlphaMode());
1554 if (Key.GetDebugView() != DebugViewType::None)
1555 {
1556 msg_ss << "; debug view: " << static_cast<int>(Key.GetDebugView());
1557 }
1558 if (Key.GetLoadingAnimation() != LoadingAnimationMode::None)
1559 {
1560 msg_ss << "; loading animation: " << static_cast<int>(Key.GetLoadingAnimation());
1561 }
1562 if (Key.GetUserValue() != 0)
1563 {
1564 msg_ss << "; user value: " << Key.GetUserValue();
1565 }
1566 LOG_INFO_MESSAGE(msg_ss.str());
1567 }
1568#endif
1569
1570 InputLayoutDescX InputLayout;
1571 std::string VSInputStruct;
1572 GetVSInputStructAndLayout(PSOFlags, VSInputStruct, InputLayout);
1573
1574 const bool UseVkPointSize =
1575 GraphicsDesc.PrimitiveTopology == PRIMITIVE_TOPOLOGY_POINT_LIST &&
1576 m_Device.GetDeviceInfo().IsVulkanDevice() &&
1577 m_Settings.PrimitiveArraySize == 0; // When PrimitiveArraySize > 0, we convert HLSL to GLSL
1578 const auto VSOutputStruct = GetVSOutputStruct(PSOFlags, UseVkPointSize, m_Settings.PrimitiveArraySize > 0);
1579
1580 CreateInfo::PSMainSourceInfo PSMainSource;
1581 if (m_Settings.GetPSMainSource)
1582 {
1583 PSMainSource = m_Settings.GetPSMainSource(PSOFlags);
1584 }
1585 else
1586 {
1587 PSMainSource.OutputStruct = GetPSOutputStruct(PSOFlags);
1588 PSMainSource.Footer = DefaultPSMainFooter;
1589 }
1590

Callers

nothing calls this directly

Calls 7

GetFlagsMethod · 0.80
GetAlphaModeMethod · 0.80
GetLoadingAnimationMethod · 0.80
GetUserValueMethod · 0.80
CreateShaderMethod · 0.80
GetCullModeMethod · 0.45
GetDebugViewMethod · 0.45

Tested by

no test coverage detected