Skip to content

Commit

Permalink
feat: add missing reset
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Pollind <[email protected]>
  • Loading branch information
pollend committed Jan 9, 2024
1 parent ebdf3cd commit 38b9147
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion HPL2/include/graphics/ForgeRenderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ namespace hpl {
Semaphore* m_renderCompleteSemaphore = nullptr;
CommandResourcePool* m_resourcePool = nullptr;
RenderTarget* m_finalRenderTarget = nullptr;

std::vector<Semaphore*> m_waitSemaphores = {};

template<typename T>
inline void pushResource(const T& ele) {
Expand Down
9 changes: 6 additions & 3 deletions HPL2/sources/graphics/ForgeRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,13 @@ namespace hpl {
flushResourceUpdates(&flushUpdateDesc);
endCmd(m_frame.cmd());

std::array waitSemaphores = {flushUpdateDesc.pOutSubmittedSemaphore, m_imageAcquiredSemaphore};
m_frame.m_waitSemaphores.push_back(flushUpdateDesc.pOutSubmittedSemaphore);
m_frame.m_waitSemaphores.push_back(m_imageAcquiredSemaphore);


QueueSubmitDesc submitDesc = {};
submitDesc.mWaitSemaphoreCount = waitSemaphores.size();
submitDesc.ppWaitSemaphores = waitSemaphores.data();
submitDesc.mWaitSemaphoreCount = m_frame.m_waitSemaphores.size();
submitDesc.ppWaitSemaphores = m_frame.m_waitSemaphores.data();
submitDesc.mCmdCount = 1;
submitDesc.ppCmds = m_frame.RingElement().pCmds;
submitDesc.mSignalSemaphoreCount = 1;
Expand All @@ -116,6 +118,7 @@ namespace hpl {
presentDesc.mSubmitDone = true;
queuePresent(m_graphicsQueue, &presentDesc);

m_frame.m_waitSemaphores.clear();
m_frame.m_isFinished = true;
}

Expand Down
5 changes: 3 additions & 2 deletions HPL2/sources/graphics/RendererDeferred.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2450,9 +2450,8 @@ namespace hpl {
if (fenceStatus == FENCE_STATUS_INCOMPLETE) {
waitForFences(forgeRenderer->Rend(), 1, &ringShadowElement.pFence);
}

resetCmdPool(forgeRenderer->Rend(), ringShadowElement.pCmdPool);
beginCmd(shadowCmd);

{
cmdBindRenderTargets(shadowCmd, 0, NULL, NULL, NULL, NULL, NULL, -1, -1);
std::array rtBarriers = {
Expand Down Expand Up @@ -2531,6 +2530,8 @@ namespace hpl {
flushResourceUpdates(&flushUpdateDesc);
std::array waitSemaphores = {flushUpdateDesc.pOutSubmittedSemaphore};


frame.m_waitSemaphores.push_back(ringShadowElement.pSemaphore);
QueueSubmitDesc submitDesc = {};
submitDesc.mCmdCount = 1;
submitDesc.mWaitSemaphoreCount = waitSemaphores.size();
Expand Down

0 comments on commit 38b9147

Please sign in to comment.