Blender  V3.3
Namespaces | Functions | Variables
gpu_context.cc File Reference
#include "BLI_assert.h"
#include "BLI_utildefines.h"
#include "GPU_context.h"
#include "GPU_framebuffer.h"
#include "gpu_backend.hh"
#include "gpu_batch_private.hh"
#include "gpu_context_private.hh"
#include "gpu_matrix_private.h"
#include "gpu_private.h"
#include <mutex>
#include <vector>

Go to the source code of this file.

Namespaces

 blender
 
 blender::gpu
 

Functions

GPUContextGPU_context_create (void *ghost_window)
 
void GPU_context_discard (GPUContext *ctx_)
 
void GPU_context_active_set (GPUContext *ctx_)
 
GPUContextGPU_context_active_get ()
 
void GPU_context_begin_frame (GPUContext *ctx)
 
void GPU_context_end_frame (GPUContext *ctx)
 
GPU Begin/end work blocks

Used to explicitly define a per-frame block within which GPU work will happen. Used for global autoreleasepool flushing in Metal

void GPU_render_begin ()
 
void GPU_render_end ()
 
void GPU_render_step ()
 

Variables

static thread_local Contextactive_ctx = nullptr
 
static std::mutex backend_users_mutex
 
static int num_backend_users = 0
 

Main context global mutex

Used to avoid crash on some old drivers.

static std::mutex main_context_mutex
 
void GPU_context_main_lock ()
 
void GPU_context_main_unlock ()
 

Backend selection

static const eGPUBackendType g_backend_type = GPU_BACKEND_OPENGL
 
static GPUBackendg_backend = nullptr
 
static void gpu_backend_create ()
 
static void gpu_backend_discard ()
 
bool GPU_backend_supported (void)
 
void gpu_backend_delete_resources ()
 
eGPUBackendType GPU_backend_get_type ()
 

Detailed Description

Manage GL vertex array IDs in a thread-safe way Use these instead of glGenBuffers & its friends

Definition in file gpu_context.cc.

Function Documentation

◆ gpu_backend_create()

static void gpu_backend_create ( )
static

◆ gpu_backend_delete_resources()

void gpu_backend_delete_resources ( void  )

Definition at line 261 of file gpu_context.cc.

References BLI_assert, blender::gpu::GPUBackend::delete_resources(), and g_backend.

Referenced by GPU_exit().

◆ gpu_backend_discard()

void gpu_backend_discard ( )
static

Definition at line 267 of file gpu_context.cc.

References g_backend.

Referenced by GPU_context_discard().

◆ GPU_backend_get_type()

eGPUBackendType GPU_backend_get_type ( void  )

◆ GPU_backend_supported()

bool GPU_backend_supported ( void  )

◆ GPU_context_active_get()

GPUContext* GPU_context_active_get ( void  )

◆ GPU_context_active_set()

void GPU_context_active_set ( GPUContext ctx_)

◆ GPU_context_begin_frame()

void GPU_context_begin_frame ( GPUContext ctx)

◆ GPU_context_create()

GPUContext* GPU_context_create ( void ghost_window)

◆ GPU_context_discard()

void GPU_context_discard ( GPUContext ctx_)

◆ GPU_context_end_frame()

void GPU_context_end_frame ( GPUContext ctx)

◆ GPU_context_main_lock()

void GPU_context_main_lock ( void  )

◆ GPU_context_main_unlock()

void GPU_context_main_unlock ( void  )

◆ GPU_render_begin()

void GPU_render_begin ( void  )

◆ GPU_render_end()

void GPU_render_end ( void  )

◆ GPU_render_step()

void GPU_render_step ( void  )

Variable Documentation

◆ active_ctx

thread_local Context* active_ctx = nullptr
static

◆ backend_users_mutex

std::mutex backend_users_mutex
static

Definition at line 47 of file gpu_context.cc.

Referenced by GPU_context_create(), and GPU_context_discard().

◆ g_backend

GPUBackend* g_backend = nullptr
static

◆ g_backend_type

const eGPUBackendType g_backend_type = GPU_BACKEND_OPENGL
static

Definition at line 215 of file gpu_context.cc.

Referenced by gpu_backend_create(), and GPU_backend_supported().

◆ main_context_mutex

std::mutex main_context_mutex
static

Definition at line 169 of file gpu_context.cc.

Referenced by GPU_context_main_lock(), and GPU_context_main_unlock().

◆ num_backend_users

int num_backend_users = 0
static

Definition at line 48 of file gpu_context.cc.

Referenced by GPU_context_create(), and GPU_context_discard().