VulkanRenderTarget class
Off-screen render target of the Vulkan 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 color attachments. The backend builds a VkFramebuffer over the image views of every contiguously attached color texture (against a device-provided render pass cached by the full attachment-format signature, so multiple render targets work); the device begins a render pass on it for the draws routed 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
- VulkanRenderTarget()
- ~VulkanRenderTarget()
- VulkanRenderTarget(const VulkanRenderTarget&) deleted
Public functions
- auto operator=(const VulkanRenderTarget&) -> VulkanRenderTarget& deleted
-
auto GetFramebuffer() -> std::
uint64_t - Returns (building/caching on demand) the
VkFramebufferover all contiguously attached color textures, or0if incomplete. Opaquestd::uint64_tto keep this header free ofvulkan.h. - void ReleaseFramebuffer()
- Releases the cached framebuffer (on attachment change / destruction).
-
void AttachColorTexture(VulkanTexture& 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 -> VulkanTexture* - Returns the texture attached at the given color attachment index, or
nullptr. -
auto GetAttachedCount() const -> std::
uint32_t - Returns the number of contiguously attached color textures starting from attachment 0 (the framebuffer / render-pass attachment count).
-
auto GetNumDrawBuffers() const -> std::
uint32_t - Returns the number of color attachments enabled for drawing (see SetDrawBuffers()).