Added a new MSAAResolveFullScreenPass which will disable itself in non-MSAA pipelines.

Changed MSAAResolvePass to disable itself in non-MSAA pipelines.
This commit is contained in:
Doug McDiarmid
2021-06-21 02:45:59 -07:00
parent 4730102898
commit 5137a8aec5
8 changed files with 105 additions and 2 deletions
@@ -5,7 +5,7 @@
"ClassData": {
"PassTemplate": {
"Name": "MSAAResolveCustomTemplate",
"PassClass": "FullScreenTriangle",
"PassClass": "MSAAResolveFullScreenPass",
"Slots": [
{
"Name": "Input",
@@ -5,7 +5,7 @@
"ClassData": {
"PassTemplate": {
"Name": "MSAAResolveDepthTemplate",
"PassClass": "FullScreenTriangle",
"PassClass": "MSAAResolveFullScreenPass",
"Slots": [
{
"Name": "Input",
@@ -42,6 +42,7 @@ namespace AZ
// Pass behavior overrides...
void BuildInternal() override;
void FrameBeginInternal(FramePrepareParams params) override;
bool IsEnabled() const override;
private:
@@ -0,0 +1,41 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#include <Atom/RPI.Public/Pass/Pass.h>
#include <Atom/RPI.Public/Pass/FullscreenTrianglePass.h>
namespace AZ
{
namespace RPI
{
//! This pass allows the use of a custom fullscreen MSAA resolve pass shader.
class MSAAResolveFullScreenPass
: public RPI::FullscreenTrianglePass
{
AZ_RPI_PASS(MSAAResolveFullScreenPass);
public:
AZ_RTTI(RPI::MSAAResolveFullScreenPass, "{998FCF6D-5441-4C59-89EC-795CFB803912}", FullscreenTrianglePass);
AZ_CLASS_ALLOCATOR(RPI::MSAAResolveFullScreenPass, SystemAllocator, 0);
//! Creates a new pass without a PassTemplate
static RPI::Ptr<MSAAResolveFullScreenPass> Create(const RPI::PassDescriptor& descriptor);
private:
explicit MSAAResolveFullScreenPass(const RPI::PassDescriptor& descriptor);
// Pass Overrides...
bool IsEnabled() const override;
};
} // namespace RPI
} // namespace AZ
@@ -11,6 +11,7 @@
*/
#include <Atom/RPI.Public/Pass/MSAAResolvePass.h>
#include <Atom/RPI.Public/RenderPipeline.h>
#include <Atom/RPI.Reflect/Pass/PassTemplate.h>
#include <Atom/RPI.Reflect/Shader/ShaderAsset.h>
@@ -76,5 +77,17 @@ namespace AZ
void MSAAResolvePass::BuildCommandListInternal([[maybe_unused]] const RHI::FrameGraphExecuteContext& context)
{
}
bool MSAAResolvePass::IsEnabled() const
{
// check Pass base class first to see if the Pass is explicitly disabled
if (!Pass::IsEnabled())
{
return false;
}
// check render pipeline MSAA sample count
return (m_pipeline->GetRenderSettings().m_multisampleState.m_samples > 1);
}
} // namespace RPI
} // namespace AZ
@@ -23,6 +23,7 @@
#include <Atom/RPI.Public/Pass/PassFilter.h>
#include <Atom/RPI.Public/Pass/RasterPass.h>
#include <Atom/RPI.Public/Pass/MSAAResolvePass.h>
#include <Atom/RPI.Public/Pass/Specific/MSAAResolveFullScreenPass.h>
#include <Atom/RPI.Public/Pass/Specific/EnvironmentCubeMapPass.h>
#include <Atom/RPI.Public/Pass/Specific/RenderToTexturePass.h>
#include <Atom/RPI.Public/Pass/Specific/SelectorPass.h>
@@ -67,6 +68,7 @@ namespace AZ
AddPassCreator(Name("FullScreenTriangle"), &FullscreenTrianglePass::Create);
AddPassCreator(Name("ComputePass"), &ComputePass::Create);
AddPassCreator(Name("MSAAResolvePass"), &MSAAResolvePass::Create);
AddPassCreator(Name("MSAAResolveFullScreenPass"), &MSAAResolveFullScreenPass::Create);
AddPassCreator(Name("DownsampleMipChainPass"), &DownsampleMipChainPass::Create);
AddPassCreator(Name("EnvironmentCubeMapPass"), &EnvironmentCubeMapPass::Create);
AddPassCreator(Name("RenderToTexturePass"), &RenderToTexturePass::Create);
@@ -0,0 +1,44 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <Atom/RPI.Public/Pass/Specific/MSAAResolveFullScreenPass.h>
#include <Atom/RPI.Public/Pass/Pass.h>
#include <Atom/RPI.Public/RenderPipeline.h>
namespace AZ
{
namespace RPI
{
RPI::Ptr<MSAAResolveFullScreenPass> MSAAResolveFullScreenPass::Create(const RPI::PassDescriptor& descriptor)
{
RPI::Ptr<MSAAResolveFullScreenPass> pass = aznew MSAAResolveFullScreenPass(descriptor);
return AZStd::move(pass);
}
MSAAResolveFullScreenPass::MSAAResolveFullScreenPass(const RPI::PassDescriptor& descriptor)
: RPI::FullscreenTrianglePass(descriptor)
{
}
bool MSAAResolveFullScreenPass::IsEnabled() const
{
// check Pass base class first to see if the Pass is explicitly disabled
if (!Pass::IsEnabled())
{
return false;
}
// check render pipeline MSAA sample count
return (m_pipeline->GetRenderSettings().m_multisampleState.m_samples > 1);
}
} // namespace RPI
} // namespace AZ
@@ -78,6 +78,7 @@ set(FILES
Include/Atom/RPI.Public/Pass/Specific/DownsampleMipChainPass.h
Include/Atom/RPI.Public/Pass/Specific/ImageAttachmentPreviewPass.h
Include/Atom/RPI.Public/Pass/Specific/EnvironmentCubeMapPass.h
Include/Atom/RPI.Public/Pass/Specific/MSAAResolveFullScreenPass.h
Include/Atom/RPI.Public/Pass/Specific/RenderToTexturePass.h
Include/Atom/RPI.Public/Pass/Specific/SelectorPass.h
Include/Atom/RPI.Public/Pass/Specific/SwapChainPass.h
@@ -153,6 +154,7 @@ set(FILES
Source/RPI.Public/Pass/Specific/DownsampleMipChainPass.cpp
Source/RPI.Public/Pass/Specific/ImageAttachmentPreviewPass.cpp
Source/RPI.Public/Pass/Specific/EnvironmentCubeMapPass.cpp
Source/RPI.Public/Pass/Specific/MSAAResolveFullScreenPass.cpp
Source/RPI.Public/Pass/Specific/RenderToTexturePass.cpp
Source/RPI.Public/Pass/Specific/SelectorPass.cpp
Source/RPI.Public/Pass/Specific/SwapChainPass.cpp