18#include <Metal/Metal.h>
52 uint colour_attachment_count_;
56 bool use_multilayered_rendering_ =
false;
67 bool is_loadstore_dirty_;
80 bool has_pending_clear_;
93 MTL_FB_CONFIG_CLEAR = 0,
94 MTL_FB_CONFIG_LOAD = 1,
95 MTL_FB_CONFIG_CUSTOM = 2
97#define MTL_FB_CONFIG_MAX (MTL_FB_CONFIG_CUSTOM + 1)
100 MTLRenderPassColorAttachmentDescriptor
116 int default_width_ = 0;
117 int default_height_ = 0;
127 void bind(
bool enabled_srgb)
override;
129 bool check(
char err_out[256])
override;
132 const float clear_col[4],
134 uint clear_stencil)
override;
135 void clear_multi(
const float (*clear_cols)[4])
override;
138 const void *clear_value)
override;
147 void *r_data)
override;
154 int dst_offset_y)
override;
158 Span<GPUAttachmentState> color_attachment_states)
override;
235 return is_dirty_ || is_loadstore_dirty_;
240 return has_pending_clear_;
245 return enabled_srgb_;
263 MEM_CXX_CLASS_ALLOC_FUNCS(
"MTLFrameBuffer");
Read Guarded memory(de)allocation.
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
FrameBuffer(const char *name)
bool remove_stencil_attachment()
bool set_depth_loadstore_op(eGPULoadOp load_action, eGPUStoreOp store_action)
MTLAttachment get_color_attachment(uint slot)
bool remove_color_attachment(uint slot)
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)
void read(eGPUFrameBufferBits planes, eGPUDataFormat format, const int area[4], int channel_len, int slot, void *r_data) override
void remove_all_attachments()
int get_color_attachment_slot_from_texture(gpu::MTLTexture *texture)
void blit_to(eGPUFrameBufferBits planes, int src_slot, FrameBuffer *dst, int dst_slot, int dst_offset_x, int dst_offset_y) override
void default_size_set(int w, int h)
bool remove_depth_attachment()
bool check(char err_out[256]) override
bool add_color_attachment(gpu::MTLTexture *texture, uint slot, int miplevel, int layer)
bool set_color_attachment_clear_color(uint slot, const float clear_color[4])
MTLFrameBuffer(MTLContext *ctx, const char *name)
bool set_depth_attachment_clear_value(float depth_clear)
void update_attachments(bool update_viewport)
void ensure_render_target_size()
MTLAttachment get_stencil_attachment()
void ensure_attachments_and_viewport()
MTLRenderPassDescriptor * bake_render_pass_descriptor(bool load_contents)
bool has_color_attachment_with_texture(gpu::MTLTexture *texture)
MTLAttachment get_depth_attachment()
void clear_multi(const float(*clear_cols)[4]) override
bool set_stencil_loadstore_op(eGPULoadOp load_action, eGPUStoreOp store_action)
bool set_color_loadstore_op(uint slot, eGPULoadOp load_action, eGPUStoreOp store_action)
uint get_attachment_limit()
bool add_depth_attachment(gpu::MTLTexture *texture, int miplevel, int layer)
void attachment_set_loadstore_op(GPUAttachmentType type, GPULoadStore ls) override
bool validate_render_pass()
bool set_stencil_attachment_clear_value(uint stencil_clear)
bool add_stencil_attachment(gpu::MTLTexture *texture, int miplevel, int layer)
bool has_stencil_attachment()
bool has_attachment_at_slot(uint slot)
void clear_attachment(GPUAttachmentType type, eGPUDataFormat data_format, const void *clear_value) override
void mark_loadstore_dirty()
void clear(eGPUFrameBufferBits buffers, const float clear_col[4], float clear_depth, uint clear_stencil) override
void bind(bool enabled_srgb) override
void subpass_transition_impl(const GPUAttachmentState, Span< GPUAttachmentState > color_attachment_states) override
uint get_attachment_count()
bool has_depth_attachment()
#define GPU_FB_MAX_COLOR_ATTACHMENT
#define MTL_FB_CONFIG_MAX
gpu::MTLTexture * texture
uint render_target_array_length
union blender::gpu::MTLAttachment::@650 clear_value