Fix RHI/Subpass sample for Vulkan. The issue was that we were exectui… (#4904)
* Fix RHI/Subpass sample for Vulkan. The issue was that we were exectuing the sub-pass groups more than once when parallel encoding was used. Signed-off-by: moudgils <moudgils@amazon.com> * Added a minor comment Signed-off-by: moudgils <moudgils@amazon.com> * Minor perf improvement Signed-off-by: moudgils <moudgils@amazon.com>
This commit is contained in:
@@ -27,6 +27,7 @@ namespace AZ
|
||||
{
|
||||
EndInternal();
|
||||
m_device->GetCommandQueueContext().GetCommandQueue(m_hardwareQueueClass).ExecuteWork(AZStd::move(m_workRequest));
|
||||
m_isExecuted = true;
|
||||
}
|
||||
|
||||
bool FrameGraphExecuteGroupHandlerBase::IsComplete() const
|
||||
@@ -42,6 +43,11 @@ namespace AZ
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FrameGraphExecuteGroupHandlerBase::IsExecuted() const
|
||||
{
|
||||
return m_isExecuted;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
void InsertWorkRequestElements(T& destination, const T& source)
|
||||
{
|
||||
|
||||
@@ -41,6 +41,7 @@ namespace AZ
|
||||
void End();
|
||||
|
||||
bool IsComplete() const;
|
||||
bool IsExecuted() const;
|
||||
|
||||
protected:
|
||||
virtual RHI::ResultCode InitInternal(Device& device, const AZStd::vector<RHI::FrameGraphExecuteGroup*>& executeGroups) = 0;
|
||||
@@ -52,6 +53,7 @@ namespace AZ
|
||||
ExecuteWorkRequest m_workRequest;
|
||||
RHI::HardwareQueueClass m_hardwareQueueClass = RHI::HardwareQueueClass::Graphics;
|
||||
AZStd::vector<RHI::FrameGraphExecuteGroup*> m_executeGroups;
|
||||
bool m_isExecuted = false;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -177,8 +177,8 @@ namespace AZ
|
||||
auto findIter = m_groupHandlers.find(group.GetGroupId());
|
||||
AZ_Assert(findIter != m_groupHandlers.end(), "Could not find group handler for groupId %d", group.GetGroupId().GetIndex());
|
||||
FrameGraphExecuteGroupHandlerBase* handler = findIter->second.get();
|
||||
// Wait until all execute groups of the handler has finished.
|
||||
if (handler->IsComplete())
|
||||
// Wait until all execute groups of the handler has finished and also make sure that the handler itself hasn't executed already (which is possible for parallel encoding).
|
||||
if (!handler->IsExecuted() && handler->IsComplete())
|
||||
{
|
||||
// This will execute the recorded work into the queue.
|
||||
handler->End();
|
||||
|
||||
Reference in New Issue
Block a user