Files
o3de/Gems/LyShine/Code/Source/LyShinePassDataBus.h
T
michabr 3a689aa319 Reenable support for UI Elements that use Render Targets (#2352)
* Re-add support for UI Elements that use Render Targets
* Move LyShine pass request from Atom's MainPipeline.pass to project's
* Make all dynamic draw contexts in LyShine draw to pass directly without the need of draw list tags
* Remove local RPI changes that are no longer needed
* Prevent crash if LyShine gem is enabled but its custom pass hasn't been added to the main render pipeline
* Revert to default UI pass if the LyShine pass has not been added to project's main render pipeline

Signed-off-by: abrmich <abrmich@amazon.com>
2021-08-03 10:14:09 -07:00

62 lines
2.1 KiB
C++

/*
* 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 <AzCore/Memory/SystemAllocator.h>
#include <AzCore/std/containers/vector.h>
#include <AtomCore/Instance/Instance.h>
#include <Atom/RPI.Public/Base.h>
namespace AZ
{
namespace RPI
{
class AttachmentImage;
class RasterPass;
}
}
namespace LyShine
{
using AttachmentImages = AZStd::vector<AZ::Data::Instance<AZ::RPI::AttachmentImage>>;
using AttachmentImageAndDependentsPair = AZStd::pair<AZ::Data::Instance<AZ::RPI::AttachmentImage>, AttachmentImages>;
using AttachmentImagesAndDependencies = AZStd::vector<AttachmentImageAndDependentsPair>;
}
class LyShinePassRequests
: public AZ::EBusTraits
{
public:
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::ById;
using BusIdType = AZ::RPI::SceneId;
//! Called when the number of render targets has changed and the LyShine pass needs to rebuild
virtual void RebuildRttChildren() = 0;
//! Returns a render to texture pass based on render target name
virtual AZ::RPI::RasterPass* GetRttPass(const AZStd::string& name) = 0;
//! Returns the final pass that renders the UI canvas contents
virtual AZ::RPI::RasterPass* GetUiCanvasPass() = 0;
};
using LyShinePassRequestBus = AZ::EBus<LyShinePassRequests>;
class LyShinePassDataRequests
: public AZ::EBusTraits
{
public:
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::ById;
using BusIdType = AZ::RPI::SceneId;
//! Get a list of render targets that require a render to texture pass, and any
//! other render targets that are drawn on them
virtual LyShine::AttachmentImagesAndDependencies GetRenderTargets() = 0;
};
using LyShinePassDataRequestBus = AZ::EBus<LyShinePassDataRequests>;