Skip to main content

Target

The Target class provides functionality for managing rendering targets, including color and depth buffers, in a graphics pipeline. It supports operations such as loading, clearing, discarding, storing, and resolving targets, allowing for flexible rendering workflows. The class enables managing target properties such as format, dimension, multisampling, as well as configuring clear colors, textures, and slices for color and depth targets, making it suitable for complex rendering tasks.

#include <platform/TellusimTarget.h>

Constructors

Target()

Methods

Target platform.

Platform getPlatform() const
const char *getPlatformName() const

Target device index.

uint32_t getIndex() const

Begin target.

bool begin(Fence &fence)
bool begin()

End target.

void end(Fence &fence)
void end()

Swap target.

void swap(Surface &surface)

Check target.

bool isEnabled() const

Target format.

Format getColorFormat(uint32_t index = 0) const
Format getDepthFormat() const
uint32_t getMultisample() const
bool hasMultisample() const
bool isFlipped() const
bool isAtomic() const

Target dimension.

uint32_t getWidth() const
uint32_t getHeight() const
uint32_t getDepth() const
uint32_t getFaces() const
uint32_t getLayers() const
uint32_t getMipmaps() const

Color target.

void setClearColor(Color color)
void setClearColor(uint32_t index, Color color)
void setClearColor(float32_t r, float32_t g, float32_t b, float32_t a)
void setClearColor(uint32_t index, float32_t r, float32_t g, float32_t b, float32_t a)
void setColorTexture(Texture &texture, Operation op = OpDefault, Slice slice = Slice())
void setColorTexture(uint32_t index, Texture &texture, Operation op = OpDefault, Slice slice = Slice())
void setColorResolve(Texture &texture, Slice slice = Slice())
void setColorResolve(uint32_t index, Texture &texture, Slice slice = Slice())
uint32_t getNumTargets() const
const Color getClearColor(uint32_t index = 0) const
Operation getColorOp(uint32_t index = 0) const
Texture getColorTexture(uint32_t index) const
Texture getColorResolve(uint32_t index) const
const Slice getColorTextureSlice(uint32_t index) const
const Slice getColorResolveSlice(uint32_t index) const

Depth target.

void setClearDepth(float32_t depth, uint32_t stencil = 0)
void setDepthTexture(Texture &texture, Operation op = OpDefault, Slice slice = Slice())
void setDepthResolve(Texture &texture, Slice slice = Slice())
float32_t getClearDepth() const
uint32_t getClearStencil() const
Operation getDepthOp() const
Texture getDepthTexture() const
Texture getDepthResolve() const
const Slice getDepthTextureSlice() const
const Slice getDepthResolveSlice() const

Enums

Operation

Target operations.

NameValueDescription
BeginLoad(1 << 0)Load targets.
BeginClear(1 << 1)Clear targets.
BeginDiscard(1 << 2)Discard targets.
BeginMask(BeginLoad | BeginClear | BeginDiscard)
EndStore(1 << 3)Store targets.
EndResolve(1 << 4)Resolve targets.
EndDiscard(1 << 5)Discard targets.
EndMask(EndStore | EndResolve | EndDiscard)
OpNone0
OpLoadBeginLoad
OpLoadStore(BeginLoad | EndStore)
OpClearStore(BeginClear | EndStore)
OpClearDiscard(BeginClear | EndDiscard)
OpDefaultOpClearStore