SwRenderTarget class
Off-screen render target of the software backend (aliased as RHI::RenderTarget).
Holds the color textures the rasterizer writes into (addressed by attachment index) and an optional depth/stencil (ignored for 2D). BindDraw() records the target on the device so the following clears and draws land in its color attachment 0.
Public static variables
-
static std::
uint32_t MaxColorAttachments constexpr
Public static functions
- static void UnbindDraw()
- Unbinds any render target from the device.
Constructors, destructors, conversion operators
- SwRenderTarget()
- ~SwRenderTarget()
- SwRenderTarget(const SwRenderTarget&) deleted
Public functions
- auto operator=(const SwRenderTarget&) -> SwRenderTarget& deleted
-
void AttachColorTexture(SwTexture& texture,
std::
uint32_t index) - Attaches a texture as the color attachment with the given index.
-
void DetachColorTexture(std::
uint32_t index) - Detaches any texture from the color attachment with the given index.
-
void AttachDepthStencil(DepthStencilFormat format,
std::
int32_t width, std:: int32_t height) - Records a depth/stencil buffer (no storage — the software backend is 2D).
- 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 color attachments enabled for drawing.
- auto IsStatusComplete() -> bool
- Returns
trueif the target has a usable color attachment 0. - void InvalidateDepthStencil(DepthStencilFormat format)
- Hints that the depth/stencil contents are no longer needed (no-op).
- void SetObjectLabel(StringView label)
- Sets a debug label for the render target (ignored).
-
auto GetColorTexture(std::
uint32_t index) const -> SwTexture* - Returns the texture attached at the given color attachment index, or
nullptr.