Open 3D Engine Atom Gem API Reference 26.05.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
AZ::RHI::RenderAttachmentLayoutBuilder Class Reference

#include <RenderAttachmentLayoutBuilder.h>

Classes

class  SubpassAttachmentLayoutBuilder
 

Public Member Functions

SubpassAttachmentLayoutBuilderAddSubpass ()
 Adds a new subpass to the layout.
 
ResultCode End (RenderAttachmentLayout &builtRenderAttachmentLayout, AZStd::array< AZ::Name, Limits::Pipeline::RenderAttachmentCountMax > *outAttachmentNames=nullptr)
 
void Reset ()
 Resets all previous values so the builder can be reuse.
 
uint32_t GetSubpassCount () const
 Return the current subpass count.
 

Detailed Description

Provides a convenient way to construct RenderAttachmentLayout objects, which describes the render attachments layout for the pipeline state.

The general usage includes adding one or more subpasses, and adding one or more attachment to each subpass. Examples are shown below.

1) One Subpass

layoutBuilder.AddSubpas()
->RenderTargetAttachment(RHI::Format::R16G16B16_FLOAT)
->RenderTargetAttachment(RHI::Format::R8G8B8A8_UNORM)
->DepthStencilAttachment(RHI::Format::D32_FLOAT)
RHI::ResultCode result = layoutBuilder.End(layout);
Definition RenderAttachmentLayoutBuilder.h:70
ResultCode End(RenderAttachmentLayout &builtRenderAttachmentLayout, AZStd::array< AZ::Name, Limits::Pipeline::RenderAttachmentCountMax > *outAttachmentNames=nullptr)

2) Multiple Subpasses

layoutBuilder.AddSubpass()
->RenderTargetAttachment(RHI::Format::R16G16B16A16_FLOAT, "Color0")
->RenderTargetAttachment(RHI::Format::R16G16B16A16_FLOAT, "Color1")
->RenderTargetAttachment(RHI::Format::R8G8B8A8_UNORM, "Swapchain")
->DepthStencilAttachment(AZ::RHI::Format::D32_FLOAT, "Depth");
layoutBuilder.AddSubpass()
->RenderTargetAttachment("Swapchain")
->DepthStencilAttachment("Depth", AttachmentLoadStoreAction(ClearValue::CreateDepth(1.0f), AttachmentLoadAction::Clear, AttachmentStoreAction::Save));
RHI::ResultCode result = layoutBuilder.End(layout);
Definition InputStreamLayoutBuilder.h:51
InputStreamLayout End()
Finalize and return the InputStreamLayout.
Describes what rules to apply when the image or buffer attachment is loaded and stored.
Definition AttachmentLoadStoreAction.h:19

3) Multiple Subpasses with subpass inputs

layoutBuilder.AddSubpass()
->RenderTargetAttachment(RHI::Format::R16G16B16A16_FLOAT, "Color0")
->RenderTargetAttachment(RHI::Format::R16G16B16A16_FLOAT, "Color1")
->RenderTargetAttachment(RHI::Format::R8G8B8A8_UNORM, "Swapchain")
->DepthStencilAttachment(AZ::RHI::Format::D32_FLOAT, "Depth");
layoutBuilder.AddSubpass()
->SubpassInputAttachment("Color0")
->RenderTargetAttachment("Color1", AttachmentLoadStoreAction(ClearValue(), AttachmentLoadAction::Load, AttachmentStoreAction::DontCare))
->DepthStencilAttachment("Depth");
layoutBuilder.AddSubpass()
->SubpassInputAttachment("Color1")
->RenderTargetAttachment("Swapchain")
RHI::ResultCode result = layoutBuilder.End(layout);
Represents either a depth stencil, a float vector, or a uint vector clear value.
Definition ClearValue.h:47

Member Function Documentation

◆ End()

ResultCode AZ::RHI::RenderAttachmentLayoutBuilder::End ( RenderAttachmentLayout builtRenderAttachmentLayout,
AZStd::array< AZ::Name, Limits::Pipeline::RenderAttachmentCountMax > *  outAttachmentNames = nullptr 
)

Ends the building of a layout. Returns the result of the operation.

Parameters
outAttachmentNamesOptional parameter to collect the names of the render attachments when building the RenderAttachmentLayout.

The documentation for this class was generated from the following file: