Blender V5.0
blender::gpu::VKFrameBuffer Class Reference

#include <vk_framebuffer.hh>

Inherits blender::gpu::FrameBuffer.

Public Member Functions

void bind (bool enabled_srgb) override
bool check (char err_out[256]) override
void vk_viewports_append (Vector< VkViewport > &r_viewports) const
void vk_render_areas_append (Vector< VkRect2D > &r_render_areas) const
void render_area_update (VkRect2D &render_area) const
VkFormat depth_attachment_format_get () const
VkFormat stencil_attachment_format_get () const
Span< VkFormat > color_attachment_formats_get () const
void rendering_reset ()
void rendering_ensure (VKContext &context)
void rendering_ensure_dynamic_rendering (VKContext &context, const VKExtensions &extensions)
void rendering_end (VKContext &context)
bool is_rendering () const
Creation & Deletion
 VKFrameBuffer (const char *name)
virtual ~VKFrameBuffer ()
Load/Store operations
void attachment_set_loadstore_op (GPUAttachmentType type, GPULoadStore) override
Read back
void read (GPUFrameBufferBits planes, eGPUDataFormat format, const int area[4], int channel_len, int slot, void *r_data) override
Blit operations
void blit_to (GPUFrameBufferBits planes, int src_slot, FrameBuffer *dst, int dst_slot, int dst_offset_x, int dst_offset_y) override
Update attachments
void update_size ()
void update_srgb ()
int color_attachments_resource_size () const
Public Member Functions inherited from blender::gpu::FrameBuffer
void size_set (int width, int height)
void default_size_set (int width, int height)
void viewport_set (const int viewport[4])
void viewport_multi_set (const int viewports[GPU_MAX_VIEWPORTS][4])
void scissor_set (const int scissor[4])
void scissor_test_set (bool test)
void viewport_get (int r_viewport[4]) const
void scissor_get (int r_scissor[4]) const
bool scissor_test_get () const
void viewport_reset ()
void scissor_reset ()
const GPUAttachmentdepth_attachment () const
blender::gpu::Texturedepth_tex () const
blender::gpu::Texturecolor_tex (int slot) const
const char * name_get () const
void set_use_explicit_loadstore (bool use_explicit_loadstore)
bool get_use_explicit_loadstore () const
uint16_t get_color_attachments_bitset ()
 FrameBuffer (const char *name)
virtual ~FrameBuffer ()
void subpass_transition (const GPUAttachmentState depth_attachment_state, Span< GPUAttachmentState > color_attachment_states)
void load_store_config_array (const GPULoadStore *load_store_actions, uint actions_len)
void attachment_set (GPUAttachmentType type, const GPUAttachment &new_attachment)
void attachment_remove (GPUAttachmentType type)
uint get_bits_per_pixel ()

Public Attributes

uint32_t color_attachment_size = 0u
Public Attributes inherited from blender::gpu::FrameBuffer
void ** py_ref = nullptr

Protected Member Functions

Sub-pass transition
void subpass_transition_impl (const GPUAttachmentState depth_attachment_state, Span< GPUAttachmentState > color_attachment_states) override
Protected Member Functions inherited from blender::gpu::FrameBuffer
void set_color_attachment_bit (GPUAttachmentType type, bool value)

Clear

void clear (GPUFrameBufferBits buffers, const float clear_color[4], float clear_depth, uint clear_stencil) override
void clear_multi (const float(*clear_color)[4]) override
void clear_attachment (GPUAttachmentType type, eGPUDataFormat data_format, const void *clear_value) override

Additional Inherited Members

Protected Attributes inherited from blender::gpu::FrameBuffer
GPUAttachment attachments_ [GPU_FB_MAX_ATTACHMENT]
bool dirty_attachments_ = true
int width_ = 0
int height_ = 0
char name_ [DEBUG_NAME_LEN]
int viewport_ [GPU_MAX_VIEWPORTS][4] = {{0}}
int scissor_ [4] = {0}
bool multi_viewport_ = false
bool scissor_test_ = false
bool dirty_state_ = true
bool use_explicit_load_store_ = false
uint16_t color_attachments_bits_ = 0

