Fixed ImGui Pass as well as how exposure pass enables itself
This commit is contained in:
@@ -80,7 +80,7 @@
|
||||
{
|
||||
"Name": "EyeAdaptationPass",
|
||||
"TemplateName": "EyeAdaptationTemplate",
|
||||
"Enabled": false,
|
||||
"Enabled": true,
|
||||
"Connections": [
|
||||
{
|
||||
"LocalSlot": "SceneLuminanceInput",
|
||||
|
||||
-25
@@ -69,7 +69,6 @@ namespace AZ
|
||||
|
||||
if (m_shouldUpdatePassParameters)
|
||||
{
|
||||
UpdateEyeAdaptationPass();
|
||||
UpdateLuminanceHeatmap();
|
||||
|
||||
m_shouldUpdatePassParameters = false;
|
||||
@@ -198,30 +197,6 @@ namespace AZ
|
||||
}
|
||||
}
|
||||
|
||||
void ExposureControlSettings::UpdateEyeAdaptationPass()
|
||||
{
|
||||
auto* passSystem = AZ::RPI::PassSystemInterface::Get();
|
||||
|
||||
// [GFX-TODO][ATOM-13224] Remove UpdateLuminanceHeatmap and UpdateEyeAdaptationPass
|
||||
auto passTemplateName = m_eyeAdaptationPassTemplateNameId;
|
||||
|
||||
if (passSystem->HasPassesForTemplateName(passTemplateName))
|
||||
{
|
||||
const AZStd::vector<RPI::Pass*>& eyeAdaptationPasses = passSystem->GetPassesForTemplateName(passTemplateName);
|
||||
for (RPI::Pass* pass : eyeAdaptationPasses)
|
||||
{
|
||||
auto* eyeAdaptationPass = azrtti_cast<AZ::Render::EyeAdaptationPass*>(pass);
|
||||
auto* renderPipeline = eyeAdaptationPass->GetRenderPipeline();
|
||||
|
||||
if (renderPipeline && renderPipeline->GetScene() == GetParentScene())
|
||||
{
|
||||
// update eye adaptation pass's enable state
|
||||
eyeAdaptationPass->UpdateEnable();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ExposureControlSettings::UpdateLuminanceHeatmap()
|
||||
{
|
||||
auto* passSystem = AZ::RPI::PassSystemInterface::Get();
|
||||
|
||||
-1
@@ -85,7 +85,6 @@ namespace AZ
|
||||
void UpdateExposureControlRelatedPassParameters();
|
||||
|
||||
void UpdateLuminanceHeatmap();
|
||||
void UpdateEyeAdaptationPass();
|
||||
|
||||
PostProcessSettings* m_parentSettings = nullptr;
|
||||
bool m_shouldUpdatePassParameters = true;
|
||||
|
||||
@@ -62,17 +62,24 @@ namespace AZ
|
||||
m_buffer = RPI::BufferSystemInterface::Get()->CreateBufferFromCommonPool(desc);
|
||||
}
|
||||
|
||||
void EyeAdaptationPass::UpdateEnable()
|
||||
void EyeAdaptationPass::BuildAttachmentsInternal()
|
||||
{
|
||||
if (m_pipeline == nullptr)
|
||||
if (!m_buffer)
|
||||
{
|
||||
SetEnabled(false);
|
||||
return;
|
||||
InitBuffer();
|
||||
}
|
||||
|
||||
AZ_Assert(m_pipeline->GetScene(), "Scene shouldn't nullptr");
|
||||
AttachBufferToSlot(EyeAdaptationDataInputOutputSlotName, m_buffer);
|
||||
}
|
||||
|
||||
UpdateInputBufferIndices();
|
||||
bool EyeAdaptationPass::IsEnabled() const
|
||||
{
|
||||
if (!ComputePass::IsEnabled() || m_pipeline == nullptr)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
AZ_Assert(m_pipeline->GetScene(), "EyeAdaptationPass's Pipeline does not have a valid scene pointer");
|
||||
|
||||
AZ::RPI::Scene* scene = GetScene();
|
||||
bool enabled = false;
|
||||
@@ -95,38 +102,9 @@ namespace AZ
|
||||
}
|
||||
}
|
||||
|
||||
const bool lastEnabled = IsEnabled();
|
||||
SetEnabled(enabled);
|
||||
|
||||
if (IsEnabled() && !lastEnabled)
|
||||
{
|
||||
// Need rebuilt this pass's attachment as any connections. So queue parent pass.
|
||||
GetParent()->QueueForBuildAttachments();
|
||||
}
|
||||
return enabled;
|
||||
}
|
||||
|
||||
void EyeAdaptationPass::UpdateInputBufferIndices()
|
||||
{
|
||||
if (m_exposureControlBufferInputIndex.IsNull())
|
||||
{
|
||||
m_exposureControlBufferInputIndex = GetView()->GetShaderResourceGroup()->FindShaderInputBufferIndex(Name("m_exposureControl"));
|
||||
}
|
||||
}
|
||||
|
||||
void EyeAdaptationPass::BuildAttachmentsInternal()
|
||||
{
|
||||
if (m_pipeline == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!m_buffer)
|
||||
{
|
||||
InitBuffer();
|
||||
}
|
||||
|
||||
AttachBufferToSlot(EyeAdaptationDataInputOutputSlotName, m_buffer);
|
||||
}
|
||||
|
||||
void EyeAdaptationPass::FrameBeginInternal(FramePrepareParams params)
|
||||
{
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include <Atom/RHI/DrawItem.h>
|
||||
#include <Atom/RHI/ScopeProducer.h>
|
||||
#include <Atom/RHI.Reflect/ShaderResourceGroupLayoutDescriptor.h>
|
||||
#include <Atom/RHI.Reflect/ShaderInputNameIndex.h>
|
||||
|
||||
#include <Atom/RPI.Public/Pass/ComputePass.h>
|
||||
#include <Atom/RPI.Public/Shader/Shader.h>
|
||||
@@ -45,12 +46,11 @@ namespace AZ
|
||||
static RPI::Ptr<EyeAdaptationPass> Create(const RPI::PassDescriptor& descriptor);
|
||||
|
||||
// Check if we should enable of disable this pass
|
||||
void UpdateEnable();
|
||||
bool IsEnabled() const override;
|
||||
|
||||
protected:
|
||||
EyeAdaptationPass(const RPI::PassDescriptor& descriptor);
|
||||
void InitBuffer();
|
||||
void UpdateInputBufferIndices();
|
||||
|
||||
// A StructuredBuffer for exposure calculation on the GPU.
|
||||
struct ExposureCalculationData
|
||||
@@ -65,7 +65,7 @@ namespace AZ
|
||||
AZ::Data::Instance<RPI::Buffer> m_buffer;
|
||||
|
||||
// SRG binding indices...
|
||||
AZ::RHI::ShaderInputBufferIndex m_exposureControlBufferInputIndex;
|
||||
AZ::RHI::ShaderInputNameIndex m_exposureControlBufferInputIndex = "m_exposureControl";
|
||||
};
|
||||
} // namespace Render
|
||||
} // namespace AZ
|
||||
|
||||
@@ -72,7 +72,7 @@ namespace AZ
|
||||
|
||||
//! Return the View if this pass is associated with a pipeline view via PipelineViewTag.
|
||||
//! It may return nullptr if this pass is independent with any views.
|
||||
ViewPtr GetView();
|
||||
ViewPtr GetView() const;
|
||||
|
||||
protected:
|
||||
explicit RenderPass(const PassDescriptor& descriptor);
|
||||
|
||||
@@ -98,7 +98,7 @@ namespace AZ
|
||||
|
||||
bool Pass::IsEnabled() const
|
||||
{
|
||||
return m_flags.m_enabled && (m_flags.m_parentEnabled || m_parent == nullptr);
|
||||
return m_flags.m_enabled;
|
||||
}
|
||||
|
||||
// --- Error Logging ---
|
||||
|
||||
@@ -342,7 +342,7 @@ namespace AZ
|
||||
}
|
||||
}
|
||||
|
||||
ViewPtr RenderPass::GetView()
|
||||
ViewPtr RenderPass::GetView() const
|
||||
{
|
||||
if (m_flags.m_hasPipelineViewTag && m_pipeline)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user