Blender V4.3
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
 
Array< VkViewport, 16 > vk_viewports_get () const
 
Array< VkRect2D, 16 > vk_render_areas_get () 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_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 (eGPUFrameBufferBits planes, eGPUDataFormat format, const int area[4], int channel_len, int slot, void *r_data) override
 
Blit operations
void blit_to (eGPUFrameBufferBits 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 ()
 
GPUTexture * depth_tex () const
 
GPUTexture * color_tex (int slot) const
 
const char *const name_get () const
 
void set_use_explicit_loadstore (bool use_explicit_loadstore)
 
bool get_use_explicit_loadstore () const
 
 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)
 
void recursive_downsample (int max_lvl, void(*callback)(void *user_data, int level), void *user_data)
 
uint get_bits_per_pixel ()
 

Protected Member Functions

Sub-pass transition
void subpass_transition_impl (const GPUAttachmentState depth_attachment_state, Span< GPUAttachmentState > color_attachment_states) override
 

Clear

void clear (eGPUFrameBufferBits 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

- Public Attributes inherited from blender::gpu::FrameBuffer
void ** py_ref = nullptr
 
- 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
 

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 30 of file vk_framebuffer.cc.

References blender::gpu::FrameBuffer::size_set().

◆ ~VKFrameBuffer()

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

Definition at line 40 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 245 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 111 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 229 of file vk_framebuffer.cc.

References BLI_assert_unreachable.

◆ clear_multi()

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

◆ 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 512 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()

◆ rendering_end()

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

End the rendering on this framebuffer. Is being triggered when framebuffer is deactivated or when

Definition at line 689 of file vk_framebuffer.cc.

References rendering_ensure(), and blender::gpu::FrameBuffer::use_explicit_load_store_.

Referenced by blender::gpu::VKContext::deactivate_framebuffer(), blender::gpu::VKContext::flush_render_graph(), blender::gpu::VKContext::rendering_end(), and subpass_transition_impl().

◆ 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 530 of file vk_framebuffer.cc.

References blender::Vector< T, InlineBufferCapacity, Allocator >::append(), blender::gpu::Attachment, blender::gpu::FrameBuffer::attachments_, blender::Vector< T, InlineBufferCapacity, Allocator >::clear(), 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::FrameBuffer::dirty_attachments_, blender::gpu::FrameBuffer::dirty_state_, blender::gpu::DONT_CARE, blender::gpu::VKWorkarounds::dynamic_rendering_unused_attachments, 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, 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, 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::VKImageView::vk_handle(), blender::gpu::VKTexture::vk_image_handle(), vk_render_areas_get(), blender::gpu::render_graph::VKBeginRenderingData::vk_rendering_info, and blender::gpu::VKDevice::workarounds_get().

Referenced by rendering_end().

◆ 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 525 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 484 of file vk_framebuffer.cc.

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

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

◆ update_srgb()

◆ vk_render_areas_get()

◆ vk_viewports_get()

Array< VkViewport, 16 > blender::gpu::VKFrameBuffer::vk_viewports_get ( ) const

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