Blender V5.3
blender::gpu::GLContext Class Reference

#include <gl_context.hh>

Inherits blender::gpu::Context.

Public Member Functions

Constructor / Destructor
 GLContext (GHOST_IWindow *ghost_window, GHOST_IContext *ghost_context, GLSharedOrphanLists &shared_orphan_list)
 ~GLContext ()
Activate / Deactivate context
void activate () override
void deactivate () override
void begin_frame () override
void end_frame () override
Flush, Finish & sync
void flush () override
void finish () override
Memory statistics
void memory_statistics_get (int *r_total_mem, int *r_free_mem) override
Linked object deletion

These objects contain data that are stored per context. We need to do some cleanup if they are used across context or if context is discarded.

void vao_cache_register (GLVaoCache *cache)
void vao_cache_unregister (GLVaoCache *cache)
Public Member Functions inherited from blender::gpu::Context
 Context ()
virtual ~Context ()
bool is_active_on_thread ()
VertBuf * dummy_vbo_get ()
Batch * procedural_points_batch_get ()
Batch * procedural_lines_batch_get ()
Batch * procedural_triangles_batch_get ()
Batch * procedural_triangle_strips_batch_get ()
void assert_framebuffer_shader_compatibility (Shader *sh)

Static Public Member Functions

static void check_error (const char *info)
static GLContext * get ()
static GLStateManager * state_manager_active_get ()
Static Public Member Functions inherited from blender::gpu::Context
static Context * get ()

Public Attributes

GLuint default_attr_vbo_
uint16_t bound_ubo_slots
uint16_t bound_ssbo_slots
Public Attributes inherited from blender::gpu::Context
Shader * shader = nullptr
FrameBuffer * active_fb = nullptr
GPUMatrixState * matrix_state = nullptr
StateManager * state_manager = nullptr
Immediate * imm = nullptr
FrameBuffer * back_left = nullptr
FrameBuffer * front_left = nullptr
FrameBuffer * back_right = nullptr
FrameBuffer * front_right = nullptr
DebugStack debug_stack
bool debug_is_capturing = false
bool debug_pipeline_creation = false
int context_id = 0
Vector< StorageBuf * > printf_buf
VertBuf * dummy_vbo = nullptr
Batch * procedural_points_batch = nullptr
Batch * procedural_lines_batch = nullptr
Batch * procedural_triangles_batch = nullptr
Batch * procedural_triangle_strips_batch = nullptr
TexturePool * texture_pool = nullptr
int shader_builtin_srgb_transform = 0
bool shader_builtin_srgb_is_dirty = false

Static Public Attributes

Capabilities
static GLint max_cubemap_size = 0
static GLint max_ubo_binds = 0
static GLint max_ssbo_binds = 0
static bool debug_layer_support = false
static bool direct_state_access_support = false
static bool framebuffer_fetch_support = false
static bool layered_rendering_support = false
static bool vertex_shader_viewport_index_support = false
static bool vertex_shader_layer_support = false
static bool native_barycentric_support = false
static bool multi_bind_support = false
static bool multi_bind_image_support = false
static bool stencil_texturing_support = false
static bool texture_barrier_support = false
static bool texture_filter_anisotropic_support = false
static bool derivative_control_support = false
static bool debug_layer_workaround = false
static bool unused_fb_slot_workaround = false
Static Public Attributes inherited from blender::gpu::Context
static std::atomic< int > context_counter = 0

Debug Groups

Useful for debugging through render-doc. This makes all the API calls grouped into "passes".

void debug_group_begin (const char *name, int index) override
void debug_group_end () override
bool debug_capture_begin (const char *title) override
void debug_capture_end () override
void * debug_capture_scope_create (const char *name) override
bool debug_capture_scope_begin (void *scope) override
void debug_capture_scope_end (void *scope) override
void debug_unbind_all_ubo () override
void debug_unbind_all_ssbo () override

Safe object deletion

GPU objects can be freed when the context is not bound. In this case we delay the deletion until the context is bound again.

