/* * 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 #include #include #include #include #include #include #include #include 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); void Init() 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