Blender V4.3
GPU_framebuffer.hh File Reference
#include "GPU_common_types.hh"
#include "GPU_texture.hh"

Go to the source code of this file.

Classes

struct  GPUAttachment
 
struct  GPULoadStore
 

Macros

#define GPU_MAX_VIEWPORTS   16
 

Enumerations

enum  eGPUFrameBufferBits { GPU_COLOR_BIT = (1 << 0) , GPU_DEPTH_BIT = (1 << 1) , GPU_STENCIL_BIT = (1 << 2) }
 

Functions

Creation
GPUFrameBuffer * GPU_framebuffer_create (const char *name)
 
GPUFrameBuffer * GPU_framebuffer_active_get ()
 
GPUFrameBuffer * GPU_framebuffer_back_get ()
 
Empty frame-buffer

An empty frame-buffer is a frame-buffer with no attachments. This allow to rasterize geometry without creating any dummy attachments and write some computation results using other means (SSBOs, Images).

void GPU_framebuffer_default_size (GPUFrameBuffer *framebuffer, int width, int height)
 
Internal state
void GPU_framebuffer_viewport_set (GPUFrameBuffer *framebuffer, int x, int y, int width, int height)
 
void GPU_framebuffer_multi_viewports_set (GPUFrameBuffer *gpu_fb, const int viewport_rects[GPU_MAX_VIEWPORTS][4])
 
void GPU_framebuffer_viewport_get (GPUFrameBuffer *framebuffer, int r_viewport[4])
 
void GPU_framebuffer_viewport_reset (GPUFrameBuffer *framebuffer)
 
Clearing
void GPU_framebuffer_clear (GPUFrameBuffer *framebuffer, eGPUFrameBufferBits buffers, const float clear_col[4], float clear_depth, unsigned int clear_stencil)
 
void GPU_framebuffer_clear_color (GPUFrameBuffer *fb, const float clear_col[4])
 
void GPU_framebuffer_clear_depth (GPUFrameBuffer *fb, float clear_depth)
 
void GPU_framebuffer_clear_stencil (GPUFrameBuffer *fb, uint clear_stencil)
 
void GPU_framebuffer_clear_color_depth (GPUFrameBuffer *fb, const float clear_col[4], float clear_depth)
 
void GPU_framebuffer_clear_depth_stencil (GPUFrameBuffer *fb, float clear_depth, uint clear_stencil)
 
void GPU_framebuffer_clear_color_depth_stencil (GPUFrameBuffer *fb, const float clear_col[4], float clear_depth, uint clear_stencil)
 
void GPU_framebuffer_multi_clear (GPUFrameBuffer *framebuffer, const float(*clear_colors)[4])
 
void GPU_clear_color (float red, float green, float blue, float alpha)
 
void GPU_clear_depth (float depth)
 
Debugging introspection API.
const char * GPU_framebuffer_get_name (GPUFrameBuffer *framebuffer)
 
Python API & meta-data

These are not intrinsic properties of a frame-buffer but they are stored inside the gpu::FrameBuffer structure for tracking purpose.

void ** GPU_framebuffer_py_reference_get (GPUFrameBuffer *framebuffer)
 
void GPU_framebuffer_py_reference_set (GPUFrameBuffer *framebuffer, void **py_ref)
 
void GPU_framebuffer_push (GPUFrameBuffer *framebuffer)
 
GPUFrameBuffer * GPU_framebuffer_pop ()
 
uint GPU_framebuffer_stack_level_get ()
 
Deprecated
bool GPU_framebuffer_bound (GPUFrameBuffer *framebuffer)
 
void GPU_framebuffer_read_depth (GPUFrameBuffer *framebuffer, int x, int y, int width, int height, eGPUDataFormat data_format, void *r_data)
 
void GPU_framebuffer_read_color (GPUFrameBuffer *framebuffer, int x, int y, int width, int height, int channels, int slot, eGPUDataFormat data_format, void *r_data)
 
void GPU_frontbuffer_read_color (int x, int y, int width, int height, int channels, eGPUDataFormat data_format, void *r_data)
 
void GPU_framebuffer_blit (GPUFrameBuffer *fb_read, int read_slot, GPUFrameBuffer *fb_write, int write_slot, eGPUFrameBufferBits blit_buffers)
 
void GPU_framebuffer_recursive_downsample (GPUFrameBuffer *framebuffer, int max_level, void(*per_level_callback)(void *user_data, int level), void *user_data)
 
GPU OffScreen

A GPUOffScreen is a convenience type that holds a GPUFramebuffer and its associated GPUTextures. It is useful for quick drawing surface configuration. NOTE: They are still limited by the same single context limitation as #GPUFrameBuffer.

GPUOffScreenGPU_offscreen_create (int width, int height, bool with_depth_buffer, eGPUTextureFormat format, eGPUTextureUsage usage, char err_out[256])
 
void GPU_offscreen_free (GPUOffScreen *offscreen)
 
void GPU_offscreen_bind (GPUOffScreen *offscreen, bool save)
 
void GPU_offscreen_unbind (GPUOffScreen *offscreen, bool restore)
 
void GPU_offscreen_read_color (GPUOffScreen *offscreen, eGPUDataFormat data_format, void *r_data)
 
void GPU_offscreen_read_color_region (GPUOffScreen *offscreen, eGPUDataFormat data_format, int x, int y, int w, int h, void *r_data)
 
void GPU_offscreen_draw_to_screen (GPUOffScreen *offscreen, int x, int y)
 
int GPU_offscreen_width (const GPUOffScreen *offscreen)
 
int GPU_offscreen_height (const GPUOffScreen *offscreen)
 
GPUTexture * GPU_offscreen_color_texture (const GPUOffScreen *offscreen)
 
eGPUTextureFormat GPU_offscreen_format (const GPUOffScreen *offscreen)
 
void GPU_offscreen_viewport_data_get (GPUOffScreen *offscreen, GPUFrameBuffer **r_fb, GPUTexture **r_color, GPUTexture **r_depth)
 

Free

#define GPU_FRAMEBUFFER_FREE_SAFE(fb)
 
void GPU_framebuffer_free (GPUFrameBuffer *framebuffer)
 

Advanced binding control

#define NULL_ATTACHMENT_COLOR
 
#define NULL_LOAD_STORE
 
#define GPU_framebuffer_bind_ex(_fb, ...)
 
#define GPU_framebuffer_subpass_transition(_fb, ...)
 
void GPU_framebuffer_bind_loadstore (GPUFrameBuffer *framebuffer, const GPULoadStore *load_store_actions, uint load_store_actions_len)
 
void GPU_framebuffer_subpass_transition_array (GPUFrameBuffer *framebuffer, const GPUAttachmentState *attachment_states, uint attachment_len)
 

Attachments

#define GPU_framebuffer_ensure_config(_fb, ...)
 
#define GPU_ATTACHMENT_NONE
 
#define GPU_ATTACHMENT_LEAVE
 
#define GPU_ATTACHMENT_TEXTURE(_texture)
 
#define GPU_ATTACHMENT_TEXTURE_MIP(_texture, _mip)
 
#define GPU_ATTACHMENT_TEXTURE_LAYER(_texture, _layer)
 
#define GPU_ATTACHMENT_TEXTURE_LAYER_MIP(_texture, _layer, _mip)
 
#define GPU_ATTACHMENT_TEXTURE_CUBEFACE(_texture, _face)
 
#define GPU_ATTACHMENT_TEXTURE_CUBEFACE_MIP(_texture, _face, _mip)
 
void GPU_framebuffer_config_array (GPUFrameBuffer *framebuffer, const GPUAttachment *config, int config_len)
 
void GPU_framebuffer_texture_attach (GPUFrameBuffer *framebuffer, GPUTexture *texture, int slot, int mip)
 
void GPU_framebuffer_texture_layer_attach (GPUFrameBuffer *framebuffer, GPUTexture *texture, int slot, int layer, int mip)
 
void GPU_framebuffer_texture_cubeface_attach (GPUFrameBuffer *framebuffer, GPUTexture *texture, int slot, int face, int mip)
 
void GPU_framebuffer_texture_detach (GPUFrameBuffer *framebuffer, GPUTexture *texture)
 
bool GPU_framebuffer_check_valid (GPUFrameBuffer *framebuffer, char err_out[256])
 

Binding

enum  eGPUBackBuffer { GPU_BACKBUFFER_LEFT = 0 , GPU_BACKBUFFER_RIGHT }
 
void GPU_backbuffer_bind (eGPUBackBuffer back_buffer_type)
 
void GPU_framebuffer_bind (GPUFrameBuffer *framebuffer)
 
void GPU_framebuffer_bind_no_srgb (GPUFrameBuffer *framebuffer)
 
void GPU_framebuffer_restore ()
 

Detailed Description

A GPUFramebuffer is a wrapper for a frame-buffer object (FBO) from the underlying graphic API.

A GPUFramebuffer is limited to one context and thus cannot be shared across different contexts. In the case this is needed, one must recreate the same GPUFramebuffer in each context.

Note that actual FBO creation & config is deferred until GPU_framebuffer_bind or GPU_framebuffer_check_valid is called. This means the context the GPUFramebuffer is bound with is the one active when GPU_framebuffer_bind is called.

When a GPUTexture is attached to a GPUFramebuffer a reference is created. Deleting either does not require any unbinding.

A GPUOffScreen is a convenience type that holds a GPUFramebuffer and its associated GPUTextures. It is useful for quick drawing surface configuration.

Definition in file GPU_framebuffer.hh.

Macro Definition Documentation

◆ GPU_ATTACHMENT_LEAVE

#define GPU_ATTACHMENT_LEAVE
Value:
{ \
nullptr, -1, -1, \
}

Leave currently bound texture in this slot. DEPRECATED: Specify all textures for clarity.

Definition at line 268 of file GPU_framebuffer.hh.

◆ GPU_ATTACHMENT_NONE

#define GPU_ATTACHMENT_NONE
Value:
{ \
nullptr, -1, 0, \
}

Empty bind point.

Definition at line 263 of file GPU_framebuffer.hh.

Referenced by blender::gpu::FrameBuffer::attachment_remove(), blender::gpu::GLFrameBuffer::attachment_set_loadstore_op(), blender::gpu::GLFrameBuffer::bind(), blender::draw::overlay::Instance::draw(), blender::workbench::AntiAliasingPass::draw(), blender::workbench::DofPass::draw(), blender::workbench::Instance::draw(), blender::workbench::OpaquePass::draw(), blender::workbench::OutlinePass::draw(), blender::workbench::TransparentDepthPass::draw(), blender::workbench::TransparentPass::draw(), blender::workbench::VolumePass::draw(), blender::eevee::VolumeModule::draw_resolve(), DRW_draw_depth_loop(), DRW_draw_depth_object(), gizmo_find_intersected_3d(), blender::gpu::tests::gpu_shader_lib_test(), pygpu_framebuffer_new_parse_arg(), blender::eevee::DepthOfField::render(), blender::eevee::CaptureView::render_world(), blender::gpu::GLFrameBuffer::subpass_transition_impl(), blender::eevee::LookdevModule::sync(), blender::draw::test_draw_resource_id_gen(), blender::draw::test_draw_visibility(), blender::gpu::tests::test_framebuffer_clear_color_multiple_attachments(), blender::gpu::tests::test_framebuffer_clear_color_single_attachment(), blender::gpu::tests::test_framebuffer_clear_multiple_color_multiple_attachments(), blender::gpu::tests::test_framebuffer_cube(), blender::gpu::tests::test_framebuffer_multi_viewport(), blender::gpu::tests::test_framebuffer_scissor_test(), blender::gpu::tests::test_framebuffer_subpass_input(), and view3d_opengl_read_Z_pixels().

◆ GPU_ATTACHMENT_TEXTURE

#define GPU_ATTACHMENT_TEXTURE ( _texture)
Value:
{ \
_texture, -1, 0, \
}

Bind the first mip level of a texture (all layers).

Definition at line 273 of file GPU_framebuffer.hh.

Referenced by blender::render::hydra::GPURenderTaskDelegate::bind(), blender::draw::overlay::Instance::draw(), blender::draw::overlay::Outline::draw(), blender::workbench::AntiAliasingPass::draw(), blender::workbench::DofPass::draw(), blender::workbench::Instance::draw(), blender::workbench::OpaquePass::draw(), blender::workbench::OutlinePass::draw(), blender::workbench::ShadowPass::draw(), blender::workbench::TransparentDepthPass::draw(), blender::workbench::TransparentPass::draw(), blender::workbench::VolumePass::draw(), blender::eevee::VolumeModule::draw_resolve(), DRW_draw_depth_loop(), DRW_draw_depth_object(), blender::eevee::VolumeModule::end_sync(), blender::workbench::StencilViewWorkaround::extract(), gizmo_find_intersected_3d(), blender::gpu::tests::gpu_shader_lib_test(), blender::eevee::DepthOfField::render(), blender::eevee::ShadingView::render(), blender::eevee::CaptureView::render_probes(), blender::eevee::PlanarProbeModule::set_view(), blender::eevee::ShadowModule::set_view(), blender::eevee::LookdevModule::sync(), blender::gpu::VKContext::sync_backbuffer(), blender::draw::test_draw_resource_id_gen(), blender::draw::test_draw_visibility(), blender::gpu::tests::test_framebuffer_clear_color_multiple_attachments(), blender::gpu::tests::test_framebuffer_clear_color_single_attachment(), blender::gpu::tests::test_framebuffer_clear_depth(), blender::gpu::tests::test_framebuffer_clear_multiple_color_multiple_attachments(), blender::gpu::tests::test_framebuffer_multi_viewport(), blender::gpu::tests::test_framebuffer_scissor_test(), blender::gpu::tests::test_framebuffer_subpass_input(), and view3d_opengl_read_Z_pixels().

◆ GPU_ATTACHMENT_TEXTURE_CUBEFACE

#define GPU_ATTACHMENT_TEXTURE_CUBEFACE ( _texture,
_face )
Value:
{ \
_texture, _face, 0, \
}

NOTE: The cube-face variants are equivalent to the layer ones but give better semantic. Bind the first mip level of a cube-map _face texture.

Definition at line 296 of file GPU_framebuffer.hh.

Referenced by blender::eevee::CaptureView::render_probes(), blender::eevee::CaptureView::render_world(), and blender::gpu::tests::test_framebuffer_cube().

◆ GPU_ATTACHMENT_TEXTURE_CUBEFACE_MIP

#define GPU_ATTACHMENT_TEXTURE_CUBEFACE_MIP ( _texture,
_face,
_mip )
Value:
{ \
_texture, _face, _mip, \
}

Bind the _mip level of a cube-map _face texture.

Definition at line 301 of file GPU_framebuffer.hh.

Referenced by GPU_framebuffer_texture_cubeface_attach().

◆ GPU_ATTACHMENT_TEXTURE_LAYER

#define GPU_ATTACHMENT_TEXTURE_LAYER ( _texture,
_layer )
Value:
{ \
_texture, _layer, 0, \
}

Bind the _layer layer of the first mip level of a texture.

Definition at line 283 of file GPU_framebuffer.hh.

Referenced by blender::eevee::ShadingView::render(), blender::eevee::CaptureView::render_probes(), and blender::eevee::PlanarProbeModule::set_view().

◆ GPU_ATTACHMENT_TEXTURE_LAYER_MIP

#define GPU_ATTACHMENT_TEXTURE_LAYER_MIP ( _texture,
_layer,
_mip )
Value:
{ \
_texture, _layer, _mip, \
}

Bind the _layer layer of the _mip level of a texture.

Definition at line 288 of file GPU_framebuffer.hh.

Referenced by GPU_framebuffer_texture_layer_attach().

◆ GPU_ATTACHMENT_TEXTURE_MIP

#define GPU_ATTACHMENT_TEXTURE_MIP ( _texture,
_mip )
Value:
{ \
_texture, -1, _mip, \
}

Bind the _mip level of a texture (all layers).

Definition at line 278 of file GPU_framebuffer.hh.

Referenced by GPU_framebuffer_texture_attach().

◆ GPU_framebuffer_bind_ex

#define GPU_framebuffer_bind_ex ( _fb,
... )
Value:
{ \
GPULoadStore actions[] = __VA_ARGS__; \
GPU_framebuffer_bind_loadstore(_fb, actions, (sizeof(actions) / sizeof(GPULoadStore))); \
}

Definition at line 180 of file GPU_framebuffer.hh.

Referenced by blender::eevee::GBuffer::bind(), and blender::eevee::ShadowModule::set_view().

◆ GPU_framebuffer_ensure_config

#define GPU_framebuffer_ensure_config ( _fb,
... )
Value:
do { \
if (*(_fb) == nullptr) { \
*(_fb) = GPU_framebuffer_create(#_fb); \
} \
GPUAttachment config[] = __VA_ARGS__; \
GPU_framebuffer_config_array(*(_fb), config, (sizeof(config) / sizeof(GPUAttachment))); \
} while (0)
GPUFrameBuffer * GPU_framebuffer_create(const char *name)

How to use GPU_framebuffer_ensure_config().

Example:

GPU_ATTACHMENT_TEXTURE(depth), // must be depth buffer
})
#define GPU_ATTACHMENT_TEXTURE(_texture)
#define GPU_ATTACHMENT_TEXTURE_CUBEFACE(_texture, _face)
#define GPU_framebuffer_ensure_config(_fb,...)
#define GPU_ATTACHMENT_TEXTURE_LAYER_MIP(_texture, _layer, _mip)
BLI_INLINE float fb(float length, float L)
Note
Unspecified attachments (i.e: those beyond the last GPU_ATTACHMENT_* in GPU_framebuffer_ensure_config list) are left unchanged.
Make sure that the dimensions of your textures matches otherwise you will have an invalid framebuffer error.

Definition at line 243 of file GPU_framebuffer.hh.

Referenced by blender::render::hydra::GPURenderTaskDelegate::bind(), DRW_draw_depth_loop(), DRW_draw_depth_object(), DRW_view_data_default_lists_from_viewport(), blender::draw::overlay::Instance::end_sync(), external_cache_init(), gizmo_find_intersected_3d(), GPENCIL_antialiasing_init(), GPENCIL_cache_finish(), GPENCIL_cache_init(), GPENCIL_render_init(), gpu_offscreen_fb_get(), blender::gpu::tests::gpu_shader_lib_test(), GPU_viewport_framebuffer_overlay_get(), GPU_viewport_stereo_composite(), OVERLAY_antialiasing_cache_finish(), OVERLAY_antialiasing_init(), OVERLAY_cache_finish(), OVERLAY_outline_init(), blender::gpu::tests::test_framebuffer_clear_color_multiple_attachments(), blender::gpu::tests::test_framebuffer_clear_color_single_attachment(), blender::gpu::tests::test_framebuffer_clear_depth(), blender::gpu::tests::test_framebuffer_clear_multiple_color_multiple_attachments(), blender::gpu::tests::test_framebuffer_cube(), blender::gpu::tests::test_framebuffer_multi_viewport(), blender::gpu::tests::test_framebuffer_scissor_test(), blender::gpu::tests::test_framebuffer_subpass_input(), view3d_opengl_read_Z_pixels(), and workbench_render_framebuffers_init().

◆ GPU_FRAMEBUFFER_FREE_SAFE

#define GPU_FRAMEBUFFER_FREE_SAFE ( fb)

◆ GPU_framebuffer_subpass_transition

#define GPU_framebuffer_subpass_transition ( _fb,
... )
Value:
{ \
GPUAttachmentState actions[] = __VA_ARGS__; \
GPU_framebuffer_subpass_transition_array( \
_fb, actions, (sizeof(actions) / sizeof(GPUAttachmentState))); \
}
GPUAttachmentState

Definition at line 211 of file GPU_framebuffer.hh.

Referenced by blender::gpu::tests::test_framebuffer_subpass_input().

◆ GPU_MAX_VIEWPORTS

◆ NULL_ATTACHMENT_COLOR

#define NULL_ATTACHMENT_COLOR
Value:
{ \
0.0, 0.0, 0.0, 0.0 \
}

Definition at line 141 of file GPU_framebuffer.hh.

Referenced by blender::gpu::FrameBuffer::recursive_downsample().

◆ NULL_LOAD_STORE

#define NULL_LOAD_STORE
Value:

Definition at line 145 of file GPU_framebuffer.hh.

Enumeration Type Documentation

◆ eGPUBackBuffer

Enumerator
GPU_BACKBUFFER_LEFT 

Default framebuffer of a window. Always available.

GPU_BACKBUFFER_RIGHT 

Right buffer of a window. Only available if window was created using stereo-view.

Definition at line 99 of file GPU_framebuffer.hh.

◆ eGPUFrameBufferBits

Enumerator
GPU_COLOR_BIT 
GPU_DEPTH_BIT 
GPU_STENCIL_BIT 

Definition at line 32 of file GPU_framebuffer.hh.

Function Documentation

◆ GPU_backbuffer_bind()

void GPU_backbuffer_bind ( eGPUBackBuffer back_buffer_type)

Binds the active context's window frame-buffer. Note that GPU_BACKBUFFER_RIGHT is only available if the window was created using stereo-view.

Definition at line 328 of file gpu_framebuffer.cc.

References blender::gpu::Context::back_left, blender::gpu::Context::back_right, blender::gpu::FrameBuffer::bind(), blender::gpu::Context::get(), and GPU_BACKBUFFER_LEFT.

Referenced by wm_draw_window().

◆ GPU_clear_color()

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

Clear all color attachment textures of the active frame-buffer with the given red, green, blue, alpha values.

Note
GPU_write_mask, and stencil test do not affect this command.
Viewport and scissor regions affect this command but are not efficient nor recommended. DEPRECATED: Use GPU_framebuffer_clear_color with explicit frame-buffer.

Definition at line 521 of file gpu_framebuffer.cc.

References blender::gpu::Context::active_fb, BLI_assert_msg, blender::gpu::FrameBuffer::clear(), blender::gpu::Context::get(), GPU_COLOR_BIT, green, and red.

Referenced by blender::ed::space_node::draw_background_color(), DRW_draw_render_loop_offscreen(), ED_region_clear(), hud_region_draw(), blender::ed::greasepencil::image_render::image_render_begin(), playanim_toscreen_ex(), region_clear_fully_transparent(), region_draw_status_text(), screen_opengl_render_doit(), UI_ThemeClearColor(), wm_draw_window_offscreen(), wm_draw_window_onscreen(), wm_main_playanim_intern(), and wm_window_ghostwindow_add().

◆ GPU_clear_depth()

void GPU_clear_depth ( float depth)

Clear the depth attachment texture of the active frame-buffer with the given depth value.

Note
GPU_write_mask, and stencil test do not affect this command.
Viewport and scissor regions affect this command but are not efficient nor recommended. DEPRECATED: Use GPU_framebuffer_clear_color with explicit frame-buffer.

Definition at line 530 of file gpu_framebuffer.cc.

References blender::gpu::Context::active_fb, BLI_assert_msg, blender::gpu::FrameBuffer::clear(), blender::gpu::Context::get(), and GPU_DEPTH_BIT.

Referenced by gpu_select_pick_begin(), gpu_select_pick_load_id(), gpu_select_query_begin(), blender::ed::greasepencil::image_render::image_render_begin(), screen_opengl_render_doit(), and wm_xr_draw_view().

◆ GPU_framebuffer_active_get()

◆ GPU_framebuffer_back_get()

GPUFrameBuffer * GPU_framebuffer_back_get ( )

◆ GPU_framebuffer_bind()

void GPU_framebuffer_bind ( GPUFrameBuffer * framebuffer)

Binds a #GPUFrameBuffer making it the active framebuffer for all geometry rendering.

Definition at line 292 of file gpu_framebuffer.cc.

References blender::gpu::unwrap().

Referenced by blender::eevee::Film::accumulate(), blender::draw::Framebuffer::bind(), blender::eevee::GBuffer::bind(), blender::render::hydra::GPURenderTaskDelegate::bind(), blender::gpu::GLTexture::clear(), blender::gpu::MTLTexture::clear(), blender::eevee::DeferredPipeline::debug_draw(), blender::eevee::HiZBuffer::debug_draw(), blender::eevee::LightModule::debug_draw(), blender::eevee::ShadowModule::debug_draw(), blender::eevee::Film::display(), blender::eevee::LookdevModule::display(), blender::draw::overlay::Armatures::draw(), blender::draw::overlay::AttributeViewer::draw(), blender::draw::overlay::Bounds::draw(), blender::draw::overlay::Cameras::draw(), blender::draw::overlay::Curves::draw(), blender::draw::overlay::EditText::draw(), blender::draw::overlay::Empties::draw(), blender::draw::overlay::Facing::draw(), blender::draw::overlay::Fade::draw(), blender::draw::overlay::Fluids::draw(), blender::draw::overlay::ForceFields::draw(), blender::draw::overlay::GreasePencil::draw(), blender::draw::overlay::Grid::draw(), blender::draw::overlay::Instance::draw(), blender::draw::overlay::Lattices::draw(), blender::draw::overlay::LightProbes::draw(), blender::draw::overlay::Lights::draw(), blender::draw::overlay::Meshes::draw(), blender::draw::overlay::MeshUVs::draw(), blender::draw::overlay::Metaballs::draw(), blender::draw::overlay::ModeTransfer::draw(), blender::draw::overlay::Origins::draw(), blender::draw::overlay::Paints::draw(), blender::draw::overlay::Particles::draw(), blender::draw::overlay::Prepass::draw(), blender::draw::overlay::Relations::draw(), blender::draw::overlay::Sculpts::draw(), blender::draw::overlay::Speakers::draw(), blender::draw::overlay::Wireframe::draw(), blender::draw::overlay::XrayFade::draw(), blender::draw::overlay::Cameras::draw_background_images(), blender::draw::overlay::Empties::draw_background_images(), blender::draw::overlay::Curves::draw_color_only(), blender::draw::overlay::GreasePencil::draw_color_only(), blender::draw::overlay::LightProbes::draw_color_only(), blender::draw::overlay::Meshes::draw_color_only(), blender::draw::overlay::MotionPath::draw_color_only(), blender::draw::overlay::Empties::draw_images(), blender::draw::overlay::Cameras::draw_in_front(), blender::draw::overlay::Empties::draw_in_front_images(), blender::draw::overlay::Particles::draw_no_line(), blender::draw::overlay::MeshUVs::draw_on_render(), blender::draw::overlay::Sculpts::draw_on_render(), blender::draw::overlay::Cameras::draw_scene_background_images(), draw_timeline_post_view_callbacks(), draw_timeline_pre_view_callbacks(), blender::draw::image_engine::ScreenSpaceDrawingMode< TextureMethod >::draw_viewport(), 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_select_buffer_read(), ED_region_do_draw(), ED_view3d_draw_offscreen_imbuf(), blender::draw::command::FramebufferBind::execute(), 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_offscreen_unbind(), blender::gpu::tests::gpu_shader_lib_test(), GPU_viewport_stereo_composite(), OVERLAY_antialiasing_end(), OVERLAY_antialiasing_start(), OVERLAY_draw_scene(), OVERLAY_edit_curve_draw(), OVERLAY_edit_curves_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_draw(), OVERLAY_xray_depth_copy(), pygpu_framebuffer_stack_pop_and_restore_or_error(), pygpu_framebuffer_stack_push_and_bind_or_error(), blender::eevee::DeferredLayer::render(), blender::eevee::DeferredProbePipeline::render(), blender::eevee::DepthOfField::render(), blender::eevee::PlanarProbePipeline::render(), blender::eevee::ShadingView::render(), blender::render::hydra::ViewportEngine::render(), blender::eevee::CaptureView::render_probes(), blender::eevee::CaptureView::render_world(), select_cache_init(), select_draw_scene(), sequencer_draw_preview(), sequencer_ibuf_get(), blender::eevee::ShadowModule::set_view(), blender::gpu::tests::test_framebuffer_clear_color_multiple_attachments(), blender::gpu::tests::test_framebuffer_clear_color_single_attachment(), blender::gpu::tests::test_framebuffer_clear_depth(), blender::gpu::tests::test_framebuffer_clear_multiple_color_multiple_attachments(), blender::gpu::tests::test_framebuffer_cube(), blender::gpu::tests::test_framebuffer_multi_viewport(), blender::gpu::tests::test_framebuffer_scissor_test(), blender::gpu::tests::test_framebuffer_subpass_input(), blender::gpu::tests::ShaderSpecializationConst::validate(), view3d_opengl_read_Z_pixels(), write_render_color_output(), and write_render_z_output().

◆ GPU_framebuffer_bind_loadstore()

void GPU_framebuffer_bind_loadstore ( GPUFrameBuffer * framebuffer,
const GPULoadStore * load_store_actions,
uint load_store_actions_len )

Load store config array (load_store_actions) matches attachment structure of GPU_framebuffer_config_array. This allows us to explicitly specify whether attachment data needs to be loaded and stored on a per-attachment basis. This enables a number of bandwidth optimizations:

  • No need to load contents if subsequent work is over-writing every pixel.
  • No need to store attachments whose contents are not used beyond this pass e.g. depth buffer.
  • State can be customized at bind-time rather than applying to the frame-buffer object as a whole.

NOTE: Using GPU_framebuffer_clear_* functions in conjunction with a custom load-store configuration is invalid. Instead, utilize GPU_LOADACTION_CLEAR and provide a clear color as the third parameter in GPULoadStore action.

For Color attachments: {GPU_LOADACTION_CLEAR, GPU_STOREACTION_STORE, {Rf, Gf, Bf, Af}} For Depth attachments: {GPU_LOADACTION_CLEAR, GPU_STOREACTION_STORE, {Df}}

Example:

{GPU_LOADACTION_LOAD, GPU_STOREACTION_STORE}, // Color attachment 0
})
@ GPU_LOADACTION_LOAD
@ GPU_STOREACTION_STORE
void GPU_framebuffer_bind_loadstore(GPUFrameBuffer *framebuffer, const GPULoadStore *load_store_actions, uint load_store_actions_len)

Definition at line 300 of file gpu_framebuffer.cc.

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

◆ GPU_framebuffer_bind_no_srgb()

void GPU_framebuffer_bind_no_srgb ( GPUFrameBuffer * framebuffer)

◆ GPU_framebuffer_blit()

void GPU_framebuffer_blit ( GPUFrameBuffer * fb_read,
int read_slot,
GPUFrameBuffer * fb_write,
int write_slot,
eGPUFrameBufferBits blit_buffers )

Copy the content of fb_read attachments to the fb_read attachments. The attachments types are chosen by blit_buffers . Only one color buffer can by copied at a time and its index is chosen by read_slot and write_slot. The source and destination frame-buffers dimensions have to match. DEPRECATED: Prefer using GPU_texture_copy().

Definition at line 568 of file gpu_framebuffer.cc.

References blender::gpu::Context::active_fb, blender::gpu::FrameBuffer::bind(), BLI_assert, blender::gpu::FrameBuffer::blit_to(), blender::gpu::FrameBuffer::color_tex(), blender::gpu::FrameBuffer::depth_tex(), blender::gpu::Context::get(), GPU_DEPTH_BIT, GPU_STENCIL_BIT, GPU_texture_format(), GPU_texture_has_depth_format(), GPU_texture_has_stencil_format(), and blender::gpu::unwrap().

Referenced by external_draw_scene(), GPENCIL_fast_draw_end(), and GPENCIL_fast_draw_start().

◆ GPU_framebuffer_bound()

bool GPU_framebuffer_bound ( GPUFrameBuffer * framebuffer)

Return true if framebuffer is the active framebuffer of the active context.

Note
return false if no context is active.
this is undefined behavior if framebuffer is nullptr. DEPRECATED: Kept only because of Python GPU API.

Definition at line 357 of file gpu_framebuffer.cc.

References GPU_framebuffer_active_get().

Referenced by pygpu_framebuffer_clear(), pygpu_framebuffer_is_bound(), and pygpu_framebuffer_stack_pop_and_restore_or_error().

◆ GPU_framebuffer_check_valid()

bool GPU_framebuffer_check_valid ( GPUFrameBuffer * framebuffer,
char err_out[256] )

Checks a framebuffer current configuration for errors. Checks for texture size mismatch, incompatible attachment, incomplete textures etc...

Note
This binds the framebuffer to the active context. err_out is an error output buffer.
Returns
false if the framebuffer is invalid.

Definition at line 364 of file gpu_framebuffer.cc.

References blender::gpu::unwrap().

Referenced by draw_select_framebuffer_depth_only_setup(), GPU_offscreen_create(), select_engine_framebuffer_setup(), and workbench_render_framebuffers_init().

◆ GPU_framebuffer_clear()

void GPU_framebuffer_clear ( GPUFrameBuffer * framebuffer,
eGPUFrameBufferBits buffers,
const float clear_col[4],
float clear_depth,
unsigned int clear_stencil )

Clear the frame-buffer attachments. buffers controls the types of attachments to clear. Setting GPU_COLOR_BIT will clear all the color attachment. Each attachment gets cleared to the value of its type:

  • color attachments gets cleared to clear_col .
  • depth attachment gets cleared to clear_depth .
  • stencil attachment gets cleared to clear_stencil .
Note
GPU_write_mask, and stencil test do not affect this command.
Viewport and scissor regions affect this command but are not efficient nor recommended.

Definition at line 465 of file gpu_framebuffer.cc.

References BLI_assert_msg, buffers, and blender::gpu::unwrap().

Referenced by draw_shgroup(), blender::draw::command::Clear::execute(), GPU_framebuffer_clear_color(), GPU_framebuffer_clear_color_depth(), GPU_framebuffer_clear_color_depth_stencil(), GPU_framebuffer_clear_depth(), GPU_framebuffer_clear_depth_stencil(), GPU_framebuffer_clear_stencil(), and pygpu_framebuffer_clear().

◆ GPU_framebuffer_clear_color()

◆ GPU_framebuffer_clear_color_depth()

void GPU_framebuffer_clear_color_depth ( GPUFrameBuffer * fb,
const float clear_col[4],
float clear_depth )

Clear all color attachment textures with the value clear_col and the depth attachment texture with the value clear_depth .

Note
GPU_write_mask, and stencil test do not affect this command.
Viewport and scissor regions affect this command but are not efficient nor recommended.

Definition at line 487 of file gpu_framebuffer.cc.

References fb(), GPU_COLOR_BIT, GPU_DEPTH_BIT, and GPU_framebuffer_clear().

Referenced by blender::render::hydra::GPURenderTaskDelegate::bind(), blender::draw::overlay::Instance::draw(), blender::draw::image_engine::ScreenSpaceDrawingMode< TextureMethod >::draw_viewport(), blender::eevee::Instance::draw_viewport(), gpencil_draw_mask(), blender::eevee::ShadingView::render(), blender::eevee::CaptureView::render_probes(), and select_cache_init().

◆ GPU_framebuffer_clear_color_depth_stencil()

void GPU_framebuffer_clear_color_depth_stencil ( GPUFrameBuffer * fb,
const float clear_col[4],
float clear_depth,
uint clear_stencil )

Clear the depth attachment texture with the value clear_depth , the stencil attachment with the value clear_stencil and all the color attachments with the value clear_col .

Note
GPU_write_mask, and stencil test do not affect this command.
Viewport and scissor regions affect this command but are not efficient nor recommended.

Definition at line 504 of file gpu_framebuffer.cc.

References fb(), GPU_COLOR_BIT, GPU_DEPTH_BIT, GPU_framebuffer_clear(), and GPU_STENCIL_BIT.

Referenced by OVERLAY_outline_draw().

◆ GPU_framebuffer_clear_depth()

void GPU_framebuffer_clear_depth ( GPUFrameBuffer * fb,
float clear_depth )

Clear the depth attachment texture with the value clear_depth .

Note
GPU_write_mask, and stencil test do not affect this command.
Viewport and scissor regions affect this command but are not efficient nor recommended.

Definition at line 482 of file gpu_framebuffer.cc.

References fb(), GPU_DEPTH_BIT, and GPU_framebuffer_clear().

Referenced by blender::draw::Framebuffer::clear_depth(), DRW_draw_depth_loop(), DRW_draw_depth_object(), DRW_draw_select_loop(), external_draw_scene_do_image(), GPENCIL_render_init(), OVERLAY_antialiasing_start(), OVERLAY_edit_mesh_draw(), OVERLAY_pose_draw(), OVERLAY_xray_depth_copy(), blender::eevee::PlanarProbePipeline::render(), select_draw_scene(), and blender::gpu::tests::test_framebuffer_clear_depth().

◆ GPU_framebuffer_clear_depth_stencil()

void GPU_framebuffer_clear_depth_stencil ( GPUFrameBuffer * fb,
float clear_depth,
uint clear_stencil )

Clear the depth attachment texture with the value clear_depth and the stencil attachment with the value clear_stencil .

Note
GPU_write_mask, and stencil test do not affect this command.
Viewport and scissor regions affect this command but are not efficient nor recommended.

Definition at line 499 of file gpu_framebuffer.cc.

References fb(), GPU_DEPTH_BIT, GPU_framebuffer_clear(), and GPU_STENCIL_BIT.

Referenced by blender::workbench::Instance::draw(), DRW_draw_render_loop_2d_ex(), DRW_draw_render_loop_ex(), and GPENCIL_draw_object().

◆ GPU_framebuffer_clear_stencil()

void GPU_framebuffer_clear_stencil ( GPUFrameBuffer * fb,
uint clear_stencil )

Clear the stencil attachment with the value clear_stencil .

Note
GPU_write_mask, and stencil test do not affect this command.
Viewport and scissor regions affect this command but are not efficient nor recommended.

Definition at line 494 of file gpu_framebuffer.cc.

References fb(), GPU_framebuffer_clear(), and GPU_STENCIL_BIT.

Referenced by blender::eevee::GBuffer::bind(), and blender::workbench::OpaquePass::draw().

◆ GPU_framebuffer_config_array()

void GPU_framebuffer_config_array ( GPUFrameBuffer * framebuffer,
const GPUAttachment * config,
int config_len )

First GPUAttachment in *config is always the depth/depth_stencil buffer. Following #GPUAttachments are color buffers. Setting GPUAttachment.mip to -1 will leave the texture in this slot. Setting GPUAttachment.tex to nullptr will detach the texture in this slot.

Definition at line 403 of file gpu_framebuffer.cc.

References fb(), GPU_FB_COLOR_ATTACHMENT0, GPU_FB_DEPTH_ATTACHMENT, GPU_FB_DEPTH_STENCIL_ATTACHMENT, GPU_texture_has_stencil_format(), GPUAttachment::mip, GPUAttachment::tex, and blender::gpu::unwrap().

Referenced by blender::draw::Framebuffer::ensure(), and pygpu_framebuffer__tp_new().

◆ GPU_framebuffer_create()

◆ GPU_framebuffer_default_size()

void GPU_framebuffer_default_size ( GPUFrameBuffer * framebuffer,
int width,
int height )

Default size is used if the frame-buffer contains no attachments. It needs to be re-specified each time an attachment is added.

Definition at line 434 of file gpu_framebuffer.cc.

References blender::gpu::unwrap().

Referenced by blender::draw::Framebuffer::ensure(), and blender::gpu::tests::ShaderSpecializationConst::validate().

◆ GPU_framebuffer_free()

◆ GPU_framebuffer_get_name()

const char * GPU_framebuffer_get_name ( GPUFrameBuffer * framebuffer)

◆ GPU_framebuffer_multi_clear()

void GPU_framebuffer_multi_clear ( GPUFrameBuffer * framebuffer,
const float(*) clear_colors[4] )

Clear each color attachment texture attached to this frame-buffer with a different color. IMPORTANT: The size of clear_colors must match the number of color attachments.

Note
GPU_write_mask, and stencil test do not affect this command.
Viewport and scissor regions affect this command but are not efficient nor recommended.

Definition at line 513 of file gpu_framebuffer.cc.

References BLI_assert_msg, and blender::gpu::unwrap().

Referenced by blender::workbench::Instance::draw(), blender::draw::command::ClearMulti::execute(), GPENCIL_draw_object(), GPENCIL_draw_scene(), and blender::gpu::tests::test_framebuffer_clear_multiple_color_multiple_attachments().

◆ GPU_framebuffer_multi_viewports_set()

void GPU_framebuffer_multi_viewports_set ( GPUFrameBuffer * gpu_fb,
const int viewport_rects[GPU_MAX_VIEWPORTS][4] )

Similar to GPU_framebuffer_viewport_set() but specify the bounds of all 16 viewports. By default geometry renders only to the first viewport. That can be changed by setting gpu_ViewportIndex in the vertex.

Note
Viewport and scissor size is stored per frame-buffer.
Must be called after first bind.

Definition at line 447 of file gpu_framebuffer.cc.

References blender::gpu::unwrap().

Referenced by blender::eevee::ShadowModule::set_view(), and blender::gpu::tests::test_framebuffer_multi_viewport().

◆ GPU_framebuffer_pop()

GPUFrameBuffer * GPU_framebuffer_pop ( )

◆ GPU_framebuffer_push()

void GPU_framebuffer_push ( GPUFrameBuffer * framebuffer)

Keep a stack of bound frame-buffer to allow scoped binding of frame-buffer in python. This is also used by GPUOffScreen to save/restore the current frame-buffers.

Note
This isn't thread safe.

Definition at line 644 of file gpu_framebuffer.cc.

References BLI_assert, fb(), FRAMEBUFFER_STACK_DEPTH, and FrameBufferStack.

Referenced by GPU_offscreen_bind(), and pygpu_framebuffer_stack_push_and_bind_or_error().

◆ GPU_framebuffer_py_reference_get()

void ** GPU_framebuffer_py_reference_get ( GPUFrameBuffer * framebuffer)

Reference of a pointer that needs to be cleaned when deallocating the frame-buffer. Points to BPyGPUFrameBuffer.fb

Definition at line 617 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 * framebuffer,
void ** py_ref )

◆ GPU_framebuffer_read_color()

void GPU_framebuffer_read_color ( GPUFrameBuffer * framebuffer,
int x,
int y,
int width,
int height,
int channels,
int slot,
eGPUDataFormat data_format,
void * r_data )

Read a region of a framebuffer color attachment and copy it to r_data . The pixel data will be converted to data_format but it needs to be compatible with the attachment type. DEPRECATED: Prefer using GPU_texture_read().

Definition at line 546 of file gpu_framebuffer.cc.

References GPU_COLOR_BIT, blender::gpu::unwrap(), w(), x, and y.

Referenced by DRW_select_buffer_read(), GPENCIL_render_result_combined(), GPU_offscreen_read_color_region(), pygpu_framebuffer_read_color(), and write_render_color_output().

◆ GPU_framebuffer_read_depth()

void GPU_framebuffer_read_depth ( GPUFrameBuffer * framebuffer,
int x,
int y,
int width,
int height,
eGPUDataFormat data_format,
void * r_data )

Read a region of the framebuffer depth attachment and copy it to r_data . The pixel data will be converted to data_format but it needs to be compatible with the attachment type. DEPRECATED: Prefer using GPU_texture_read().

Definition at line 539 of file gpu_framebuffer.cc.

References GPU_DEPTH_BIT, blender::gpu::unwrap(), w(), x, and y.

Referenced by GPENCIL_render_result_z(), gpu_select_pick_load_id(), pygpu_framebuffer_read_depth(), view3d_opengl_read_Z_pixels(), and write_render_z_output().

◆ GPU_framebuffer_recursive_downsample()

void GPU_framebuffer_recursive_downsample ( GPUFrameBuffer * framebuffer,
int max_level,
void(* per_level_callback )(void *user_data, int level),
void * user_data )

Call per_level_callback after binding each framebuffer attachment mip level up until max_level . Each attachment texture sampler mip range is set to not overlap the currently processed level. This is used for generating custom mip-map chains where each level needs access to the one above. DEPRECATED: Prefer using a compute shader with arbitrary imageLoad/Store for this purpose as it is clearer and likely faster with optimizations.

Definition at line 608 of file gpu_framebuffer.cc.

References callback, and blender::gpu::unwrap().

Referenced by blender::workbench::DofPass::draw().

◆ GPU_framebuffer_restore()

◆ GPU_framebuffer_stack_level_get()

◆ GPU_framebuffer_subpass_transition_array()

void GPU_framebuffer_subpass_transition_array ( GPUFrameBuffer * framebuffer,
const GPUAttachmentState * attachment_states,
uint attachment_len )

Sub-pass config array matches attachment structure of GPU_framebuffer_config_array. This allows to explicitly specify attachment state within the next sub-pass. This enables a number of bandwidth optimizations specially on Tile Based Deferred Renderers where the attachments can be kept into tile memory and used in place for later sub-passes.

IMPORTANT: When using this, the framebuffer initial state is undefined. A sub-pass transition need to be issued before any draw-call.

Example:

GPU_ATTACHMENT_WRITE, // must be depth buffer
GPU_ATTACHMENT_READ, // Color attachment 0
GPU_ATTACHMENT_IGNORE, // Color attachment 1
GPU_ATTACHMENT_WRITE} // Color attachment 2
})
@ GPU_ATTACHMENT_WRITE
@ GPU_ATTACHMENT_READ
@ GPU_ATTACHMENT_IGNORE
Note
Excess attachments will have no effect as long as they are GPU_ATTACHMENT_IGNORE.

Definition at line 314 of file gpu_framebuffer.cc.

References blender::gpu::unwrap().

Referenced by blender::draw::command::SubPassTransition::execute().

◆ GPU_framebuffer_texture_attach()

void GPU_framebuffer_texture_attach ( GPUFrameBuffer * framebuffer,
GPUTexture * texture,
int slot,
int mip )

Attach an entire texture mip level to a #GPUFrameBuffer. Changes will only take effect next time GPU_framebuffer_bind() is called. slot is the color texture slot to bind this texture to. Must be 0 if it is the depth texture. mip is the mip level of this texture to attach to the framebuffer. DEPRECATED: Prefer using multiple #GPUFrameBuffer with different configurations with GPU_framebuffer_config_array().

Definition at line 378 of file gpu_framebuffer.cc.

References fb(), GPU_ATTACHMENT_TEXTURE_MIP, gpu_framebuffer_texture_attach_ex(), and tex.

Referenced by draw_select_framebuffer_depth_only_setup(), and select_engine_framebuffer_setup().

◆ GPU_framebuffer_texture_cubeface_attach()

void GPU_framebuffer_texture_cubeface_attach ( GPUFrameBuffer * framebuffer,
GPUTexture * texture,
int slot,
int face,
int mip )

Attach a single cube-face of an cube-map texture mip level to a #GPUFrameBuffer. Changes will only take effect next time GPU_framebuffer_bind() is called. slot is the color texture slot to bind this texture to. Must be 0 if it is the depth texture. face is the cube-face of this cube-map texture to attach to the framebuffer. mip is the mip level of this texture to attach to the framebuffer. DEPRECATED: Prefer using multiple #GPUFrameBuffer with different configurations with GPU_framebuffer_config_array().

Definition at line 391 of file gpu_framebuffer.cc.

References fb(), GPU_ATTACHMENT_TEXTURE_CUBEFACE_MIP, gpu_framebuffer_texture_attach_ex(), and tex.

◆ GPU_framebuffer_texture_detach()

void GPU_framebuffer_texture_detach ( GPUFrameBuffer * framebuffer,
GPUTexture * texture )

Detach a texture from a #GPUFrameBuffer. The texture must be attached. Changes will only take effect next time GPU_framebuffer_bind() is called. DEPRECATED: Prefer using multiple #GPUFrameBuffer with different configurations with GPU_framebuffer_config_array().

Definition at line 398 of file gpu_framebuffer.cc.

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

◆ GPU_framebuffer_texture_layer_attach()

void GPU_framebuffer_texture_layer_attach ( GPUFrameBuffer * framebuffer,
GPUTexture * texture,
int slot,
int layer,
int mip )

Attach a single layer of an array texture mip level to a #GPUFrameBuffer. Changes will only take effect next time GPU_framebuffer_bind() is called. slot is the color texture slot to bind this texture to. Must be 0 if it is the depth texture. layer is the layer of this array texture to attach to the framebuffer. mip is the mip level of this texture to attach to the framebuffer. DEPRECATED: Prefer using multiple #GPUFrameBuffer with different configurations with GPU_framebuffer_config_array().

Definition at line 384 of file gpu_framebuffer.cc.

References fb(), GPU_ATTACHMENT_TEXTURE_LAYER_MIP, gpu_framebuffer_texture_attach_ex(), and tex.

◆ GPU_framebuffer_viewport_get()

void GPU_framebuffer_viewport_get ( GPUFrameBuffer * framebuffer,
int r_viewport[4] )

Return the viewport offset and size in a int quadruple: (x, y, width, height).

Note
Viewport and scissor size is stored per frame-buffer.

Definition at line 453 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 * framebuffer)

Reset a frame-buffer viewport bounds to its attachment(s) size.

Note
Viewport and scissor size is stored per frame-buffer.

Definition at line 458 of file gpu_framebuffer.cc.

References blender::gpu::unwrap().

Referenced by blender::eevee::LookdevModule::display(), and eevee_draw_scene().

◆ GPU_framebuffer_viewport_set()

void GPU_framebuffer_viewport_set ( GPUFrameBuffer * framebuffer,
int x,
int y,
int width,
int height )

Set a the viewport offset and size. These are reset to the original dimensions explicitly (using GPU_framebuffer_viewport_reset()) or when binding the frame-buffer after modifying its attachments.

Note
Viewport and scissor size is stored per frame-buffer.
Setting a singular viewport will only change the state of the first viewport.
Must be called after first bind.

Definition at line 441 of file gpu_framebuffer.cc.

References blender::gpu::unwrap(), x, and y.

Referenced by blender::eevee::Film::accumulate(), blender::eevee::Film::display(), and pygpu_framebuffer_viewport_set().

◆ GPU_frontbuffer_read_color()

void GPU_frontbuffer_read_color ( int x,
int y,
int width,
int height,
int channels,
eGPUDataFormat data_format,
void * r_data )

Read a the color of the window screen as it is currently displayed (so the previously rendered back-buffer). DEPRECATED: This isn't even working correctly on some implementation. TODO: Emulate this by doing some slow texture copy on the backend side or try to read the areas offscreen textures directly.

Definition at line 560 of file gpu_framebuffer.cc.

References blender::gpu::Context::front_left, blender::gpu::Context::get(), GPU_COLOR_BIT, blender::gpu::FrameBuffer::read(), w(), x, and y.

Referenced by WM_window_pixels_read_from_frontbuffer(), and WM_window_pixels_read_sample_from_frontbuffer().

◆ GPU_offscreen_bind()

◆ GPU_offscreen_color_texture()

GPUTexture * GPU_offscreen_color_texture ( const GPUOffScreen * offscreen)

◆ GPU_offscreen_create()

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

◆ GPU_offscreen_draw_to_screen()

void GPU_offscreen_draw_to_screen ( GPUOffScreen * offscreen,
int x,
int y )

Blit the offscreen color texture to the active framebuffer at the (x, y) location.

Definition at line 817 of file gpu_framebuffer.cc.

References blender::gpu::Context::active_fb, blender::gpu::FrameBuffer::blit_to(), blender::gpu::Context::get(), GPU_COLOR_BIT, gpu_offscreen_fb_get(), and blender::gpu::unwrap().

Referenced by wm_draw_region_blit().

◆ GPU_offscreen_format()

eGPUTextureFormat GPU_offscreen_format ( const GPUOffScreen * offscreen)

Return the texture format of a GPUOffScreen.

Definition at line 861 of file gpu_framebuffer.cc.

References GPUOffScreen::color, and GPU_texture_format().

Referenced by ED_view3d_draw_offscreen_imbuf(), and wm_draw_region_buffer_create().

◆ GPU_offscreen_free()

◆ GPU_offscreen_height()

◆ GPU_offscreen_read_color()

void GPU_offscreen_read_color ( GPUOffScreen * offscreen,
eGPUDataFormat data_format,
void * r_data )

◆ GPU_offscreen_read_color_region()

void GPU_offscreen_read_color_region ( GPUOffScreen * offscreen,
eGPUDataFormat data_format,
int x,
int y,
int w,
int h,
void * r_data )

◆ GPU_offscreen_unbind()

◆ GPU_offscreen_viewport_data_get()

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

Return the internals of a GPUOffScreen. Does not give ownership.

Note
only to be used by viewport code!

Definition at line 866 of file gpu_framebuffer.cc.

References GPUOffScreen::color, GPUOffScreen::depth, and gpu_offscreen_fb_get().

Referenced by GPU_viewport_bind_from_offscreen().

◆ GPU_offscreen_width()