Blender V4.3
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)
 
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
 
- Public Member Functions inherited from blender::gpu::Context
 Context ()
 
virtual ~Context ()
 
bool is_active_on_thread ()
 

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
 
ShaderCompilercompiler = 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
 
GPUStorageBuf * printf_buf = nullptr
 

Static Public Attributes

Capabilities
static GLint max_cubemap_size = 0
 
static GLint max_ubo_size = 0
 
static GLint max_ubo_binds = 0
 
static GLint max_ssbo_binds = 0
 
static bool clear_texture_support = false
 
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 multi_draw_indirect_support = false
 
static bool shader_draw_parameters_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 float derivative_signs [2] = {1.0f, 1.0f}
 
- Static Public Attributes inherited from blender::gpu::Context
static int context_counter = 0
 

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 buf_free (GLuint buf_id)
 
static void tex_free (GLuint tex_id)
 

Additional Inherited Members

- Protected Attributes inherited from blender::gpu::Context
pthread_t thread_
 
bool is_active_
 
void * ghost_window_
 

Detailed Description

Definition at line 39 of file gl_context.hh.

Constructor & Destructor Documentation

◆ GLContext()

◆ ~GLContext()

Member Function Documentation

◆ activate()

◆ begin_frame()

void GLContext::begin_frame ( )
overridevirtual

Implements blender::gpu::Context.

Definition at line 156 of file gl_context.cc.

◆ buf_free()

◆ check_error()

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

◆ deactivate()

void GLContext::deactivate ( )
overridevirtual

Implements blender::gpu::Context.

Definition at line 150 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 438 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 384 of file gl_debug.cc.

References G, and G_DEBUG_GPU.

◆ debug_group_end()

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

Reimplemented from blender::gpu::Context.

Definition at line 395 of file gl_debug.cc.

References G, and G_DEBUG_GPU.

◆ debug_unbind_all_ssbo()

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

Implements blender::gpu::Context.

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

References bound_ubo_slots.

◆ end_frame()

void GLContext::end_frame ( )
overridevirtual

Implements blender::gpu::Context.

Definition at line 161 of file gl_context.cc.

◆ fbo_free()

void GLContext::fbo_free ( GLuint fbo_id)

Definition at line 244 of file gl_context.cc.

References get().

Referenced by blender::gpu::GLFrameBuffer::~GLFrameBuffer().

◆ finish()

void GLContext::finish ( )
overridevirtual

Implements blender::gpu::Context.

Definition at line 177 of file gl_context.cc.

◆ flush()

void GLContext::flush ( )
overridevirtual

Implements blender::gpu::Context.

Definition at line 172 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 308 of file gl_context.cc.

◆ state_manager_active_get()

◆ tex_free()

◆ vao_cache_register()

void GLContext::vao_cache_register ( GLVaoCache * cache)

Definition at line 288 of file gl_context.cc.

◆ vao_cache_unregister()

void GLContext::vao_cache_unregister ( GLVaoCache * cache)

Definition at line 295 of file gl_context.cc.

Referenced by blender::gpu::GLVaoCache::clear().

◆ vao_free()

void GLContext::vao_free ( GLuint vao_id)

Member Data Documentation

◆ bound_ssbo_slots

◆ bound_ubo_slots

uint16_t blender::gpu::GLContext::bound_ubo_slots

Used for debugging purpose. Bitflags of all bound slots.

Definition at line 76 of file gl_context.hh.

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

◆ clear_texture_support

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

Extensions.

Definition at line 50 of file gl_context.hh.

Referenced by blender::gpu::GLTexture::clear(), and blender::gpu::detect_workarounds().

◆ debug_layer_support

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

Definition at line 51 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 67 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 73 of file gl_context.hh.

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

◆ derivative_signs

float blender::gpu::GLContext::derivative_signs = {1.0f, 1.0f}
static

Definition at line 70 of file gl_context.hh.

Referenced by blender::gpu::detect_workarounds(), and glsl_patch_default_get().

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

◆ max_ssbo_binds

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

Definition at line 46 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 45 of file gl_context.hh.

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

◆ max_ubo_size

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

Definition at line 44 of file gl_context.hh.

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

◆ multi_bind_image_support

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

Definition at line 58 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 57 of file gl_context.hh.

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

◆ multi_draw_indirect_support

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

◆ native_barycentric_support

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

◆ shader_draw_parameters_support

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

◆ stencil_texturing_support

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

Definition at line 61 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 68 of file gl_context.hh.

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


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