/* * 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 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 BuildAttachmentsInternal() 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