Detailed Description

Definition at line 25 of file vk_framebuffer.hh.

Constructor & Destructor Documentation

◆ VKFrameBuffer()

blender::gpu::VKFrameBuffer::VKFrameBuffer ( const char * name)

Create a conventional frame-buffer to attach texture to.

Definition at line 29 of file vk_framebuffer.cc.

References blender::gpu::default_load_store(), blender::gpu::FrameBuffer::FrameBuffer(), GPU_ATTACHMENT_WRITE, GPU_FB_MAX_ATTACHMENT, name, and blender::gpu::FrameBuffer::size_set().

Referenced by blit_to().

◆ ~VKFrameBuffer()

blender::gpu::VKFrameBuffer::~VKFrameBuffer ( )
virtual

Definition at line 39 of file vk_framebuffer.cc.

References blender::gpu::VKContext::get().

Member Function Documentation

◆ attachment_set_loadstore_op()

void blender::gpu::VKFrameBuffer::attachment_set_loadstore_op ( GPUAttachmentType type,
GPULoadStore ls )
overridevirtual

Implements blender::gpu::FrameBuffer.

Definition at line 260 of file vk_framebuffer.cc.

◆ bind()

◆ blit_to()

◆ check()

bool blender::gpu::VKFrameBuffer::check ( char err_out[256])
overridevirtual

Implements blender::gpu::FrameBuffer.

Definition at line 121 of file vk_framebuffer.cc.

◆ clear()

◆ clear_attachment()

void blender::gpu::VKFrameBuffer::clear_attachment ( GPUAttachmentType type,
eGPUDataFormat data_format,
const void * clear_value )
overridevirtual

Implements blender::gpu::FrameBuffer.

Definition at line 244 of file vk_framebuffer.cc.

References BLI_assert_unreachable.

◆ clear_multi()

void blender::gpu::VKFrameBuffer::clear_multi ( const float(*) clear_color[4])
overridevirtual

Implements blender::gpu::FrameBuffer.

Definition at line 231 of file vk_framebuffer.cc.

References clear(), and render_area_update().

◆ color_attachment_formats_get()

Span< VkFormat > blender::gpu::VKFrameBuffer::color_attachment_formats_get ( ) const

◆ color_attachments_resource_size()

int blender::gpu::VKFrameBuffer::color_attachments_resource_size ( ) const

Return the number of color attachments of this frame buffer, including unused color attachments.

Frame-buffers can have unused attachments. When higher attachment slots are being used, unused lower attachment slots will be counted as they are required resources in render-passes.

Definition at line 547 of file vk_framebuffer.cc.

References blender::gpu::FrameBuffer::color_tex(), GPU_FB_MAX_COLOR_ATTACHMENT, max_ii(), and size().

◆ depth_attachment_format_get()

VkFormat blender::gpu::VKFrameBuffer::depth_attachment_format_get ( ) const

◆ is_rendering()

bool blender::gpu::VKFrameBuffer::is_rendering ( ) const
inline

◆ read()

void blender::gpu::VKFrameBuffer::read ( GPUFrameBufferBits planes,
eGPUDataFormat format,
const int area[4],
int channel_len,
int slot,
void * r_data )
overridevirtual

◆ render_area_update()

◆ rendering_end()

void blender::gpu::VKFrameBuffer::rendering_end ( VKContext & context)

◆ rendering_ensure()

void blender::gpu::VKFrameBuffer::rendering_ensure ( VKContext & context)

Ensure that the framebuffer is ready to be rendered on and that its state is up to date with the latest changes that can happen between drawing commands inside VKStateManager.

Definition at line 735 of file vk_framebuffer.cc.

References blender::gpu::VKBackend::device, blender::gpu::FrameBuffer::dirty_attachments_, blender::gpu::FrameBuffer::dirty_state_, blender::gpu::VKDevice::extensions_get(), blender::gpu::VKBackend::get(), rendering_end(), and rendering_ensure_dynamic_rendering().

