MCPcopy Create free account
hub / github.com/TheRealMJP/DeferredTexturing / CreatePSOs

Method CreatePSOs

BindlessDeferred/BindlessDeferred.cpp:639–768  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

637}
638
639void BindlessDeferred::CreatePSOs()
640{
641 DXGI_FORMAT gBufferFormats[] = { tangentFrameTarget.Format(), uvTarget.Format(), materialIDTarget.Format(), uvGradientsTarget.Format() };
642 uint64 numGBuffers = AppSettings::ComputeUVGradients ? ArraySize_(gBufferFormats) - 1 : ArraySize_(gBufferFormats);
643 meshRenderer.CreatePSOs(mainTarget.Texture.Format, depthBuffer.DSVFormat, gBufferFormats, numGBuffers, mainTarget.MSAASamples);
644 skybox.CreatePSOs(mainTarget.Texture.Format, mainTarget.MSAASamples);
645 postProcessor.CreatePSOs();
646
647 {
648 // Clustering PSO
649 D3D12_GRAPHICS_PIPELINE_STATE_DESC psoDesc = {};
650 psoDesc.pRootSignature = clusterRS;
651 psoDesc.BlendState = DX12::GetBlendState(BlendState::Disabled);
652 psoDesc.DepthStencilState = DX12::GetDepthState(DepthState::Disabled);
653 psoDesc.SampleMask = UINT_MAX;
654 psoDesc.PrimitiveTopologyType = D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE;
655 psoDesc.NumRenderTargets = 0;
656 psoDesc.VS = clusterVS.ByteCode();
657
658 ClusterRasterizationModes rastMode = AppSettings::ClusterRasterizationMode;
659 if(rastMode == ClusterRasterizationModes::MSAA4x || rastMode == ClusterRasterizationModes::MSAA8x)
660 {
661 psoDesc.SampleDesc.Count = clusterMSAATarget.MSAASamples;
662 psoDesc.SampleDesc.Quality = DX12::StandardMSAAPattern;
663 psoDesc.NumRenderTargets = 1;
664 psoDesc.RTVFormats[0] = clusterMSAATarget.Format();
665 }
666 else
667 psoDesc.SampleDesc.Count = 1;
668
669 D3D12_CONSERVATIVE_RASTERIZATION_MODE crMode = D3D12_CONSERVATIVE_RASTERIZATION_MODE_OFF;
670 if(rastMode == ClusterRasterizationModes::Conservative)
671 crMode = D3D12_CONSERVATIVE_RASTERIZATION_MODE_ON;
672
673 psoDesc.PS = clusterFrontFacePS.ByteCode();
674 psoDesc.RasterizerState = DX12::GetRasterizerState(RasterizerState::BackFaceCull);
675 psoDesc.RasterizerState.ConservativeRaster = crMode;
676 DXCall(DX12::Device->CreateGraphicsPipelineState(&psoDesc, IID_PPV_ARGS(&clusterFrontFacePSO)));
677
678 psoDesc.PS = clusterBackFacePS.ByteCode();
679 psoDesc.RasterizerState = DX12::GetRasterizerState(RasterizerState::FrontFaceCull);
680 psoDesc.RasterizerState.ConservativeRaster = crMode;
681 DXCall(DX12::Device->CreateGraphicsPipelineState(&psoDesc, IID_PPV_ARGS(&clusterBackFacePSO)));
682
683 psoDesc.PS = clusterIntersectingPS.ByteCode();
684 psoDesc.RasterizerState = DX12::GetRasterizerState(RasterizerState::FrontFaceCull);
685 psoDesc.RasterizerState.ConservativeRaster = crMode;
686 DXCall(DX12::Device->CreateGraphicsPipelineState(&psoDesc, IID_PPV_ARGS(&clusterIntersectingPSO)));
687 }
688
689 const bool msaaEnabled = AppSettings::MSAAMode != MSAAModes::MSAANone;
690 const uint64 msaaModeIdx = uint64(AppSettings::MSAAMode);
691
692 if(msaaEnabled)
693 {
694 // MSAA mask PSO's
695 D3D12_COMPUTE_PIPELINE_STATE_DESC psoDesc = { };
696 psoDesc.CS = msaaMaskCS[uint64(AppSettings::MSAAMode)][0].ByteCode();

Callers

nothing calls this directly

Calls 6

GetBlendStateFunction · 0.85
GetDepthStateFunction · 0.85
GetRasterizerStateFunction · 0.85
DXCallFunction · 0.85
ByteCodeMethod · 0.80
FormatMethod · 0.45

Tested by

no test coverage detected