Gx2RenderTarget class
Off-screen render target of the GX2 backend (aliased as RHI::RenderTarget).
Records the colour texture the following draws render into and keeps the GX2ColorBuffer built over its surface. BindDraw() records the target on the device, which binds that colour buffer with GX2SetColorBuffer() before the next clear or draw. The colour buffer and the texture share one tiled surface (see Gx2Texture), so what the GPU renders here is what a later pass samples.
Like the RSX, Latte is an immediate-mode renderer: switching targets is a state change, with no scene to begin and end and no risk of discarding what an earlier pass drew.
One colour attachment, which is all the render pipeline uses.
No depth storage. The engine is a 2D renderer and never enables the depth test, so neither the screen nor any target has a depth buffer; depth clears are ignored by the device.
Public static variables
-
static std::
uint32_t MaxColorAttachments constexpr - Number of colour attachments a target can carry (see the class documentation).
Public static functions
- static void UnbindDraw()
- Unbinds any render target from the device.
Constructors, destructors, conversion operators
- Gx2RenderTarget()
- ~Gx2RenderTarget()
- Gx2RenderTarget(const Gx2RenderTarget&) deleted
Public functions
- auto operator=(const Gx2RenderTarget&) -> Gx2RenderTarget& deleted
-
void AttachColorTexture(Gx2Texture& texture,
std::
uint32_t index) - Attaches a texture as the colour attachment with the given index.
-
void DetachColorTexture(std::
uint32_t index) - Detaches any texture from the colour attachment with the given index.
- void ForgetColorTexture(const Gx2Texture& texture)
- Drops a texture that is being destroyed from the attachments, without calling back into it.
-
void AttachDepthStencil(DepthStencilFormat format,
std::
int32_t width, std:: int32_t height) - Records a depth/stencil buffer (no storage is created, see the class documentation).
- void DetachDepthStencil(DepthStencilFormat format)
- Clears the recorded depth/stencil buffer.
- void BindDraw()
- Binds the render target as the current draw target on the device.
-
auto SetDrawBuffers(std::
uint32_t numColorAttachments) -> bool - Sets the number of colour attachments enabled for drawing.
- auto IsStatusComplete() -> bool
- Returns
trueif the target has a usable colour attachment 0. - void InvalidateDepthStencil(DepthStencilFormat format)
- Hints that the depth/stencil contents are no longer needed (no-op: they are never stored).
- void SetObjectLabel(StringView label)
- Sets a debug label for the render target (ignored).
-
auto GetColorTexture(std::
uint32_t index) const -> Gx2Texture* - Returns the texture attached at the given colour attachment index, or
nullptr. -
auto GetNumDrawBuffers() const -> std::
uint32_t - Returns the number of colour attachments enabled for drawing (see SetDrawBuffers()).
-
auto GetColorBuffer(std::
int32_t& width, std:: int32_t& height) -> const GX2ColorBuffer* - Returns the colour buffer the device binds to render into this target.
Function documentation
const GX2ColorBuffer* nCine:: RHI:: GX2:: Gx2RenderTarget:: GetColorBuffer(std:: int32_t& width,
std:: int32_t& height)
Returns the colour buffer the device binds to render into this target.
| Returns | nullptr if the target has no usable attachment. |
|---|
Built on demand over the attached texture's GPU surface and rebuilt when the attachment or its storage changes.