LLGL 0.05 Beta
Loading...
Searching...
No Matches
LLGL::RenderTargetDescriptor Struct Reference

Render target descriptor structure. More...

#include <RenderTargetFlags.h>

Public Attributes

const char * debugName = nullptr
 Optional name for debugging purposes. By default null.
const RenderPass * renderPass = nullptr
 Optional render pass object that will be used with the render target. By default null.
Extent2D resolution
 Specifies the resolution of the render targets.
std::uint32_t samples = 1
 Number of samples for the render targets. By default 1.
std::uint32_t views = 1
 Specifies the number of views for multiview (single-pass layered) rendering. By default 1.
AttachmentDescriptor colorAttachments [LLGL_MAX_NUM_COLOR_ATTACHMENTS]
 Specifies the list of color attachment descriptors.
AttachmentDescriptor resolveAttachments [LLGL_MAX_NUM_COLOR_ATTACHMENTS]
 Specifies the list of attachment descriptors for which the corresponding multi-sampled color attachments will be resolved into after a render pass.
AttachmentDescriptor depthStencilAttachment
 Specifies the depth-stencil attachment descriptor.
AttachmentDescriptor depthStencilResolveAttachment
 Specifies the attachment descriptor the multi-sampled depth-stencil attachment will be resolved into after a render pass.

Detailed Description

Render target descriptor structure.

Remarks
Here is a small example of a render target descriptor with a color attachment and an anonymous depth attachment (i.e. without a texture reference, which is only allowed for depth/stencil attachments):
LLGL::RenderTargetDescriptor myRenderTargetDesc;
auto myRenderTargetSize = myColorTexture->GetMipExtent(0);
myRenderTargetDesc.resolution = { myRenderTargetSize.width, myRenderTargetSize.height };
myRenderTargetDesc.attachments = {
LLGL::AttachmentDescriptor{ myColorTexture },
};
auto myRenderTarget = myRenderer->CreateRenderTarget(myRenderTargetDesc);
@ D32Float
Depth-stencil format: depth 32-bit floating point component.
Definition Format.h:214
Render target attachment descriptor structure.
Definition RenderTargetFlags.h:30
Render target descriptor structure.
Definition RenderTargetFlags.h:103
Extent2D resolution
Specifies the resolution of the render targets.
Definition RenderTargetFlags.h:127
See also
RenderSystem::CreateRenderTarget

Member Data Documentation

◆ colorAttachments

AttachmentDescriptor LLGL::RenderTargetDescriptor::colorAttachments[LLGL_MAX_NUM_COLOR_ATTACHMENTS]

Specifies the list of color attachment descriptors.

Remarks
Each attachment descriptor describes into which target will be rendered.
For each attachment, for which a texture is specified, this texture must have the same number of samples as specified by RenderTargetDescriptor::samples, must have the same size as specified by RenderTargetDescriptor::resolution, and must have been created with the binding flag BindFlags::ColorAttachment.
See also
TextureDescriptor::samples

◆ debugName

const char* LLGL::RenderTargetDescriptor::debugName = nullptr

Optional name for debugging purposes. By default null.

Remarks
The final name of the native hardware resource is implementation defined.
See also
RenderSystemChild::SetDebugName

◆ depthStencilAttachment

AttachmentDescriptor LLGL::RenderTargetDescriptor::depthStencilAttachment

Specifies the depth-stencil attachment descriptor.

Remarks
If a texture is specified for this attachment, this texture must have the same number of samples as specified by RenderTargetDescriptor::samples, must have the same size as specified by RenderTargetDescriptor::resolution, and must have been created with the binding flag BindFlags::DepthStencilAttachment.
See also
TextureDescriptor::samples

◆ depthStencilResolveAttachment

AttachmentDescriptor LLGL::RenderTargetDescriptor::depthStencilResolveAttachment

Specifies the attachment descriptor the multi-sampled depth-stencil attachment will be resolved into after a render pass.

Remarks
If a texture is specified for this attachment, RenderTargetDescriptor::depthStencilAttachment must also specify one, the texture must have 1 sample, must have the same size as specified by RenderTargetDescriptor::resolution, must have the same depth and stencil components as the depth-stencil attachment, and must have been created with the binding flag BindFlags::DepthStencilAttachment.
Unlike a color resolve, which averages the samples, a depth-stencil resolve takes sample 0 unmodified: averaging depth is not meaningful, and taking a single sample is the only mode every implementation supports.
Requires RenderingFeatures::hasDepthStencilResolve. Leave this attachment disabled if the multi-sampled depth buffer is only used for depth testing within the pass, which lets the backend keep it in tile memory.
Note
Only supported with: Vulkan.
See also
RenderingFeatures::hasDepthStencilResolve

◆ renderPass

const RenderPass* LLGL::RenderTargetDescriptor::renderPass = nullptr

Optional render pass object that will be used with the render target. By default null.

Remarks
If this is null, a default render pass is created for the render target. The default render pass determines the attachment formats by the render target attachments and keeps the load and store operations at its default values.
See also
RenderSystem::CreateRenderPass
AttachmentFormatDescriptor::loadOp
AttachmentFormatDescriptor::storeOp

◆ resolution

Extent2D LLGL::RenderTargetDescriptor::resolution

Specifies the resolution of the render targets.

Remarks
All attachments with a reference to a texture must have the same resolution, i.e. the specified array layer and MIP-map level must have the same extent.
See also
Texture::GetMipExtent

◆ resolveAttachments

AttachmentDescriptor LLGL::RenderTargetDescriptor::resolveAttachments[LLGL_MAX_NUM_COLOR_ATTACHMENTS]

Specifies the list of attachment descriptors for which the corresponding multi-sampled color attachments will be resolved into after a render pass.

Remarks
Each attachment descriptor describes a multi-sampled resolve target for the corresponding color attachment.
For each attachment, for which a texture is specified, this texture must have 1 sample, must have the same size as specified by RenderTargetDescriptor::resolution, and must have been created with the binding flag BindFlags::ColorAttachment.

◆ samples

std::uint32_t LLGL::RenderTargetDescriptor::samples = 1

Number of samples for the render targets. By default 1.

Remarks
If the specified number of samples is not supported, LLGL will silently reduce it. The actual number of samples can be queried by the GetSamples function of the RenderTarget interface.
If renderPass is specified, the number of samples from that RenderPass must match this number of samples.
See also
RenderTarget::GetSamples
RenderingLimits::maxColorBufferSamples
RenderingLimits::maxDepthBufferSamples
RenderingLimits::maxStencilBufferSamples
RenderingLimits::maxNoAttachmentSamples

◆ views

std::uint32_t LLGL::RenderTargetDescriptor::views = 1

Specifies the number of views for multiview (single-pass layered) rendering. By default 1.

Remarks
If this is greater than 1, the render target renders to views consecutive array layers of its attachments at once (single-pass stereo / cascaded shadow maps); see RenderPassDescriptor::views for details. All attachments that reference a texture must be array textures with at least arrayLayer + views layers.
If renderPass is specified, the number of views is taken from that RenderPass and this field is ignored (they must be consistent). If renderPass is null, the default render pass created for this render target uses this view count.
This must not be greater than RenderingLimits::maxViews, and requires RenderingFeatures::hasMultiview. A value of 0 is treated the same as 1 (multiview disabled).
Note
Only supported with: Vulkan, Direct3D 12.
See also
RenderPassDescriptor::views
RenderingFeatures::hasMultiview
RenderingLimits::maxViews

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