Open hzqst opened 8 months ago
void CDiligentBaseRenderPass::BeginPass() override
{
m_iCurrentSubpassIndex = 0;
for(int i = 0;i < DILIGENT_MAX_SUBPASSES; ++i)
m_CommandLists[i].clear();
}
void CDiligentBaseRenderPass::EndPass() override
{
auto pCommand = new CDiligentDrawRenderPassCommand(this, m_CommandLists);
DiligentRenderer()->AddToCommandList(pCommand);
}
void CDiligentBaseRenderPass::AddToCommandList(IDiligentCommand* pCommand) override
{
m_CommandLists[m_iCurrentSubpassIndex].emplace_back(pCommand);
}
void CDiligentDrawRenderPassCommand::Commit(RESOURCE_STATE_TRANSITION_MODE ResourceTransitionMode)
{
auto pImmediateContext = DiligentRenderer()->GetImmediateContext();
if(m_bNeedRestoreRenderTargets){
//TODO
}
for(auto desc : m_UsedResources){
pImmediateContext->TransitionResourceState(desc.Resource, Diligent::RESOURCE_STATE_UNKNOWN, desc.NewResourceState, desc.StateTransitionFlags);
/*
class CDiligentResourceTransitionDesc
{
public:
RefCntAutoPtr<IDeviceObject> Resource;
RESOURCE_STATE NewResourceState { RESOURCE_STATE_UNKNOWN };
STATE_TRANSITION_FLAGS StateTransitionFlags{ STATE_TRANSITION_FLAG_NONE };
};
*/
}
pImmediateContext->BeginRenderPass(RPBeginInfo);
int i = 0;
while(1)
{
for(auto pCommand : m_CommandList[i]){
pCommand->Commit(Diligent::RESOURCE_STATE_TRANSITION_MODE_VERIFY);
pCommand ->Destroy();
}
if(i< m_iSubpassCount)
pImmediateContext->NextSubpass();
else
break;
}
pImmediateContext->EndRenderPass();
if(m_bNeedRestoreRenderTargets){
//TODO
}
}
qglClearColor( 0, 0, 0, 0 ); qglClear( GL_COLOR_BUFFER_BIT );