RsxRenderTarget class
Off-screen render target of the RSX backend (aliased as RHI::RenderTarget).
Records the colour texture the following draws render into and keeps the gcmSurface that describes it to the hardware. BindDraw() records the target on the device, which programs that surface with rsxSetSurface().
This is markedly simpler than the sceGxm backend it otherwise mirrors, for a structural reason: the PowerVR SGX is a tile-based deferred renderer, so a pass over a surface is a scene with a begin and an end, and switching targets mid-frame means closing one and opening another. The RSX is an immediate-mode renderer - a surface is just a set of addresses in a state register - so switching targets is a state change like any other, with no lifecycle to manage and no risk of discarding what an earlier pass drew.
One colour attachment.** The RSX can bind four, but the published MAX_COLOR_ATTACHMENTS is 1, which is all the render pipeline uses (every off-screen pass here is a single-target one).
No depth storage of its own.** The engine is a 2D renderer that never needs a depth buffer's contents to survive a pass, so every target shares the one display-sized depth surface the device allocates rather than carrying its own. That surface is only ever scratch, and its pitch covers any target the pipeline creates.
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
- RsxRenderTarget()
- ~RsxRenderTarget()
- RsxRenderTarget(const RsxRenderTarget&) deleted
Public functions
- auto operator=(const RsxRenderTarget&) -> RsxRenderTarget& deleted
-
void AttachColorTexture(RsxTexture& 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 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 -> RsxTexture* - 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 GetDrawSurface(gcmSurface& surface,
std::
int32_t& width, std:: int32_t& height) -> bool - Fills in the surface description the device programs to render into this target.
Function documentation
bool nCine:: RHI:: RSX:: RsxRenderTarget:: GetDrawSurface(gcmSurface& surface,
std:: int32_t& width,
std:: int32_t& height)
Fills in the surface description the device programs to render into this target.
| Returns | false if the target has no usable attachment. |
|---|
Built on demand from the attached texture's GPU-visible storage and rebuilt when the attachment or its size changes. The depth half is left to the caller, which fills in the shared depth surface.