Blender V4.3
blender::gpu::MTLFrameBuffer Class Reference

#include <mtl_framebuffer.hh>

Inherits blender::gpu::FrameBuffer.

Public Member Functions

uint get_attachment_limit ()
 
bool get_dirty ()
 
bool get_pending_clear ()
 
bool get_srgb_enabled ()
 
bool get_is_srgb ()
 
void default_size_set (int w, int h)
 
void attachment_set_loadstore_op (GPUAttachmentType type, GPULoadStore ls) override
 
bool set_color_attachment_clear_color (uint slot, const float clear_color[4])
 
bool set_depth_attachment_clear_value (float depth_clear)
 
bool set_stencil_attachment_clear_value (uint stencil_clear)
 
bool set_color_loadstore_op (uint slot, eGPULoadOp load_action, eGPUStoreOp store_action)
 
bool set_depth_loadstore_op (eGPULoadOp load_action, eGPUStoreOp store_action)
 
bool set_stencil_loadstore_op (eGPULoadOp load_action, eGPUStoreOp store_action)
 
bool reset_clear_state ()
 
void apply_state ()
 
void mark_dirty ()
 
void mark_loadstore_dirty ()
 
void mark_cleared ()
 
void mark_do_clear ()
 
void update_attachments (bool update_viewport)
 
bool add_color_attachment (gpu::MTLTexture *texture, uint slot, int miplevel, int layer)
 
bool add_depth_attachment (gpu::MTLTexture *texture, int miplevel, int layer)
 
bool add_stencil_attachment (gpu::MTLTexture *texture, int miplevel, int layer)
 
bool remove_color_attachment (uint slot)
 
bool remove_depth_attachment ()
 
bool remove_stencil_attachment ()
 
void remove_all_attachments ()
 
void ensure_render_target_size ()
 
bool has_attachment_at_slot (uint slot)
 
bool has_color_attachment_with_texture (gpu::MTLTexture *texture)
 
bool has_depth_attachment ()
 
bool has_stencil_attachment ()
 
int get_color_attachment_slot_from_texture (gpu::MTLTexture *texture)
 
uint get_attachment_count ()
 
MTLAttachment get_color_attachment (uint slot)
 
MTLAttachment get_depth_attachment ()
 
MTLAttachment get_stencil_attachment ()
 
bool validate_render_pass ()
 
MTLRenderPassDescriptor * bake_render_pass_descriptor (bool load_contents)
 
void blit (uint read_slot, uint src_x_offset, uint src_y_offset, MTLFrameBuffer *metal_fb_write, uint write_slot, uint dst_x_offset, uint dst_y_offset, uint width, uint height, eGPUFrameBufferBits blit_buffers)
 
int get_width ()
 
int get_height ()
 
int get_default_width ()
 
int get_default_height ()
 
- 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 ()
 

Creation & Deletion

 MTLFrameBuffer (MTLContext *ctx, const char *name)
 
 ~MTLFrameBuffer ()
 
void bind (bool enabled_srgb) override
 
bool check (char err_out[256]) override
 
void clear (eGPUFrameBufferBits buffers, const float clear_col[4], float clear_depth, uint clear_stencil) override
 
void clear_multi (const float(*clear_cols)[4]) override
 
void clear_attachment (GPUAttachmentType type, eGPUDataFormat data_format, const void *clear_value) override
 
void read (eGPUFrameBufferBits planes, eGPUDataFormat format, const int area[4], int channel_len, int slot, void *r_data) override
 
void blit_to (eGPUFrameBufferBits planes, int src_slot, FrameBuffer *dst, int dst_slot, int dst_offset_x, int dst_offset_y) override
 
void ensure_attachments_and_viewport ()
 
void subpass_transition_impl (const GPUAttachmentState, Span< GPUAttachmentState > color_attachment_states) 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

Implementation of FrameBuffer object using Metal.

Definition at line 46 of file mtl_framebuffer.hh.

Constructor & Destructor Documentation

◆ MTLFrameBuffer()

