/* * Copyright (c) Contributors to the Open 3D Engine Project. * For complete copyright and license terms please see the LICENSE at the root of this distribution. * * SPDX-License-Identifier: Apache-2.0 OR MIT * */ #pragma once #include #include #include #include #include #include #include #include #include #include namespace AtomSampleViewer { //! Multiple Render Targets testing, using 2 scopes //! First scope render to 3 render targets with different R, G, B values //! Second scope merge the result from 3 render targets and render to screen class MRTExampleComponent final : public BasicRHIComponent { public: AZ_COMPONENT(MRTExampleComponent, "{A18A98CB-1274-474F-81CC-E9238B3AD0AF}", AZ::Component); AZ_DISABLE_COPY(MRTExampleComponent); static void Reflect(AZ::ReflectContext* context); MRTExampleComponent(); ~MRTExampleComponent() = default; protected: // AZ::Component void Activate() override; void Deactivate() override; // RHISystemNotificationBus::Handler void OnFramePrepare(AZ::RHI::FrameGraphBuilder& frameGraphBuilder) override; void CreateInputAssemblyBuffersAndViews(); void InitRenderTargets(); void CreateRenderTargetScope(); void CreateScreenScope(); // init pipeline state void ReadRenderTargetShader(); void ReadScreenShader(); AZ::RHI::Ptr m_bufferPool; AZ::RHI::Ptr m_inputAssemblyBuffer; AZStd::array m_renderTargetImageDescriptors; AZ::RHI::InputStreamLayout m_inputStreamLayout; AZStd::array,2> m_pipelineStates; AZStd::array, 2> m_shaderResourceGroups; AZStd::array m_shaderInputConstantIndices; AZStd::array m_shaderInputImageIndices; struct ScopeData { //UserDataParam - Empty for this samples }; struct BufferData { AZStd::array m_positions; AZStd::array m_uvs; AZStd::array m_indices; }; AZStd::array m_streamBufferViews; AZ::RHI::IndexBufferView m_indexBufferView; AZ::RHI::DrawItem m_drawItem; AZStd::array m_attachmentID; AZ::RHI::ClearValue m_clearValue; float m_time; }; }