/* * 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 #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace AZ { namespace Render { RPI::Ptr SMAANeighborhoodBlendingPass::Create(const RPI::PassDescriptor& descriptor) { return aznew SMAANeighborhoodBlendingPass(descriptor); } SMAANeighborhoodBlendingPass::SMAANeighborhoodBlendingPass(const RPI::PassDescriptor& descriptor) : SMAABasePass(descriptor) , m_blendingOutputModeOptionName(BlendingOutputModeOptionName) { } void SMAANeighborhoodBlendingPass::InitializeInternal() { SMAABasePass::InitializeInternal(); m_renderTargetMetricsShaderInputIndex.Reset(); } void SMAANeighborhoodBlendingPass::UpdateSRG() { m_shaderResourceGroup->SetConstant(m_renderTargetMetricsShaderInputIndex, m_renderTargetMetrics); } void SMAANeighborhoodBlendingPass::GetCurrentShaderOption(AZ::RPI::ShaderOptionGroup& shaderOption) const { switch (m_outputMode) { case SMAAOutputMode::BlendResult: shaderOption.SetValue(m_blendingOutputModeOptionName, AZ::Name("BlendingOutputMode::BlendResult")); break; case SMAAOutputMode::PassThrough: shaderOption.SetValue(m_blendingOutputModeOptionName, AZ::Name("BlendingOutputMode::PassThrough")); break; case SMAAOutputMode::EdgeTexture: shaderOption.SetValue(m_blendingOutputModeOptionName, AZ::Name("BlendingOutputMode::EdgeTexture")); break; case SMAAOutputMode::BlendWeightTexture: shaderOption.SetValue(m_blendingOutputModeOptionName, AZ::Name("BlendingOutputMode::BlendWeightTexture")); break; case SMAAOutputMode::BlendResultWithProvisionalTonemap: default: shaderOption.SetValue(m_blendingOutputModeOptionName, AZ::Name("BlendingOutputMode::BlendResultWithProvisionalTonemap")); break; } } void SMAANeighborhoodBlendingPass::SetOutputMode(SMAAOutputMode mode) { if (m_outputMode != mode) { m_outputMode = mode; InvalidateShaderVariant(); } } } // namespace Render } // namespace AZ