addressed PR feedback

Signed-off-by: antonmic <56370189+antonmic@users.noreply.github.com>
This commit is contained in:
antonmic
2021-12-16 10:42:53 -08:00
parent 18bb69a5cb
commit 2bc381811d
6 changed files with 21 additions and 6 deletions
@@ -65,8 +65,8 @@
"Path": "Passes/CascadedShadowmaps.pass"
},
{
"Name": "ClearPassTemplate",
"Path": "Passes/Clear.pass"
"Name": "SlowClearPassTemplate",
"Path": "Passes/SlowClear.pass"
},
{
"Name": "FullscreenCopyTemplate",
@@ -4,7 +4,11 @@
"ClassName": "PassAsset",
"ClassData": {
"PassTemplate": {
"Name": "ClearPassTemplate",
// This is for debug purposes and edge cases only
// If you want to clear an attachment you should
// use the LoadStoreAction on your pass slot.
"Name": "SlowClearPassTemplate",
"PassClass": "ClearPass",
"Slots": [
{
@@ -86,7 +86,6 @@ set(FILES
Passes/CascadedShadowmaps.pass
Passes/CheckerboardResolveColor.pass
Passes/CheckerboardResolveDepth.pass
Passes/Clear.pass
Passes/ContrastAdaptiveSharpening.pass
Passes/ConvertToAcescg.pass
Passes/DebugOverlayParent.pass
@@ -201,6 +200,7 @@ set(FILES
Passes/Skinning.pass
Passes/SkyBox.pass
Passes/SkyBox_TwoOutputs.pass
Passes/SlowClear.pass
Passes/SMAA1xApplyLinearHDRColor.pass
Passes/SMAA1xApplyPerceptualColor.pass
Passes/SMAABlendingWeightCalculation.pass
@@ -14,7 +14,9 @@ namespace AZ
{
namespace RPI
{
//! A simple pass to clear a render target
//! Only use this for debug purposes and edge cases
//! The correct and efficient way to clear a pass is through the LoadStoreAction on the pass slot
//! This will clear a given image attachment to the specified clear value.
class ClearPass
: public RenderPass
{
@@ -133,6 +133,15 @@ namespace AZ
void CreatePassesFromTemplate();
// Generates child clear passes to clear input and input/output attachments
// TODO: These two functions are a workaround for a complicated edge case:
// Let Parent Pass P1 have two children, C1 and C2. C1 writes to an attachment that C2 reads,
// but C1 can be disabled, in which case we just want C2 to read the cleared texture.
// Because of this, the attachment is owned by the parent pass, that way it is always available for C2
// to read even when C1 is disabled. However we still want to clear the attachment before C2 reads it.
// We tried overriding the LoadStoreAction to clear on C2's slot when C1 is disabled, but the RHI
// doesn't allow for clears on Input only slots. Changing the slot to InputOutput was in conflict with
// the texture definition in the SRG, and it couldn't be changed to RW because it was an MSAA texture.
// So now we detect clear actions on parent slots and generate a clear pass for them.
void CreateClearPassFromBinding(PassAttachmentBinding& binding, PassRequest& clearRequest);
void CreateClearPassesFromBindings();
};
@@ -247,7 +247,7 @@ namespace AZ
void ParentPass::CreateClearPassesFromBindings()
{
PassRequest clearRequest;
clearRequest.m_templateName = Name("ClearPassTemplate");
clearRequest.m_templateName = Name("SlowClearPassTemplate");
clearRequest.m_passData = AZStd::make_shared<ClearPassData>();
clearRequest.m_connections.push_back();
clearRequest.m_connections[0].m_localSlot = Name("ClearInputOutput");