Blender V5.3
gpu_context.cc File Reference
#include "BKE_global.hh"
#include "BLI_assert.hh"
#include "BLI_threads.hh"
#include "BLI_vector_set.hh"
#include "DNA_userdef_types.h"
#include "GHOST_IContext.hh"
#include "GHOST_ISystem.hh"
#include "GHOST_Types.hh"
#include "GPU_context.hh"
#include "GPU_batch.hh"
#include "GPU_pass.hh"
#include "gpu_backend.hh"
#include "gpu_context_private.hh"
#include "gpu_matrix_private.hh"
#include "gpu_private.hh"
#include "gpu_shader_private.hh"
#include "dummy_backend.hh"
#include "draw_debug.hh"
#include <cstdio>
#include <mutex>

Go to the source code of this file.

Namespaces

namespace  blender
 BMesh Iterators.
namespace  blender::gpu

Functions

GPUContext * blender::GPU_context_create (GHOST_IWindow *ghost_window, GHOST_IContext *ghost_context)
void blender::GPU_context_discard (GPUContext *)
void blender::GPU_context_active_set (GPUContext *)
GPUContext * blender::GPU_context_active_get ()
void blender::GPU_context_begin_frame (GPUContext *ctx)
void blender::GPU_context_end_frame (GPUContext *ctx)
void blender::GPU_context_debug_pipeline_creation (GPUContext *ctx, bool enable)
 Enable shader create info pipeline state assert.
static GHOST_TDrawingContextType blender::gpu::ghost_context_type ()
GPUSecondaryContextData blender::gpu::GPU_create_secondary_context ()
void blender::gpu::GPU_activate_secondary_context (const GPUSecondaryContextData &data)
void blender::gpu::GPU_deactivate_secondary_context (const GPUSecondaryContextData &data)
void blender::gpu::GPU_destroy_secondary_context (GPUSecondaryContextData &data)
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 blender::GPU_render_begin ()
void blender::GPU_render_end ()
void blender::GPU_render_step (bool force_resource_release=false)

Variables

static Context * blender::active_ctx = nullptr
static Mutex blender::backend_users_mutex
static int blender::num_backend_users = 0

Main context global mutex

Used to avoid crash on some old drivers.

static Mutex blender::main_context_mutex
void blender::GPU_context_main_lock ()
void blender::GPU_context_main_unlock ()

Backend selection

static GPUBackendType blender::g_backend_type = GPU_BACKEND_OPENGL
static std::optional< GPUBackendType > blender::g_backend_type_override = std::nullopt
static std::optional< bool > blender::g_backend_type_supported = std::nullopt
static std::optional< GHOST_GPUDevice > blender::g_preferred_device_override = std::nullopt
static std::optional< int > blender::g_vsync_override = std::nullopt
static GPUBackend * blender::g_backend = nullptr
static GHOST_ISystem * blender::g_ghost_system = nullptr
static void blender::gpu_backend_create ()
static void blender::gpu_backend_discard ()
void blender::GPU_backend_ghost_system_set (GHOST_ISystem *ghost_system_handle)
GHOST_ISystem * blender::GPU_backend_ghost_system_get ()
void blender::GPU_backend_type_selection_set (const GPUBackendType backend)
int blender::GPU_backend_vsync_get ()
void blender::GPU_backend_vsync_set_override (int vsync)
bool blender::GPU_backend_vsync_is_overridden ()
GPUBackendType blender::GPU_backend_type_selection_get ()
void blender::GPU_backend_type_selection_set_override (GPUBackendType backend_type)
bool blender::GPU_backend_type_selection_is_overridden ()
void blender::GPU_backend_preferred_device_set_override (int index, uint32_t vendor_id, uint32_t device_id)
GHOST_GPUDevice blender::GPU_backend_preferred_device_get ()
static const char * blender::gpu_backend_type_name (const GPUBackendType backend_type)
bool blender::GPU_backend_type_selection_detect ()
static bool blender::gpu_backend_supported ()
bool blender::GPU_backend_supported ()
void blender::gpu_backend_init_resources ()
void blender::gpu_backend_delete_resources ()
GPUBackendType blender::GPU_backend_get_type ()
const char * blender::GPU_backend_get_name ()

Detailed Description

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

  • alloc must be called from a thread that is bound to the context that will be used for drawing with this VAO.
  • free can be called from any thread

Definition in file gpu_context.cc.