MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/Falcor / getGSO

Method getGSO

Source/Falcor/Core/State/GraphicsState.cpp:78–118  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

76GraphicsState::~GraphicsState() = default;
77
78ref<GraphicsStateObject> GraphicsState::getGSO(const ProgramVars* pVars)
79{
80 auto pProgramKernels = mpProgram ? mpProgram->getActiveVersion()->getKernels(mpDevice, pVars) : nullptr;
81 bool newProgVersion = pProgramKernels.get() != mCachedData.pProgramKernels;
82 if (newProgVersion)
83 {
84 mCachedData.pProgramKernels = pProgramKernels.get();
85 mpGsoGraph->walk((void*)pProgramKernels.get());
86 }
87
88 const Fbo::Desc* pFboDesc = mpFbo ? &mpFbo->getDesc() : nullptr;
89 if (mCachedData.pFboDesc != pFboDesc)
90 {
91 mpGsoGraph->walk((void*)pFboDesc);
92 mCachedData.pFboDesc = pFboDesc;
93 }
94
95 ref<GraphicsStateObject> pGso = mpGsoGraph->getCurrentNode();
96 if (pGso == nullptr)
97 {
98 mDesc.pProgramKernels = pProgramKernels;
99 mDesc.fboDesc = mpFbo ? mpFbo->getDesc() : Fbo::Desc();
100 mDesc.pVertexLayout = mpVao->getVertexLayout();
101 mDesc.primitiveType = topology2Type(mpVao->getPrimitiveTopology());
102
103 GraphicsStateGraph::CompareFunc cmpFunc = [&desc = mDesc](ref<GraphicsStateObject> pGso) -> bool
104 { return pGso && (desc == pGso->getDesc()); };
105
106 if (mpGsoGraph->scanForMatchingNode(cmpFunc))
107 {
108 pGso = mpGsoGraph->getCurrentNode();
109 }
110 else
111 {
112 pGso = mpDevice->createGraphicsStateObject(mDesc);
113 pGso->breakStrongReferenceToDevice();
114 mpGsoGraph->setCurrentNodeData(pGso);
115 }
116 }
117 return pGso;
118}
119
120GraphicsState& GraphicsState::setFbo(const ref<Fbo>& pFbo, bool setVp0Sc0)
121{

Callers 1

drawCallCommonMethod · 0.80

Calls 9

topology2TypeFunction · 0.85
getKernelsMethod · 0.80
walkMethod · 0.80
scanForMatchingNodeMethod · 0.80
setCurrentNodeDataMethod · 0.80
DescClass · 0.50
getMethod · 0.45

Tested by

no test coverage detected