D3D11RenderTarget class
Off-screen render target of the Direct3D 11 backend (aliased as RHI::RenderTarget).
Records the color textures 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 are associated with its contiguously attached color attachments (0..count-1, bounded by SetDrawBuffers(), the glDrawBuffers equivalent). One RTV per attachment is created lazily from the attached textures and OMSetRenderTargets is routed through here.
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
- D3D11RenderTarget()
- ~D3D11RenderTarget()
- D3D11RenderTarget(const D3D11RenderTarget&) deleted
Public functions
- auto operator=(const D3D11RenderTarget&) -> D3D11RenderTarget& deleted
-
auto GetRTV(std::
uint32_t index = 0) -> ID3D11RenderTargetView* - Returns the render target view of the given color attachment (created lazily from its texture), or
nullptr. -
auto GetRTVs(ID3D11RenderTargetView* outRtvs[MaxColorAttachments]) -> std::
uint32_t - Fills
outRtvswith the views of the contiguously attached color attachments enabled for drawing. -
auto GetAttachedCount() const -> std::
uint32_t - Returns the number of contiguously attached color textures starting at attachment 0.
-
void AttachColorTexture(D3D11Texture& 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 is created).
- 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 -> D3D11Texture* - Returns the texture attached at the given color attachment index, or
nullptr. -
auto GetNumDrawBuffers() const -> std::
uint32_t - Returns the number of color attachments enabled for drawing (see SetDrawBuffers()).
Function documentation
std:: uint32_t nCine:: RHI:: D3D11:: D3D11RenderTarget:: GetRTVs(ID3D11RenderTargetView* outRtvs[MaxColorAttachments])
Fills outRtvs with the views of the contiguously attached color attachments enabled for drawing.
| Returns | The number of views written (0 if attachment 0 is missing or unusable) |
|---|
The count is the contiguous attached run from attachment 0, bounded by SetDrawBuffers() (mirroring glDrawBuffers), and truncated at the first attachment whose view cannot be created.