void vao_free (GLuint vao_id)
void fbo_free (GLuint fbo_id)
static void buffer_free (GLuint buf_id)
static void texture_free (GLuint tex_id)
static void shader_free (GLuint shader_id)
static void program_free (GLuint program_id)

Additional Inherited Members

Protected Member Functions inherited from blender::gpu::Context
void free_resources ()
Protected Attributes inherited from blender::gpu::Context
pthread_t thread_
bool is_active_
GHOST_IWindow * ghost_window_

Detailed Description

Definition at line 49 of file gl_context.hh.

Constructor & Destructor Documentation

◆ GLContext()

◆ ~GLContext()

Member Function Documentation

◆ activate()

◆ begin_frame()

void blender::GLContext::begin_frame ( )
overridevirtual

Implements blender::gpu::Context.

Definition at line 169 of file gl_context.cc.

Referenced by check_error().

◆ buffer_free()

◆ check_error()

void blender::gpu::GLContext::check_error ( const char * info)
static

◆ deactivate()

void blender::GLContext::deactivate ( )
overridevirtual

Implements blender::gpu::Context.

Definition at line 163 of file gl_context.cc.

References blender::immDeactivate(), and blender::gpu::Context::is_active_.

Referenced by check_error().

◆ debug_capture_begin()

bool blender::gpu::GLContext::debug_capture_begin ( const char * title)
overridevirtual

◆ debug_capture_end()

void blender::gpu::GLContext::debug_capture_end ( )
overridevirtual

◆ debug_capture_scope_begin()

bool blender::gpu::GLContext::debug_capture_scope_begin ( void * scope)
overridevirtual

◆ debug_capture_scope_create()

void * blender::gpu::GLContext::debug_capture_scope_create ( const char * name)
overridevirtual

Implements blender::gpu::Context.

Definition at line 514 of file gl_debug.cc.

◆ debug_capture_scope_end()

void blender::gpu::GLContext::debug_capture_scope_end ( void * scope)
overridevirtual

◆ debug_group_begin()

void blender::gpu::GLContext::debug_group_begin ( const char * name,
int index )
overridevirtual

Reimplemented from blender::gpu::Context.

Definition at line 371 of file gl_debug.cc.

References blender::G, and blender::G_DEBUG_GPU.

◆ debug_group_end()

void blender::gpu::GLContext::debug_group_end ( )
overridevirtual

Reimplemented from blender::gpu::Context.

Definition at line 400 of file gl_debug.cc.

References CLOG_ERROR, blender::G, blender::G_DEBUG_GPU, blender::LOG, and lexit::Vector< T >::size().

◆ debug_unbind_all_ssbo()

void blender::gpu::GLContext::debug_unbind_all_ssbo ( )
overridevirtual

Implements blender::gpu::Context.

Definition at line 550 of file gl_debug.cc.

References bound_ssbo_slots.

◆ debug_unbind_all_ubo()

void blender::gpu::GLContext::debug_unbind_all_ubo ( )
overridevirtual

Implements blender::gpu::Context.

Definition at line 545 of file gl_debug.cc.

References bound_ubo_slots.

◆ end_frame()

void blender::GLContext::end_frame ( )
overridevirtual

Implements blender::gpu::Context.

Definition at line 174 of file gl_context.cc.

Referenced by check_error().

◆ fbo_free()

void blender::GLContext::fbo_free ( GLuint fbo_id)

Definition at line 274 of file gl_context.cc.

References get().

◆ finish()

void blender::GLContext::finish ( )
overridevirtual

Implements blender::gpu::Context.

Definition at line 190 of file gl_context.cc.

Referenced by check_error(), and ~GLContext().

◆ flush()

void blender::GLContext::flush ( )
overridevirtual

Implements blender::gpu::Context.

Definition at line 185 of file gl_context.cc.

Referenced by check_error().

◆ get()

◆ memory_statistics_get()

void blender::GLContext::memory_statistics_get ( int * r_total_mem,
int * r_free_mem )
overridevirtual

Implements blender::gpu::Context.

Definition at line 362 of file gl_context.cc.