blender::gpu::MTLFrameBuffer::MTLFrameBuffer ( MTLContext * ctx,
const char * name )

◆ ~MTLFrameBuffer()

Member Function Documentation

◆ add_color_attachment()

◆ add_depth_attachment()

◆ add_stencil_attachment()

◆ apply_state()

◆ attachment_set_loadstore_op()

◆ bake_render_pass_descriptor()

◆ bind()

◆ blit()

◆ blit_to()

◆ check()

◆ clear()

◆ clear_attachment()

◆ clear_multi()

void blender::gpu::MTLFrameBuffer::clear_multi ( const float(*) clear_cols[4])
overridevirtual

◆ default_size_set()

void blender::gpu::MTLFrameBuffer::default_size_set ( int w,
int h )
inline

◆ ensure_attachments_and_viewport()

void blender::gpu::MTLFrameBuffer::ensure_attachments_and_viewport ( )

◆ ensure_render_target_size()

void blender::gpu::MTLFrameBuffer::ensure_render_target_size ( )

◆ get_attachment_count()

uint blender::gpu::MTLFrameBuffer::get_attachment_count ( )

Definition at line 1471 of file mtl_framebuffer.mm.

References BLI_assert.

Referenced by check().

◆ get_attachment_limit()

◆ get_color_attachment()

MTLAttachment blender::gpu::MTLFrameBuffer::get_color_attachment ( uint slot)

◆ get_color_attachment_slot_from_texture()

int blender::gpu::MTLFrameBuffer::get_color_attachment_slot_from_texture ( gpu::MTLTexture * texture)

Definition at line 1456 of file mtl_framebuffer.mm.

References BLI_assert, and get_attachment_limit().

◆ get_default_height()

int blender::gpu::MTLFrameBuffer::get_default_height ( )

◆ get_default_width()

int blender::gpu::MTLFrameBuffer::get_default_width ( )

◆ get_depth_attachment()

MTLAttachment blender::gpu::MTLFrameBuffer::get_depth_attachment ( )

◆ get_dirty()

bool blender::gpu::MTLFrameBuffer::get_dirty ( )
inline

◆ get_height()

int blender::gpu::MTLFrameBuffer::get_height ( )

◆ get_is_srgb()

bool blender::gpu::MTLFrameBuffer::get_is_srgb ( )
inline

◆ get_pending_clear()

bool blender::gpu::MTLFrameBuffer::get_pending_clear ( )
inline

◆ get_srgb_enabled()

bool blender::gpu::MTLFrameBuffer::get_srgb_enabled ( )
inline

◆ get_stencil_attachment()

MTLAttachment blender::gpu::MTLFrameBuffer::get_stencil_attachment ( )

◆ get_width()

int blender::gpu::MTLFrameBuffer::get_width ( )

◆ has_attachment_at_slot()

bool blender::gpu::MTLFrameBuffer::has_attachment_at_slot ( uint slot)

\ Fetch values and Frame-buffer status

Definition at line 1420 of file mtl_framebuffer.mm.

References BLI_assert, get_attachment_limit(), and blender::gpu::MTLAttachment::used.

Referenced by clear_attachment(), clear_multi(), read(), remove_color_attachment(), and update_attachments().

◆ has_color_attachment_with_texture()

bool blender::gpu::MTLFrameBuffer::has_color_attachment_with_texture ( gpu::MTLTexture * texture)

Definition at line 1430 of file mtl_framebuffer.mm.

References BLI_assert, and get_attachment_limit().

◆ has_depth_attachment()

bool blender::gpu::MTLFrameBuffer::has_depth_attachment ( )

◆ has_stencil_attachment()

bool blender::gpu::MTLFrameBuffer::has_stencil_attachment ( )

◆ mark_cleared()

void blender::gpu::MTLFrameBuffer::mark_cleared ( )

◆ mark_dirty()

void blender::gpu::MTLFrameBuffer::mark_dirty ( )

◆ mark_do_clear()

void blender::gpu::MTLFrameBuffer::mark_do_clear ( )

Definition at line 646 of file mtl_framebuffer.mm.

◆ mark_loadstore_dirty()

