Blender  V3.3
Classes | Namespaces
gpu_framebuffer.cc File Reference
#include "MEM_guardedalloc.h"
#include "BLI_math_base.h"
#include "BLI_utildefines.h"
#include "GPU_batch.h"
#include "GPU_capabilities.h"
#include "GPU_shader.h"
#include "GPU_texture.h"
#include "gpu_backend.hh"
#include "gpu_context_private.hh"
#include "gpu_texture_private.hh"
#include "gpu_framebuffer_private.hh"

Go to the source code of this file.

Classes

struct  GPUOffScreen
 

Namespaces

 blender
 
 blender::gpu
 

Functions

C-API
GPUFrameBufferGPU_framebuffer_create (const char *name)
 
void GPU_framebuffer_free (GPUFrameBuffer *gpu_fb)
 
void GPU_framebuffer_bind (GPUFrameBuffer *gpu_fb)
 
void GPU_framebuffer_bind_loadstore (GPUFrameBuffer *gpu_fb, const GPULoadStore *load_store_actions, uint actions_len)
 
void GPU_framebuffer_bind_no_srgb (GPUFrameBuffer *gpu_fb)
 
void GPU_backbuffer_bind (eGPUBackBuffer buffer)
 
void GPU_framebuffer_restore ()
 
GPUFrameBufferGPU_framebuffer_active_get ()
 
GPUFrameBufferGPU_framebuffer_back_get ()
 
bool GPU_framebuffer_bound (GPUFrameBuffer *gpu_fb)
 
bool GPU_framebuffer_check_valid (GPUFrameBuffer *gpu_fb, char err_out[256])
 
void GPU_framebuffer_texture_attach_ex (GPUFrameBuffer *gpu_fb, GPUAttachment attachment, int slot)
 
void GPU_framebuffer_texture_attach (GPUFrameBuffer *fb, GPUTexture *tex, int slot, int mip)
 
void GPU_framebuffer_texture_layer_attach (GPUFrameBuffer *fb, GPUTexture *tex, int slot, int layer, int mip)
 
void GPU_framebuffer_texture_cubeface_attach (GPUFrameBuffer *fb, GPUTexture *tex, int slot, int face, int mip)
 
void GPU_framebuffer_texture_detach (GPUFrameBuffer *fb, GPUTexture *tex)
 
void GPU_framebuffer_config_array (GPUFrameBuffer *gpu_fb, const GPUAttachment *config, int config_len)
 
void GPU_framebuffer_viewport_set (GPUFrameBuffer *gpu_fb, int x, int y, int width, int height)
 
void GPU_framebuffer_viewport_get (GPUFrameBuffer *gpu_fb, int r_viewport[4])
 
void GPU_framebuffer_viewport_reset (GPUFrameBuffer *gpu_fb)
 
void GPU_framebuffer_clear (GPUFrameBuffer *gpu_fb, eGPUFrameBufferBits buffers, const float clear_col[4], float clear_depth, uint clear_stencil)
 
void GPU_framebuffer_multi_clear (GPUFrameBuffer *gpu_fb, const float(*clear_cols)[4])
 
void GPU_clear_color (float red, float green, float blue, float alpha)
 
void GPU_clear_depth (float depth)
 
void GPU_framebuffer_read_depth (GPUFrameBuffer *gpu_fb, int x, int y, int w, int h, eGPUDataFormat format, void *data)
 
void GPU_framebuffer_read_color (GPUFrameBuffer *gpu_fb, int x, int y, int w, int h, int channels, int slot, eGPUDataFormat format, void *data)
 
void GPU_frontbuffer_read_pixels (int x, int y, int w, int h, int channels, eGPUDataFormat format, void *data)
 
void GPU_framebuffer_blit (GPUFrameBuffer *gpufb_read, int read_slot, GPUFrameBuffer *gpufb_write, int write_slot, eGPUFrameBufferBits blit_buffers)
 
void GPU_framebuffer_recursive_downsample (GPUFrameBuffer *gpu_fb, int max_lvl, void(*callback)(void *userData, int level), void *userData)
 
