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

#include <gl_context.hh>

Inherits blender::gpu::Context.

Public Member Functions

Constructor / Destructor
 GLContext (void *ghost_window, 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 ()
VertBufdummy_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 GLContextget ()
static GLStateManagerstate_manager_active_get ()
Static Public Member Functions inherited from blender::gpu::Context
static Contextget ()

Public Attributes

GLuint default_attr_vbo_
uint16_t bound_ubo_slots
uint16_t bound_ssbo_slots
Public Attributes inherited from blender::gpu::Context
Shadershader = nullptr
FrameBufferactive_fb = nullptr
GPUMatrixStatematrix_state = nullptr
StateManagerstate_manager = nullptr
Immediateimm = nullptr
FrameBufferback_left = nullptr
FrameBufferfront_left = nullptr
FrameBufferback_right = nullptr
FrameBufferfront_right = nullptr
DebugStack debug_stack
bool debug_is_capturing = false
int context_id = 0
Vector< StorageBuf * > printf_buf
VertBufdummy_vbo = nullptr
Batch * procedural_points_batch = nullptr
Batch * procedural_lines_batch = nullptr
Batch * procedural_triangles_batch = nullptr
Batch * procedural_triangle_strips_batch = nullptr
TexturePooltexture_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 explicit_location_support = false
static bool framebuffer_fetch_support = false
static bool layered_rendering_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 debug_layer_workaround = false
static bool unused_fb_slot_workaround = false
static bool generate_mipmap_workaround = false
Static Public Attributes inherited from blender::gpu::Context
static 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_
void * ghost_window_

Detailed Description

Definition at line 50 of file gl_context.hh.

Constructor & Destructor Documentation

◆ GLContext()

◆ ~GLContext()

GLContext::~GLContext ( )

Member Function Documentation

◆ activate()

◆ begin_frame()

void GLContext::begin_frame ( )
overridevirtual

Implements blender::gpu::Context.

Definition at line 159 of file gl_context.cc.

◆ buffer_free()

◆ check_error()

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

◆ deactivate()

void GLContext::deactivate ( )
overridevirtual

Implements blender::gpu::Context.

Definition at line 153 of file gl_context.cc.

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

◆ 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 512 of file gl_debug.cc.

References name.

◆ 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 369 of file gl_debug.cc.

References G, G_DEBUG_GPU, and name.

◆ debug_group_end()

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

◆ debug_unbind_all_ssbo()

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

Implements blender::gpu::Context.

Definition at line 548 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 543 of file gl_debug.cc.

References bound_ubo_slots.

◆ end_frame()

void GLContext::end_frame ( )
overridevirtual

Implements blender::gpu::Context.

Definition at line 164 of file gl_context.cc.

◆ fbo_free()

void GLContext::fbo_free ( GLuint fbo_id)

Definition at line 264 of file gl_context.cc.

References get().

◆ finish()

void GLContext::finish ( )
overridevirtual

Implements blender::gpu::Context.

Definition at line 180 of file gl_context.cc.

Referenced by ~GLContext().

◆ flush()

void GLContext::flush ( )
overridevirtual

Implements blender::gpu::Context.

Definition at line 175 of file gl_context.cc.

◆ get()

◆ memory_statistics_get()

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

Implements blender::gpu::Context.

Definition at line 352 of file gl_context.cc.

◆ program_free()

void GLContext::program_free ( GLuint program_id)
static

◆ shader_free()

void GLContext::shader_free ( GLuint shader_id)
static

◆ state_manager_active_get()

◆ texture_free()

void GLContext::texture_free ( GLuint tex_id)
static

◆ vao_cache_register()

void GLContext::vao_cache_register ( GLVaoCache * cache)

Definition at line 332 of file gl_context.cc.

◆ vao_cache_unregister()

void GLContext::vao_cache_unregister ( GLVaoCache * cache)

Definition at line 339 of file gl_context.cc.

◆ vao_free()

void GLContext::vao_free ( GLuint vao_id)

Definition at line 254 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 82 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 60 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 74 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 79 of file gl_context.hh.

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

◆ direct_state_access_support

◆ explicit_location_support

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

◆ framebuffer_fetch_support

◆ generate_mipmap_workaround

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

Definition at line 76 of file gl_context.hh.

Referenced by blender::gpu::GLTexture::generate_mipmap().

◆ 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 54 of file gl_context.hh.

◆ max_ssbo_binds

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

Definition at line 56 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 55 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 67 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 66 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 68 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 75 of file gl_context.hh.

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


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