◆ read()

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

◆ remove_all_attachments()

◆ remove_color_attachment()

bool blender::gpu::MTLFrameBuffer::remove_color_attachment ( uint slot)

◆ remove_depth_attachment()

bool blender::gpu::MTLFrameBuffer::remove_depth_attachment ( )

◆ remove_stencil_attachment()

bool blender::gpu::MTLFrameBuffer::remove_stencil_attachment ( )

◆ reset_clear_state()

bool blender::gpu::MTLFrameBuffer::reset_clear_state ( )

◆ set_color_attachment_clear_color()

bool blender::gpu::MTLFrameBuffer::set_color_attachment_clear_color ( uint slot,
const float clear_color[4] )

◆ set_color_loadstore_op()

bool blender::gpu::MTLFrameBuffer::set_color_loadstore_op ( uint slot,
eGPULoadOp load_action,
eGPUStoreOp store_action )

◆ set_depth_attachment_clear_value()

◆ set_depth_loadstore_op()

bool blender::gpu::MTLFrameBuffer::set_depth_loadstore_op ( eGPULoadOp load_action,
eGPUStoreOp store_action )

◆ set_stencil_attachment_clear_value()

bool blender::gpu::MTLFrameBuffer::set_stencil_attachment_clear_value ( uint stencil_clear)

◆ set_stencil_loadstore_op()

bool blender::gpu::MTLFrameBuffer::set_stencil_loadstore_op ( eGPULoadOp load_action,
eGPUStoreOp store_action )

◆ subpass_transition_impl()

◆ update_attachments()

void blender::gpu::MTLFrameBuffer::update_attachments ( bool update_viewport)

Definition at line 651 of file mtl_framebuffer.mm.

References add_color_attachment(), add_depth_attachment(), add_stencil_attachment(), blender::gpu::FrameBuffer::attachments_, blender::gpu::MTLAttachment::clear_value, blender::gpu::MTLAttachment::color, blender::gpu::MTLAttachment::depth, blender::gpu::FrameBuffer::dirty_attachments_, get_color_attachment(), get_depth_attachment(), get_stencil_attachment(), GPU_DEPTH24_STENCIL8, GPU_DEPTH32F_STENCIL8, GPU_FB_COLOR_ATTACHMENT0, GPU_FB_COLOR_ATTACHMENT1, GPU_FB_COLOR_ATTACHMENT2, GPU_FB_COLOR_ATTACHMENT3, GPU_FB_COLOR_ATTACHMENT4, GPU_FB_COLOR_ATTACHMENT5, GPU_FB_COLOR_ATTACHMENT6, GPU_FB_COLOR_ATTACHMENT7, GPU_FB_DEPTH_ATTACHMENT, GPU_FB_DEPTH_STENCIL_ATTACHMENT, GPU_FB_MAX_ATTACHMENT, GPU_SRGB8_A8, GPU_texture_format(), GPU_texture_get_mipmap_size(), has_attachment_at_slot(), has_depth_attachment(), has_stencil_attachment(), GPUAttachment::layer, blender::gpu::MTLAttachment::load_action, GPUAttachment::mip, remove_all_attachments(), remove_color_attachment(), remove_depth_attachment(), remove_stencil_attachment(), set_color_attachment_clear_color(), set_color_loadstore_op(), set_depth_attachment_clear_value(), set_depth_loadstore_op(), set_stencil_attachment_clear_value(), set_stencil_loadstore_op(), blender::gpu::FrameBuffer::size_set(), blender::gpu::MTLAttachment::stencil, blender::gpu::MTLAttachment::store_action, GPUAttachment::tex, and blender::gpu::unwrap().

Referenced by clear(), ensure_attachments_and_viewport(), and validate_render_pass().

◆ validate_render_pass()

bool blender::gpu::MTLFrameBuffer::validate_render_pass ( )

\ METAL API Resources and Validation

Definition at line 1505 of file mtl_framebuffer.mm.

References BLI_assert, blender::gpu::FrameBuffer::dirty_attachments_, and update_attachments().


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