You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
o3de/Gems/Atom/Feature/Common/Code/Source/PostProcessing/SMAABasePass.h

73 lines
2.5 KiB
C++

/*
* 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 <AzCore/RTTI/RTTI.h>
#include <AzCore/Memory/SystemAllocator.h>
#include <Atom/RHI/CommandList.h>
#include <Atom/RHI/DrawItem.h>
#include <Atom/RHI/ScopeProducer.h>
#include <Atom/RPI.Reflect/Pass/PassName.h>
#include <Atom/RPI.Public/Pass/FullscreenTrianglePass.h>
#include <Atom/RPI.Public/Shader/Shader.h>
#include <Atom/RPI.Public/Shader/ShaderResourceGroup.h>
namespace AZ
{
namespace Render
{
//! SMAABasePass
//! This pass contains data structure and method commonly used by SMAA passes implementation.
class SMAABasePass
: public AZ::RPI::FullscreenTrianglePass
{
public:
AZ_RTTI(SMAABasePass, "{D879B4E8-DEDC-422D-950A-8B5341A8FD48}", AZ::RPI::FullscreenTrianglePass);
AZ_CLASS_ALLOCATOR(SMAABasePass, SystemAllocator, 0);
virtual ~SMAABasePass();
protected:
SMAABasePass(const RPI::PassDescriptor& descriptor);
// Pass behavior overrides...
void InitializeInternal() override;
// An interface to update pass srg.
virtual void UpdateSRG() = 0;
// An interface to get current shader variation option.
virtual void GetCurrentShaderOption(AZ::RPI::ShaderOptionGroup& shaderOption) const = 0;
void InvalidateShaderVariant();
void InvalidateSRG();
AZ::Vector4 CalculateRenderTargetMetrics(const RPI::PassAttachment* attachment);
AZ::Vector4 m_renderTargetMetrics = AZ::Vector4(0.0f, 0.0f, 0.0f, 0.0f);
private:
void UpdateCurrentShaderVariant();
// Scope producer functions...
void CompileResources(const RHI::FrameGraphCompileContext& context) override;
AZ::RPI::ShaderVariantKey m_currentShaderVariantKeyFallbackValue;
bool m_needToUpdateShaderVariant = false;
bool m_needToUpdateSRG = true;
};
} // namespace Render
} // namespace AZ