Pass changes now building and working
This commit is contained in:
@@ -46,6 +46,8 @@ namespace AZ
|
||||
DisplayMapperPass::DisplayMapperPass(const RPI::PassDescriptor& descriptor)
|
||||
: RPI::ParentPass(descriptor)
|
||||
{
|
||||
m_flags.m_alreadyCreated = false;
|
||||
|
||||
AzFramework::NativeWindowHandle windowHandle = nullptr;
|
||||
AzFramework::WindowSystemRequestBus::BroadcastResult(
|
||||
windowHandle,
|
||||
|
||||
@@ -28,6 +28,8 @@ namespace AZ
|
||||
LuxCoreTexturePass::LuxCoreTexturePass(const RPI::PassDescriptor& descriptor)
|
||||
: ParentPass(descriptor)
|
||||
{
|
||||
m_flags.m_alreadyCreated = false;
|
||||
|
||||
RPI::PassSystemInterface* passSystem = RPI::PassSystemInterface::Get();
|
||||
|
||||
// Create render target pass
|
||||
|
||||
@@ -393,6 +393,7 @@ namespace AZ
|
||||
uint64_t m_parentEnabled : 1;
|
||||
|
||||
uint64_t m_initialized : 1;
|
||||
uint64_t m_alreadyCreated : 1;
|
||||
|
||||
uint64_t m_partOfHierarchy : 1;
|
||||
uint64_t m_hasDrawListTag : 1;
|
||||
|
||||
@@ -248,6 +248,12 @@ namespace AZ
|
||||
|
||||
void ParentPass::CreateChildPasses()
|
||||
{
|
||||
if (m_flags.m_alreadyCreated)
|
||||
{
|
||||
return;
|
||||
}
|
||||
m_flags.m_alreadyCreated = true;
|
||||
|
||||
RemoveChildren();
|
||||
CreatePassesFromTemplate();
|
||||
CreateChildPassesInternal();
|
||||
|
||||
@@ -151,6 +151,7 @@ namespace AZ
|
||||
{
|
||||
AZ_RPI_PASS_ASSERT(m_parent != nullptr, "Trying to remove pass from parent but pointer to the parent pass is null.");
|
||||
m_parent->RemoveChild(Ptr<Pass>(this));
|
||||
m_queueState = PassQueueState::NoQueue;
|
||||
}
|
||||
|
||||
void Pass::OnOrphan()
|
||||
@@ -358,7 +359,7 @@ namespace AZ
|
||||
void Pass::QueueForBuild()
|
||||
{
|
||||
// Don't queue if we're in building phase
|
||||
if (PassSystemInterface::Get()->GetState() != PassSystemState::Building &&
|
||||
if (m_state != PassState::Building &&
|
||||
(m_queueState == PassQueueState::NoQueue || m_queueState == PassQueueState::QueuedForInitialization))
|
||||
{
|
||||
PassSystemInterface::Get()->QueueForBuild(this);
|
||||
@@ -374,7 +375,7 @@ namespace AZ
|
||||
void Pass::QueueForInitialization()
|
||||
{
|
||||
// Don't queue if we're in initialization phase
|
||||
if (PassSystemInterface::Get()->GetState() != PassSystemState::Initializing && m_queueState == PassQueueState::NoQueue)
|
||||
if (m_queueState == PassQueueState::NoQueue)
|
||||
{
|
||||
PassSystemInterface::Get()->QueueForInitialization(this);
|
||||
m_queueState = PassQueueState::QueuedForInitialization;
|
||||
@@ -1086,11 +1087,12 @@ namespace AZ
|
||||
|
||||
void Pass::Build()
|
||||
{
|
||||
if (m_queueState != PassQueueState::QueuedForBuild || m_state != PassState::Resetting)
|
||||
if (m_queueState != PassQueueState::QueuedForBuild || (m_state != PassState::Queued && m_state != PassState::Resetting))
|
||||
{
|
||||
return;
|
||||
}
|
||||
m_state = PassState::Building;
|
||||
m_queueState = PassQueueState::NoQueue;
|
||||
|
||||
AZ_RPI_BREAK_ON_TARGET_PASS;
|
||||
|
||||
@@ -1115,7 +1117,6 @@ namespace AZ
|
||||
UpdateAttachmentUsageIndices();
|
||||
|
||||
// Queue for Initialization
|
||||
m_queueState = PassQueueState::NoQueue;
|
||||
QueueForInitialization();
|
||||
}
|
||||
|
||||
@@ -1123,6 +1124,7 @@ namespace AZ
|
||||
{
|
||||
AZ_RPI_BREAK_ON_TARGET_PASS;
|
||||
|
||||
m_flags.m_alreadyCreated = false;
|
||||
m_importedAttachmentStore.clear();
|
||||
OnBuildFinishedInternal();
|
||||
}
|
||||
@@ -1133,6 +1135,7 @@ namespace AZ
|
||||
{
|
||||
return;
|
||||
}
|
||||
m_queueState = PassQueueState::NoQueue;
|
||||
|
||||
m_state = PassState::Initializing;
|
||||
InitializeInternal();
|
||||
|
||||
@@ -242,19 +242,22 @@ namespace AZ
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzRender);
|
||||
AZ_ATOM_PROFILE_FUNCTION("RPI", "PassSystem: BuildPassAttachments");
|
||||
|
||||
if(!m_initializePassList.empty())
|
||||
while (!m_initializePassList.empty())
|
||||
{
|
||||
AZStd::vector< Ptr<Pass> > initListCopy = m_initializePassList;
|
||||
m_initializePassList.clear();
|
||||
|
||||
// Erase passes which were removed from pass tree already (which parent is empty)
|
||||
auto unused = AZStd::remove_if(m_initializePassList.begin(), m_initializePassList.end(),
|
||||
auto unused = AZStd::remove_if(initListCopy.begin(), initListCopy.end(),
|
||||
[](const RHI::Ptr<Pass>& currentPass)
|
||||
{
|
||||
return !currentPass->m_flags.m_partOfHierarchy;
|
||||
});
|
||||
m_initializePassList.erase(unused, m_initializePassList.end());
|
||||
initListCopy.erase(unused, initListCopy.end());
|
||||
|
||||
SortPassListAscending(m_initializePassList);
|
||||
SortPassListAscending(initListCopy);
|
||||
|
||||
for (const Ptr<Pass>& pass : m_initializePassList)
|
||||
for (const Ptr<Pass>& pass : initListCopy)
|
||||
{
|
||||
pass->Initialize();
|
||||
}
|
||||
|
||||
@@ -37,6 +37,8 @@ namespace AZ
|
||||
EnvironmentCubeMapPass::EnvironmentCubeMapPass(const PassDescriptor& passDescriptor)
|
||||
: ParentPass(passDescriptor)
|
||||
{
|
||||
m_flags.m_alreadyCreated = false;
|
||||
|
||||
// load pass data
|
||||
const EnvironmentCubeMapPassData* passData = PassUtils::GetPassData<EnvironmentCubeMapPassData>(passDescriptor);
|
||||
if (passData == nullptr)
|
||||
|
||||
@@ -26,6 +26,8 @@ namespace AZ
|
||||
, m_windowContext(windowContext)
|
||||
, m_childTemplateName(childTemplateName)
|
||||
{
|
||||
m_flags.m_alreadyCreated = false;
|
||||
|
||||
PassSystemInterface* passSystem = PassSystemInterface::Get();
|
||||
|
||||
// Create child pass
|
||||
|
||||
Reference in New Issue
Block a user