Referenced by rendering_end().

◆ rendering_ensure_dynamic_rendering()

void blender::gpu::VKFrameBuffer::rendering_ensure_dynamic_rendering ( VKContext & context,
const VKExtensions & extensions )

Definition at line 565 of file vk_framebuffer.cc.

References blender::gpu::Attachment, blender::gpu::FrameBuffer::attachments_, BLI_assert_msg, color_attachment_size, blender::gpu::render_graph::VKBeginRenderingData::color_attachments, blender::gpu::render_graph::VKBeginRenderingData::depth_attachment, blender::gpu::VKBackend::device, blender::gpu::VKTexture::device_format_get(), blender::gpu::DONT_CARE, blender::gpu::VKExtensions::dynamic_rendering_local_read, blender::gpu::VKExtensions::dynamic_rendering_unused_attachments, blender::gpu::VKDevice::extensions_get(), blender::gpu::VKBackend::get(), GPU_ATTACHMENT_WRITE, GPU_FB_COLOR_ATTACHMENT0, GPU_FB_DEPTH_ATTACHMENT, GPU_FB_DEPTH_STENCIL_ATTACHMENT, GPU_FB_MAX_COLOR_ATTACHMENT, GPU_TEXTURE_USAGE_ATTACHMENT, blender::gpu::VKTexture::image_view_get(), blender::gpu::render_graph::VKResourceAccessInfo::images, GPUAttachment::layer, blender::gpu::Texture::layer_count(), max_ii(), GPUAttachment::mip, blender::gpu::render_graph::VKBeginRenderingCreateInfo::node_data, render_area_update(), blender::gpu::set_load_store(), blender::gpu::render_graph::VKBeginRenderingData::stencil_attachment, GPUAttachment::tex, blender::gpu::to_vk_format(), blender::gpu::to_vk_image_aspect_flag_bits(), blender::gpu::unwrap(), blender::gpu::Texture::usage_get(), blender::gpu::VKImageView::vk_format(), blender::gpu::VKImageView::vk_handle(), blender::gpu::VKTexture::vk_image_handle(), and blender::gpu::render_graph::VKBeginRenderingData::vk_rendering_info.

Referenced by rendering_ensure().

◆ rendering_reset()

void blender::gpu::VKFrameBuffer::rendering_reset ( )

Mark this framebuffer to be not being rendered on.

Between binding a framebuffer and actually using it the state and clear operations can change. The rendering state is used to find out if the framebuffer begin rendering command should be recorded

Definition at line 560 of file vk_framebuffer.cc.

Referenced by blender::gpu::VKContext::activate_framebuffer().

◆ stencil_attachment_format_get()

VkFormat blender::gpu::VKFrameBuffer::stencil_attachment_format_get ( ) const

◆ subpass_transition_impl()

◆ update_size()

void blender::gpu::VKFrameBuffer::update_size ( )

Ensure that the size of the frame-buffer matches the first attachment resolution.

Frame buffers attachments are updated when actually used as the image layout has to be correct. After binding frame-buffers the layout of images can still be modified.

But for correct behavior of blit/clear operation the size of the frame-buffer should be set, when activating the frame buffer.

Definition at line 519 of file vk_framebuffer.cc.

References blender::gpu::FrameBuffer::attachments_, blender::gpu::FrameBuffer::dirty_attachments_, GPU_FB_MAX_ATTACHMENT, GPU_texture_get_mipmap_size(), i, GPUAttachment::mip, size(), blender::gpu::FrameBuffer::size_set(), and GPUAttachment::tex.

Referenced by blender::gpu::VKContext::activate_framebuffer(), and bind().

◆ update_srgb()

◆ vk_render_areas_append()

◆ vk_viewports_append()

Member Data Documentation

◆ color_attachment_size

uint32_t blender::gpu::VKFrameBuffer::color_attachment_size = 0u

The documentation for this class was generated from the following files: