Blender V5.3
gpu_framebuffer.cc File Reference
#include "MEM_guardedalloc.h"
#include "BLI_math_base_c.hh"
#include "BLI_string.hh"
#include "BLI_utildefines.hh"
#include "CLG_log.h"
#include "GPU_capabilities.hh"
#include "GPU_texture.hh"
#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  blender::GPUOffScreen

Namespaces

namespace  blender
 BMesh Iterators.
namespace  blender::gpu

Functions

Creation
gpu::FrameBuffer * blender::GPU_framebuffer_create (const char *name)
gpu::FrameBuffer * blender::GPU_framebuffer_active_get ()
gpu::FrameBuffer * blender::GPU_framebuffer_back_get ()
Free
void blender::GPU_framebuffer_free (gpu::FrameBuffer *fb)
Debugging introspection API.
const char * blender::GPU_framebuffer_get_name (gpu::FrameBuffer *fb)
Binding
void blender::GPU_framebuffer_bind (gpu::FrameBuffer *fb)
void blender::GPU_framebuffer_bind_no_srgb (gpu::FrameBuffer *fb)
void blender::GPU_backbuffer_bind (GPUBackBuffer back_buffer_type)
void blender::GPU_framebuffer_restore ()
Advanced binding control
void blender::GPU_framebuffer_bind_loadstore (gpu::FrameBuffer *fb, const GPULoadStore *load_store_actions, uint load_store_actions_len)
void blender::GPU_framebuffer_subpass_transition_array (gpu::FrameBuffer *fb, const GPUAttachmentState *attachment_states, uint attachment_len)
Deprecated
bool blender::GPU_framebuffer_bound (gpu::FrameBuffer *fb)
void blender::GPU_framebuffer_read_depth (gpu::FrameBuffer *fb, int x, int y, int width, int height, eGPUDataFormat data_format, void *r_data)
void blender::GPU_framebuffer_read_color (gpu::FrameBuffer *fb, int x, int y, int width, int height, int channels, int slot, eGPUDataFormat data_format, void *r_data)
void blender::GPU_frontbuffer_read_color (int x, int y, int width, int height, int channels, eGPUDataFormat data_format, void *r_data)
void blender::GPU_framebuffer_blit (gpu::FrameBuffer *fb_read, int read_slot, gpu::FrameBuffer *fb_write, int write_slot, GPUFrameBufferBits blit_buffers)
Attachments
bool blender::GPU_framebuffer_check_valid (gpu::FrameBuffer *fb, char err_out[256])
void blender::GPU_framebuffer_texture_attach (gpu::FrameBuffer *fb, gpu::Texture *texture, int slot, int mip)
void blender::GPU_framebuffer_texture_layer_attach (gpu::FrameBuffer *fb, gpu::Texture *texture, int slot, int layer, int mip)
void blender::GPU_framebuffer_texture_cubeface_attach (gpu::FrameBuffer *fb, gpu::Texture *texture, int slot, int face, int mip)
void blender::GPU_framebuffer_texture_detach (gpu::FrameBuffer *fb, gpu::Texture *texture)
void blender::GPU_framebuffer_config_array (gpu::FrameBuffer *fb, const GPUAttachment *config, int config_len)
C-API
static void blender::gpu_framebuffer_texture_attach_ex (gpu::FrameBuffer *gpu_fb, GPUAttachment attachment, int slot)
static void blender::check_clear_color (const Texture *tex, double4 clear_value, int attachment)
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 blender::GPU_framebuffer_default_size (gpu::FrameBuffer *fb, int width, int height)
Internal state
int2 blender::GPU_framebuffer_extent_get (gpu::FrameBuffer *fb)
 Get the extent of the framebuffer.
void blender::GPU_framebuffer_viewport_set (gpu::FrameBuffer *fb, int x, int y, int width, int height)
void blender::GPU_framebuffer_multi_viewports_set (gpu::FrameBuffer *gpu_fb, const int viewport_rects[GPU_MAX_VIEWPORTS][4])
void blender::GPU_framebuffer_viewport_get (gpu::FrameBuffer *fb, int r_viewport[4])
void blender::GPU_framebuffer_viewport_reset (gpu::FrameBuffer *fb)
Clearing
void blender::GPU_framebuffer_clear (gpu::FrameBuffer *fb, GPUFrameBufferBits buffers, const double4 clear_col, float clear_depth, unsigned int clear_stencil)
void blender::GPU_framebuffer_clear_color (gpu::FrameBuffer *fb, const double4 clear_col)
void blender::GPU_framebuffer_clear_depth (gpu::FrameBuffer *fb, float clear_depth)
void blender::GPU_framebuffer_clear_color_depth (gpu::FrameBuffer *fb, const double4 clear_col, float clear_depth)
void blender::GPU_framebuffer_clear_stencil (gpu::FrameBuffer *fb, uint clear_stencil)
void blender::GPU_framebuffer_clear_depth_stencil (gpu::FrameBuffer *fb, float clear_depth, uint clear_stencil)
void blender::GPU_framebuffer_clear_color_depth_stencil (gpu::FrameBuffer *fb, const double4 clear_col, float clear_depth, uint clear_stencil)
void blender::GPU_framebuffer_multi_clear (gpu::FrameBuffer *fb, Span< double4 > clear_colors)
void blender::GPU_clear_color (float red, float green, float blue, float alpha)
void blender::GPU_clear_depth (float depth)
Python API & meta-data

These are not intrinsic properties of a texture but they are stored inside the gpu::Texture structure for tracking purpose.

void ** blender::GPU_framebuffer_py_reference_get (gpu::FrameBuffer *fb)
void blender::GPU_framebuffer_py_reference_set (gpu::FrameBuffer *fb, void **py_ref)
void blender::GPU_framebuffer_push (gpu::FrameBuffer *fb)
gpu::FrameBuffer * blender::GPU_framebuffer_pop ()
uint blender::GPU_framebuffer_stack_level_get ()
GPUOffScreen

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

static gpu::FrameBuffer * blender::gpu_offscreen_fb_get (GPUOffScreen *ofs)
GPU OffScreen

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

GPUOffScreen * blender::GPU_offscreen_create (int width, int height, bool with_depth_buffer, gpu::TextureFormat format, eGPUTextureUsage usage, bool clear, char err_out[256])
void blender::GPU_offscreen_free (GPUOffScreen *offscreen)
void blender::GPU_offscreen_bind (GPUOffScreen *offscreen, bool save)
void blender::GPU_offscreen_unbind (GPUOffScreen *offscreen, bool restore)
void blender::GPU_offscreen_draw_to_screen (GPUOffScreen *offscreen, int x, int y)
void blender::GPU_offscreen_read_color_region (GPUOffScreen *offscreen, eGPUDataFormat data_format, int x, int y, int w, int h, void *r_data)
void blender::GPU_offscreen_read_color (GPUOffScreen *offscreen, eGPUDataFormat data_format, void *r_data)
int blender::GPU_offscreen_width (const GPUOffScreen *offscreen)
int blender::GPU_offscreen_height (const GPUOffScreen *offscreen)
gpu::Texture * blender::GPU_offscreen_color_texture (const GPUOffScreen *offscreen)
gpu::TextureFormat blender::GPU_offscreen_format (const GPUOffScreen *offscreen)
void blender::GPU_offscreen_viewport_data_get (GPUOffScreen *offscreen, gpu::FrameBuffer **r_fb, gpu::Texture **r_color, gpu::Texture **r_depth)

Variables

static CLG_LogRef blender::gpu::LOG = {"gpu.framebuffer"}

Frame-Buffer Stack

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

#define FRAMEBUFFER_STACK_DEPTH   16
static struct  blender::FrameBufferStack = {{nullptr}}

Macro Definition Documentation

◆ FRAMEBUFFER_STACK_DEPTH

#define FRAMEBUFFER_STACK_DEPTH   16

Definition at line 639 of file gpu_framebuffer.cc.

Referenced by blender::GPU_framebuffer_push().