void ** GPU_framebuffer_py_reference_get (GPUFrameBuffer *gpu_fb)
 
void GPU_framebuffer_py_reference_set (GPUFrameBuffer *gpu_fb, void **py_ref)
 

Frame-Buffer Stack

Keeps track of frame-buffer binding operation to restore previously bound frame-buffers.

#define FRAMEBUFFER_STACK_DEPTH   16
 
struct {
   GPUFrameBuffer *   framebuffers [FRAMEBUFFER_STACK_DEPTH]
 
   uint   top
 
FrameBufferStack = {{nullptr}}
 
void GPU_framebuffer_push (GPUFrameBuffer *fb)
 
GPUFrameBufferGPU_framebuffer_pop ()
 
uint GPU_framebuffer_stack_level_get ()
 

GPUOffScreen

Container that holds a frame-buffer and its textures. Might be bound to multiple contexts.

#define MAX_CTX_FB_LEN   3
 
static GPUFrameBuffergpu_offscreen_fb_get (GPUOffScreen *ofs)
 
GPUOffScreenGPU_offscreen_create (int width, int height, bool depth, eGPUTextureFormat format, char err_out[256])
 
void GPU_offscreen_free (GPUOffScreen *ofs)
 
void GPU_offscreen_bind (GPUOffScreen *ofs, bool save)
 
void GPU_offscreen_unbind (GPUOffScreen *UNUSED(ofs), bool restore)
 
void GPU_offscreen_draw_to_screen (GPUOffScreen *ofs, int x, int y)
 
void GPU_offscreen_read_pixels (GPUOffScreen *ofs, eGPUDataFormat format, void *pixels)
 
int GPU_offscreen_width (const GPUOffScreen *ofs)
 
int GPU_offscreen_height (const GPUOffScreen *ofs)
 
GPUTextureGPU_offscreen_color_texture (const GPUOffScreen *ofs)
 
void GPU_offscreen_viewport_data_get (GPUOffScreen *ofs, GPUFrameBuffer **r_fb, GPUTexture **r_color, GPUTexture **r_depth)
 

Macro Definition Documentation

◆ FRAMEBUFFER_STACK_DEPTH

#define FRAMEBUFFER_STACK_DEPTH   16

Definition at line 515 of file gpu_framebuffer.cc.

◆ MAX_CTX_FB_LEN

#define MAX_CTX_FB_LEN   3

Definition at line 552 of file gpu_framebuffer.cc.

Function Documentation

◆ GPU_backbuffer_bind()

void GPU_backbuffer_bind ( eGPUBackBuffer  buffer)

◆ GPU_clear_color()

void GPU_clear_color ( float  red,
float  green,
float  blue,
float  alpha 
)

◆ GPU_clear_depth()

void GPU_clear_depth ( float  depth)

◆ GPU_framebuffer_active_get()

GPUFrameBuffer* GPU_framebuffer_active_get ( void  )

◆ GPU_framebuffer_back_get()

GPUFrameBuffer* GPU_framebuffer_back_get ( void  )

◆ GPU_framebuffer_bind()

void GPU_framebuffer_bind ( GPUFrameBuffer gpu_fb)

Definition at line 243 of file gpu_framebuffer.cc.

References blender::gpu::unwrap().

Referenced by blender::eevee::Film::accumulate(), blender::gpu::MTLTexture::clear(), blender::gpu::GLTexture::clear(), blender::eevee::Film::display(), dof_dilate_tiles_pass_draw(), blender::draw::image_engine::ScreenSpaceDrawingMode< TextureMethod >::draw_scene(), draw_timeline_seq(), DRW_curves_update(), DRW_draw_callbacks_post_scene(), DRW_draw_depth_loop(), DRW_draw_depth_object(), DRW_draw_render_loop_2d_ex(), DRW_draw_render_loop_ex(), DRW_draw_select_loop(), drw_engines_draw_scene(), DRW_hair_update(), DRW_select_buffer_read(), ED_region_do_draw(), ED_view3d_draw_offscreen_imbuf(), EEVEE_bloom_draw(), EEVEE_bloom_output_accumulate(), EEVEE_create_minmax_buffer(), EEVEE_cryptomatte_output_accumulate(), EEVEE_depth_of_field_draw(), eevee_draw_scene(), EEVEE_effects_downsample_radiance_buffer(), EEVEE_lightbake_filter_diffuse(), EEVEE_lightbake_filter_glossy(), EEVEE_lightbake_filter_visibility(), eevee_lightbake_render_world_sample(), EEVEE_lookdev_draw(), EEVEE_lut_update_ggx_brdf(), EEVEE_lut_update_ggx_btdf(), EEVEE_material_output_accumulate(), EEVEE_mist_output_accumulate(), EEVEE_motion_blur_cache_finish(), EEVEE_motion_blur_draw(), EEVEE_occlusion_compute(), EEVEE_occlusion_draw_debug(), EEVEE_occlusion_output_accumulate(), EEVEE_reflection_compute(), EEVEE_reflection_output_accumulate(), EEVEE_refraction_compute(), eevee_render_color_result(), EEVEE_render_draw(), eevee_render_draw_background(), EEVEE_renderpasses_draw(), EEVEE_renderpasses_postprocess(), EEVEE_shadow_output_accumulate(), EEVEE_shadows_draw_cascades(), EEVEE_shadows_draw_cubemap(), EEVEE_subsurface_compute(), EEVEE_subsurface_data_render(), EEVEE_subsurface_output_accumulate(), EEVEE_subsurface_output_init(), EEVEE_temporal_sampling_draw(), EEVEE_update_noise(), EEVEE_velocity_resolve(), EEVEE_volumes_compute(), EEVEE_volumes_output_accumulate(), EEVEE_volumes_resolve(), external_draw_scene(), gizmo_find_intersected_3d(), GPENCIL_antialiasing_draw(), gpencil_draw_mask(), GPENCIL_draw_object(), GPENCIL_draw_scene(), GPENCIL_draw_scene_depth_only(), GPENCIL_render_init(), GPENCIL_render_result_combined(), GPU_framebuffer_bind_loadstore(), GPU_offscreen_unbind(), GPU_viewport_stereo_composite(), lightbake_render_scene_face(), lightbake_render_scene_reflected(), lightbake_render_world_face(), material_renderpass_accumulate(), OVERLAY_antialiasing_end(), OVERLAY_antialiasing_start(), OVERLAY_draw_scene(), OVERLAY_edit_curve_draw(), OVERLAY_edit_lattice_draw(), OVERLAY_edit_mesh_draw(), OVERLAY_edit_particle_draw(), OVERLAY_edit_text_draw(), OVERLAY_edit_uv_draw(), OVERLAY_image_scene_background_draw(), OVERLAY_outline_draw(), OVERLAY_paint_draw(), OVERLAY_pose_draw(), OVERLAY_sculpt_curves_draw(), OVERLAY_sculpt_draw(), OVERLAY_xray_depth_copy(), pygpu_framebuffer_stack_pop_and_restore_or_error(), pygpu_framebuffer_stack_push_and_bind_or_error(), blender::eevee::ShadingView::render(), blender::eevee::ForwardPipeline::render(), select_cache_init(), select_draw_scene(), sequencer_draw_preview(), sequencer_ibuf_get(), view3d_opengl_read_Z_pixels(), workbench_antialiasing_draw_pass(), workbench_dof_draw_pass(), workbench_draw_sample(), workbench_render(), workbench_render_result_z(), workbench_transparent_draw_depth_pass(), and workbench_volume_draw_pass().

◆ GPU_framebuffer_bind_loadstore()

void GPU_framebuffer_bind_loadstore ( GPUFrameBuffer gpu_fb,
const GPULoadStore load_store_actions,
uint  actions_len 
)

Definition at line 249 of file gpu_framebuffer.cc.

References fb(), GPU_framebuffer_bind(), and blender::gpu::unwrap().

◆ GPU_framebuffer_bind_no_srgb()

void GPU_framebuffer_bind_no_srgb ( GPUFrameBuffer fb)

Workaround for binding a SRGB frame-buffer without doing the SRGB transform.

Definition at line 261 of file gpu_framebuffer.cc.

References blender::gpu::unwrap().

Referenced by blender::ed::space_node::draw_nodespace_back_pix(), draw_timeline_seq(), blender::ed::space_node::node_draw_space(), and sequencer_draw_preview().

◆ GPU_framebuffer_blit()

void GPU_framebuffer_blit ( GPUFrameBuffer gpufb_read,
int  read_slot,
GPUFrameBuffer gpufb_write,
int  write_slot,
eGPUFrameBufferBits  blit_buffers 
)

◆ GPU_framebuffer_bound()

bool GPU_framebuffer_bound ( GPUFrameBuffer gpu_fb)

◆ GPU_framebuffer_check_valid()

bool GPU_framebuffer_check_valid ( GPUFrameBuffer gpu_fb,
char  err_out[256] 
)

◆ GPU_framebuffer_clear()

void GPU_framebuffer_clear ( GPUFrameBuffer gpu_fb,
eGPUFrameBufferBits  buffers,
const float  clear_col[4],
float  clear_depth,
uint  clear_stencil 
)

Definition at line 391 of file gpu_framebuffer.cc.

References blender::gpu::unwrap().

Referenced by draw_shgroup(), eevee_draw_scene(), and pygpu_framebuffer_clear().

◆ GPU_framebuffer_config_array()

void GPU_framebuffer_config_array ( GPUFrameBuffer gpu_fb,
const GPUAttachment config,
int  config_len 
)

◆ GPU_framebuffer_create()

GPUFrameBuffer* GPU_framebuffer_create ( const char *  name)

◆ GPU_framebuffer_free()

void GPU_framebuffer_free ( GPUFrameBuffer gpu_fb)

◆ GPU_framebuffer_multi_clear()

void GPU_framebuffer_multi_clear ( GPUFrameBuffer gpu_fb,
const float(*)  clear_cols[4] 
)

Definition at line 400 of file gpu_framebuffer.cc.

References blender::gpu::unwrap().

Referenced by GPENCIL_draw_object(), and GPENCIL_draw_scene().

◆ GPU_framebuffer_pop()

GPUFrameBuffer* GPU_framebuffer_pop ( )

◆ GPU_framebuffer_push()

void GPU_framebuffer_push ( GPUFrameBuffer fb)

◆ GPU_framebuffer_py_reference_get()

void** GPU_framebuffer_py_reference_get ( GPUFrameBuffer gpu_fb)

Definition at line 495 of file gpu_framebuffer.cc.

References blender::gpu::unwrap().

Referenced by BPyGPUFrameBuffer_CreatePyObject().

◆ GPU_framebuffer_py_reference_set()

void GPU_framebuffer_py_reference_set ( GPUFrameBuffer gpu_fb,
void **  py_ref 
)

◆ GPU_framebuffer_read_color()

void GPU_framebuffer_read_color ( GPUFrameBuffer gpu_fb,
int  x,
int  y,
int  w,
int  h,
int  channels,
int  slot,
eGPUDataFormat  format,
void data 
)

◆ GPU_framebuffer_read_depth()

void GPU_framebuffer_read_depth ( GPUFrameBuffer gpu_fb,
int  x,
int  y,
int  w,
int  h,
eGPUDataFormat  format,
void data 
)

◆ GPU_framebuffer_recursive_downsample()

void GPU_framebuffer_recursive_downsample ( GPUFrameBuffer gpu_fb,
int  max_lvl,
void(*)(void *userData, int level)  callback,
void userData 
)

◆ GPU_framebuffer_restore()

void GPU_framebuffer_restore ( void  )

◆ GPU_framebuffer_stack_level_get()

uint GPU_framebuffer_stack_level_get ( )

◆ GPU_framebuffer_texture_attach()

void GPU_framebuffer_texture_attach ( GPUFrameBuffer fb,
GPUTexture tex,
int  slot,
int  mip 
)

◆ GPU_framebuffer_texture_attach_ex()

void GPU_framebuffer_texture_attach_ex ( GPUFrameBuffer gpu_fb,
GPUAttachment  attachment,
int  slot 
)

◆ GPU_framebuffer_texture_cubeface_attach()

void GPU_framebuffer_texture_cubeface_attach ( GPUFrameBuffer fb,
GPUTexture tex,
int  slot,
int  face,
int  mip 
)

Definition at line 328 of file gpu_framebuffer.cc.

References fb(), GPU_framebuffer_texture_attach_ex(), and tex.

◆ GPU_framebuffer_texture_detach()

void GPU_framebuffer_texture_detach ( GPUFrameBuffer fb,
GPUTexture tex 
)

◆ GPU_framebuffer_texture_layer_attach()

void GPU_framebuffer_texture_layer_attach ( GPUFrameBuffer fb,
GPUTexture tex,
int  slot,
int  layer,
int  mip 
)

◆ GPU_framebuffer_viewport_get()

void GPU_framebuffer_viewport_get ( GPUFrameBuffer gpu_fb,
int  r_viewport[4] 
)

Definition at line 379 of file gpu_framebuffer.cc.

References blender::gpu::unwrap().

Referenced by pygpu_framebuffer_viewport_get().

◆ GPU_framebuffer_viewport_reset()

void GPU_framebuffer_viewport_reset ( GPUFrameBuffer gpu_fb)

◆ GPU_framebuffer_viewport_set()

void GPU_framebuffer_viewport_set ( GPUFrameBuffer gpu_fb,
int  x,
int  y,
int  width,
int  height 
)

◆ GPU_frontbuffer_read_pixels()

void GPU_frontbuffer_read_pixels ( int  x,
int  y,
int  w,
int  h,
int  channels,
eGPUDataFormat  format,
void data 
)

◆ GPU_offscreen_bind()

void GPU_offscreen_bind ( GPUOffScreen ofs,
bool  save 
)

◆ GPU_offscreen_color_texture()

GPUTexture* GPU_offscreen_color_texture ( const GPUOffScreen ofs)

◆ GPU_offscreen_create()

GPUOffScreen* GPU_offscreen_create ( int  width,
int  height,
bool  depth,
eGPUTextureFormat  format,
char  err_out[256] 
)

◆ GPU_offscreen_draw_to_screen()

void GPU_offscreen_draw_to_screen ( GPUOffScreen ofs,
int  x,
int  y 
)

◆ gpu_offscreen_fb_get()

static GPUFrameBuffer* gpu_offscreen_fb_get ( GPUOffScreen ofs)
static

◆ GPU_offscreen_free()

void GPU_offscreen_free ( GPUOffScreen ofs)

◆ GPU_offscreen_height()

int GPU_offscreen_height ( const GPUOffScreen ofs)

◆ GPU_offscreen_read_pixels()

void GPU_offscreen_read_pixels ( GPUOffScreen ofs,
eGPUDataFormat  format,
void pixels 
)

◆ GPU_offscreen_unbind()

void GPU_offscreen_unbind ( GPUOffScreen UNUSEDofs,
bool  restore 
)

◆ GPU_offscreen_viewport_data_get()

void GPU_offscreen_viewport_data_get ( GPUOffScreen ofs,
GPUFrameBuffer **  r_fb,
GPUTexture **  r_color,
GPUTexture **  r_depth 
)

◆ GPU_offscreen_width()

int GPU_offscreen_width ( const GPUOffScreen ofs)

Variable Documentation

◆ framebuffers

Definition at line 518 of file gpu_framebuffer.cc.

◆ 

struct { ... } FrameBufferStack

◆ top

uint top

Definition at line 519 of file gpu_framebuffer.cc.