Referenced by check_error().

◆ program_free()

void blender::GLContext::program_free ( GLuint program_id)
static

◆ shader_free()

void blender::GLContext::shader_free ( GLuint shader_id)
static

◆ state_manager_active_get()

◆ texture_free()

void blender::GLContext::texture_free ( GLuint tex_id)
static

◆ vao_cache_register()

void blender::GLContext::vao_cache_register ( GLVaoCache * cache)

Definition at line 342 of file gl_context.cc.

◆ vao_cache_unregister()

void blender::GLContext::vao_cache_unregister ( GLVaoCache * cache)

Definition at line 349 of file gl_context.cc.

◆ vao_free()

void blender::GLContext::vao_free ( GLuint vao_id)

Definition at line 264 of file gl_context.cc.

References get().

Member Data Documentation

◆ bound_ssbo_slots

◆ bound_ubo_slots

uint16_t blender::gpu::GLContext::bound_ubo_slots

Used for debugging purpose. Bit-flags of all bound slots.

Definition at line 86 of file gl_context.hh.

Referenced by activate(), blender::gpu::GLUniformBuf::bind(), debug_unbind_all_ubo(), and blender::gpu::GLUniformBuf::unbind().

◆ debug_layer_support

bool blender::gpu::GLContext::debug_layer_support = false
static

Extensions.

Definition at line 59 of file gl_context.hh.

Referenced by blender::gpu::detect_workarounds().

◆ debug_layer_workaround

bool blender::gpu::GLContext::debug_layer_workaround = false
static

Workarounds.

Definition at line 79 of file gl_context.hh.

Referenced by blender::gpu::detect_workarounds().

◆ default_attr_vbo_

GLuint blender::gpu::GLContext::default_attr_vbo_

VBO for missing vertex attribute binding. Avoid undefined behavior on some implementation.

Definition at line 83 of file gl_context.hh.

Referenced by GLContext(), blender::gpu::GLVertArray::update_bindings(), and ~GLContext().

◆ derivative_control_support

bool blender::gpu::GLContext::derivative_control_support = false
static

◆ direct_state_access_support

◆ framebuffer_fetch_support

◆ layered_rendering_support

bool blender::gpu::GLContext::layered_rendering_support = false
static

◆ max_cubemap_size

GLint blender::gpu::GLContext::max_cubemap_size = 0
static

Capabilities.

Internal capabilities.

Definition at line 53 of file gl_context.hh.

◆ max_ssbo_binds

GLint blender::gpu::GLContext::max_ssbo_binds = 0
static

Definition at line 55 of file gl_context.hh.

Referenced by blender::gpu::GLStorageBuf::bind().

◆ max_ubo_binds

GLint blender::gpu::GLContext::max_ubo_binds = 0
static

Definition at line 54 of file gl_context.hh.

Referenced by blender::gpu::GLUniformBuf::bind().

◆ multi_bind_image_support

bool blender::gpu::GLContext::multi_bind_image_support = false
static

Definition at line 71 of file gl_context.hh.

Referenced by blender::gpu::detect_workarounds().

◆ multi_bind_support

bool blender::gpu::GLContext::multi_bind_support = false
static

Definition at line 70 of file gl_context.hh.

Referenced by blender::gpu::detect_workarounds().

◆ native_barycentric_support

◆ stencil_texturing_support

bool blender::gpu::GLContext::stencil_texturing_support = false
static

Definition at line 72 of file gl_context.hh.

◆ texture_barrier_support

◆ texture_filter_anisotropic_support

bool blender::gpu::GLContext::texture_filter_anisotropic_support = false
static

◆ unused_fb_slot_workaround

bool blender::gpu::GLContext::unused_fb_slot_workaround = false
static

Definition at line 80 of file gl_context.hh.

Referenced by blender::gpu::detect_workarounds().

◆ vertex_shader_layer_support

bool blender::gpu::GLContext::vertex_shader_layer_support = false
static

◆ vertex_shader_viewport_index_support

bool blender::gpu::GLContext::vertex_shader_viewport_index_support = false
static

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