Blender  V3.3
Public Member Functions | List of all members
blender::gpu::MTLFrameBuffer Class Reference

#include <mtl_framebuffer.hh>

Inheritance diagram for blender::gpu::MTLFrameBuffer:
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 attachment_set_loadstore_op (GPUAttachmentType type, eGPULoadOp load_action, eGPUStoreOp store_action) 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 ()
 
- Public Member Functions inherited from blender::gpu::FrameBuffer
void size_set (int width, int height)
 
void viewport_set (const int viewport[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 ()
 
GPUTexturedepth_tex () const
 
GPUTexturecolor_tex (int slot) const
 
 FrameBuffer (const char *name)
 
virtual ~FrameBuffer ()
 
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 *userData, int level), void *userData)
 
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
 

Additional Inherited Members

- Public Attributes inherited from blender::gpu::FrameBuffer
void ** py_ref = nullptr
 
void ** ref = nullptr
 
- Protected Attributes inherited from blender::gpu::FrameBuffer
GPUAttachment attachments_ [GPU_FB_MAX_ATTACHMENT]
 
bool dirty_attachments_
 
int width_
 
int height_
 
char name_ [DEBUG_NAME_LEN]
 
int viewport_ [4] = {0}
 
int scissor_ [4] = {0}
 
bool scissor_test_ = false
 
bool dirty_state_ = true
 

Detailed Description

Implementation of FrameBuffer object using Metal.

Definition at line 44 of file mtl_framebuffer.hh.

Constructor & Destructor Documentation

◆ MTLFrameBuffer()

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

◆ ~MTLFrameBuffer()

blender::gpu::MTLFrameBuffer::~MTLFrameBuffer ( )

Member Function Documentation

◆ add_color_attachment()

bool blender::gpu::MTLFrameBuffer::add_color_attachment ( gpu::MTLTexture texture,
uint  slot,
int  miplevel,
int  layer 
)

◆ add_depth_attachment()

bool blender::gpu::MTLFrameBuffer::add_depth_attachment ( gpu::MTLTexture texture,
int  miplevel,
int  layer 
)

◆ add_stencil_attachment()

bool blender::gpu::MTLFrameBuffer::add_stencil_attachment ( gpu::MTLTexture texture,
int  miplevel,
int  layer 
)

◆ apply_state()

void blender::gpu::MTLFrameBuffer::apply_state ( )

◆ attachment_set_loadstore_op()

void blender::gpu::MTLFrameBuffer::attachment_set_loadstore_op ( GPUAttachmentType  type,
eGPULoadOp  load_action,
eGPUStoreOp  store_action 
)
overridevirtual

◆ bake_render_pass_descriptor()

MTLRenderPassDescriptor * blender::gpu::MTLFrameBuffer::bake_render_pass_descriptor ( bool  load_contents)

◆ bind()

void blender::gpu::MTLFrameBuffer::bind ( bool  enabled_srgb)
overridevirtual

◆ blit()

void blender::gpu::MTLFrameBuffer::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 
)

◆ blit_to()

void blender::gpu::MTLFrameBuffer::blit_to ( eGPUFrameBufferBits  planes,
int  src_slot,
FrameBuffer dst,
int  dst_slot,
int  dst_offset_x,
int  dst_offset_y 
)
overridevirtual

◆ check()

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

◆ clear()

void blender::gpu::MTLFrameBuffer::clear ( eGPUFrameBufferBits  buffers,
const float  clear_col[4],
float  clear_depth,
uint  clear_stencil 
)
overridevirtual

◆ clear_attachment()

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

◆ clear_multi()

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

◆ 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 1431 of file mtl_framebuffer.mm.

References BLI_assert.

Referenced by check(), and update_attachments().

◆ get_attachment_limit()

uint blender::gpu::MTLFrameBuffer::get_attachment_limit ( )
inline

◆ 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 1417 of file mtl_framebuffer.mm.

References BLI_assert, and get_attachment_limit().

◆ get_depth_attachment()

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

Definition at line 1448 of file mtl_framebuffer.mm.

References BLI_assert.

Referenced by blit(), blit_to(), check(), read(), and update_attachments().

◆ get_dirty()

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

◆ get_height()

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

Definition at line 1894 of file mtl_framebuffer.mm.

References blender::gpu::FrameBuffer::height_.

◆ get_is_srgb()

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

Definition at line 221 of file mtl_framebuffer.hh.

Referenced by bake_render_pass_descriptor().

◆ get_pending_clear()

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

◆ get_srgb_enabled()

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

Definition at line 216 of file mtl_framebuffer.hh.

Referenced by bake_render_pass_descriptor().

◆ get_stencil_attachment()

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

Definition at line 1454 of file mtl_framebuffer.mm.

References BLI_assert.

Referenced by blit(), blit_to(), check(), and update_attachments().

◆ get_width()

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

Definition at line 1890 of file mtl_framebuffer.mm.

References blender::gpu::FrameBuffer::width_.

◆ has_attachment_at_slot()

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

\ Fetch values and Framebuffer status

Definition at line 1382 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 1392 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 599 of file mtl_framebuffer.mm.

◆ mark_loadstore_dirty()

void blender::gpu::MTLFrameBuffer::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()

void blender::gpu::MTLFrameBuffer::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()

bool blender::gpu::MTLFrameBuffer::set_depth_attachment_clear_value ( float  depth_clear)

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

◆ update_attachments()

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

Definition at line 604 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_, blender::gpu::Texture::format_get(), get_attachment_count(), 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_DEPTH_ATTACHMENT, GPU_FB_DEPTH_STENCIL_ATTACHMENT, GPU_FB_MAX_ATTACHMENT, GPU_SRGB8_A8, GPU_texture_format(), has_attachment_at_slot(), has_depth_attachment(), has_stencil_attachment(), blender::gpu::FrameBuffer::height_, GPUAttachment::layer, blender::gpu::MTLAttachment::load_action, GPUAttachment::mip, remove_all_attachments(), remove_color_attachment(), remove_depth_attachment(), remove_stencil_attachment(), blender::gpu::FrameBuffer::scissor_get(), blender::gpu::FrameBuffer::scissor_reset(), blender::gpu::FrameBuffer::scissor_set(), 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::MTLAttachment::stencil, blender::gpu::MTLAttachment::store_action, GPUAttachment::tex, blender::gpu::MTLAttachment::texture, type, blender::gpu::unwrap(), blender::gpu::FrameBuffer::viewport_get(), blender::gpu::FrameBuffer::viewport_reset(), blender::gpu::FrameBuffer::viewport_set(), and blender::gpu::FrameBuffer::width_.

Referenced by bind(), blit_to(), check(), clear(), and validate_render_pass().

◆ validate_render_pass()

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

\ METAL API Resources and Validation

Definition at line 1465 of file mtl_framebuffer.mm.

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


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