/* * 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 namespace AZ { namespace Render { //! This pass is used to read back the depth value written to the buffer. class DepthOfFieldCopyFocusDepthToCpuPass final : public RPI::Pass , public RHI::ScopeProducer { AZ_RPI_PASS(DepthOfFieldCopyFocusDepthToCpuPass); public: AZ_RTTI(DepthOfFieldCopyFocusDepthToCpuPass, "{EA00AD76-92FC-4223-AB7D-87F588AB5394}", Pass); AZ_CLASS_ALLOCATOR(DepthOfFieldCopyFocusDepthToCpuPass, SystemAllocator, 0); //! Creates an DepthOfFieldCopyFocusDepthToCpuPass static RPI::Ptr Create(const RPI::PassDescriptor& descriptor); ~DepthOfFieldCopyFocusDepthToCpuPass() = default; void SetBufferRef(RPI::Ptr bufferRef); float GetFocusDepth(); private: explicit DepthOfFieldCopyFocusDepthToCpuPass(const RPI::PassDescriptor& descriptor); // Scope producer functions void SetupFrameGraphDependencies(RHI::FrameGraphInterface frameGraph) override; void CompileResources(const RHI::FrameGraphCompileContext& context) override; void BuildCommandList(const RHI::FrameGraphExecuteContext& context) override; // Pass overrides void BuildInternal() override; void FrameBeginInternal(FramePrepareParams params) override; RPI::Ptr m_bufferRef; Data::Instance m_readbackBuffer; RHI::CopyBufferDescriptor m_copyDescriptor; bool m_needsInitialize = true; }; } // namespace RPI } // namespace AZ