Blender
V3.3
|
#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 | |
GPUContext * | GPU_context_create (void *ghost_window) |
void | GPU_context_discard (GPUContext *ctx_) |
void | GPU_context_active_set (GPUContext *ctx_) |
GPUContext * | GPU_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 Context * | active_ctx = nullptr |
static std::mutex | backend_users_mutex |
static int | num_backend_users = 0 |
Main context global mutex | |
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 GPUBackend * | g_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 () |
Manage GL vertex array IDs in a thread-safe way Use these instead of glGenBuffers & its friends
Definition in file gpu_context.cc.
|
static |
Definition at line 239 of file gpu_context.cc.
References BLI_assert, g_backend, g_backend_type, GPU_BACKEND_METAL, GPU_BACKEND_OPENGL, and GPU_backend_supported().
Referenced by GPU_context_create().
Definition at line 261 of file gpu_context.cc.
References BLI_assert, blender::gpu::GPUBackend::delete_resources(), and g_backend.
Referenced by GPU_exit().
|
static |
Definition at line 267 of file gpu_context.cc.
References g_backend.
Referenced by GPU_context_discard().
eGPUBackendType GPU_backend_get_type | ( | void | ) |
Definition at line 274 of file gpu_context.cc.
References g_backend, GPU_BACKEND_METAL, GPU_BACKEND_NONE, and GPU_BACKEND_OPENGL.
Referenced by DRW_custom_pipeline(), is_subdivision_evaluation_possible_on_gpu(), and standard_defines().
Definition at line 218 of file gpu_context.cc.
References BLI_assert, g_backend_type, GPU_BACKEND_METAL, and GPU_BACKEND_OPENGL.
Referenced by gpu_backend_create(), RE_engine_render(), and WM_init_opengl().
GPUContext* GPU_context_active_get | ( | void | ) |
Definition at line 142 of file gpu_context.cc.
References blender::bke::image::partial_update::wrap().
Referenced by blender::gpu::MTLFrameBuffer::apply_state(), blender::gpu::MTLFrameBuffer::bake_render_pass_descriptor(), blender::gpu::MTLQueryPool::begin_query(), blender::gpu::MTLFrameBuffer::bind(), blender::gpu::MTLFrameBuffer::blit(), blender::gpu::MTLFrameBuffer::clear(), blender::gpu::MTLFrameBuffer::clear_attachment(), blender::gpu::MTLTexture::copy_to(), DRW_opengl_context_release(), blender::gpu::MTLQueryPool::end_query(), blender::gpu::MTLBackend::framebuffer_alloc(), blender::gpu::MTLTexture::generate_mipmap(), blender::gpu::MTLQueryPool::get_occlusion_result(), blender::gpu::MTLStateManager::issue_barrier(), pygpu_framebuffer__tp_new(), pygpu_offscreen__tp_new(), pygpu_texture__tp_new(), pygpu_uniformbuffer__tp_new(), blender::gpu::MTLStateManager::texture_bind(), blender::gpu::MTLStateManager::texture_unbind(), blender::gpu::MTLStateManager::texture_unbind_all(), blender::gpu::MTLStateManager::texture_unpack_row_length_set(), blender::gpu::MTLUniformBuf::update(), blender::gpu::MTLTexture::update_sub(), WM_init(), blender::gpu::MTLContext::~MTLContext(), blender::gpu::MTLFrameBuffer::~MTLFrameBuffer(), and blender::gpu::MTLTexture::~MTLTexture().
void GPU_context_active_set | ( | GPUContext * | ctx_ | ) |
Ctx can be NULL.
Definition at line 127 of file gpu_context.cc.
References blender::gpu::Context::activate(), active_ctx, blender::gpu::Context::deactivate(), and blender::bke::image::partial_update::unwrap().
Referenced by drw_deferred_shader_add(), drw_deferred_shader_compilation_exec(), drw_deferred_shader_compilation_free(), DRW_gpu_render_context_disable(), DRW_gpu_render_context_enable(), DRW_opengl_context_activate(), DRW_opengl_context_destroy(), DRW_opengl_context_disable_ex(), DRW_opengl_context_enable_ex(), DRW_opengl_context_release(), extrawindow_do_draw(), extrawindow_do_reshape(), GPU_context_create(), loggerwindow_do_draw(), loggerwindow_do_reshape(), mainwindow_do_draw(), mainwindow_do_reshape(), RE_gl_context_destroy(), wm_ghostwindow_destroy(), wm_main_playanim_intern(), wm_surface_clear_drawable(), wm_surface_set_drawable(), WM_window_pixel_sample_read(), WM_window_pixels_read(), and wm_window_set_drawable().
void GPU_context_begin_frame | ( | GPUContext * | ctx | ) |
Definition at line 147 of file gpu_context.cc.
References blender::gpu::Context::begin_frame(), and blender::bke::image::partial_update::unwrap().
Referenced by wm_draw_surface(), wm_draw_window(), and WM_init().
GPUContext* GPU_context_create | ( | void * | ghost_window | ) |
Definition at line 93 of file gpu_context.cc.
References backend_users_mutex, gpu_backend_create(), GPU_context_active_set(), lock, num_backend_users, and blender::bke::image::partial_update::wrap().
Referenced by drw_deferred_shader_add(), DRW_opengl_context_create(), eevee_lightbake_context_enable(), extrawindow_new(), blender::gpu::shader_builder::ShaderBuilder::init(), loggerwindow_new(), mainwindow_new(), RE_gpu_context_get(), blender::gpu::GPUTest::SetUp(), wm_main_playanim_intern(), and wm_window_ghostwindow_add().
void GPU_context_discard | ( | GPUContext * | ctx_ | ) |
To be called after #GPU_context_active_set(ctx_to_destroy).
Definition at line 110 of file gpu_context.cc.
References active_ctx, backend_users_mutex, BLI_assert, gpu_backend_discard(), lock, num_backend_users, and blender::bke::image::partial_update::unwrap().
Referenced by drw_deferred_shader_compilation_free(), DRW_opengl_context_destroy(), eevee_lightbake_delete_resources(), blender::gpu::shader_builder::ShaderBuilder::exit(), RE_gl_context_destroy(), blender::gpu::GPUTest::TearDown(), wm_ghostwindow_destroy(), and wm_main_playanim_intern().
void GPU_context_end_frame | ( | GPUContext * | ctx | ) |
Definition at line 155 of file gpu_context.cc.
References blender::gpu::Context::end_frame(), and blender::bke::image::partial_update::unwrap().
Referenced by wm_draw_surface(), wm_draw_window(), and WM_init().
Definition at line 171 of file gpu_context.cc.
References main_context_mutex.
Referenced by drw_deferred_shader_compilation_exec(), DRW_render_context_enable(), eevee_lightbake_context_enable(), and wm_draw_update().
Definition at line 176 of file gpu_context.cc.
References main_context_mutex.
Referenced by drw_deferred_shader_compilation_exec(), DRW_render_context_disable(), eevee_lightbake_context_disable(), and wm_draw_update().
Definition at line 190 of file gpu_context.cc.
References BLI_assert, and blender::gpu::GPUBackend::render_begin().
Referenced by drw_deferred_shader_compilation_exec(), DRW_opengl_context_enable_ex(), DRW_render_to_image(), wm_draw_update(), and WM_init().
Definition at line 196 of file gpu_context.cc.
References BLI_assert, and blender::gpu::GPUBackend::render_end().
Referenced by drw_deferred_shader_compilation_exec(), DRW_opengl_context_disable_ex(), DRW_render_to_image(), wm_draw_update(), and WM_init().
Definition at line 202 of file gpu_context.cc.
References BLI_assert, and blender::gpu::GPUBackend::render_step().
Referenced by EEVEE_render_draw(), wm_draw_update(), and workbench_render().
|
static |
Definition at line 45 of file gpu_context.cc.
Referenced by blender::gpu::Context::get(), GPU_context_active_set(), GPU_context_discard(), and blender::gpu::Context::is_active_on_thread().
|
static |
Definition at line 47 of file gpu_context.cc.
Referenced by GPU_context_create(), and GPU_context_discard().
|
static |
Definition at line 216 of file gpu_context.cc.
Referenced by blender::gpu::GPUBackend::get(), gpu_backend_create(), gpu_backend_delete_resources(), gpu_backend_discard(), and GPU_backend_get_type().
|
static |
Definition at line 215 of file gpu_context.cc.
Referenced by gpu_backend_create(), and GPU_backend_supported().
|
static |
Definition at line 169 of file gpu_context.cc.
Referenced by GPU_context_main_lock(), and GPU_context_main_unlock().
|
static |
Definition at line 48 of file gpu_context.cc.
Referenced by GPU_context_create(), and GPU_context_discard().