Blender V5.0
GPU_context.hh File Reference
#include "GPU_platform.hh"

Go to the source code of this file.

Classes

class  blender::gpu::GPUSecondaryContext

Namespaces

namespace  blender
namespace  blender::gpu

Functions

bool GPU_backend_supported ()
void GPU_backend_type_selection_set (const GPUBackendType backend)
GPUBackendType GPU_backend_type_selection_get ()
GPUBackendType GPU_backend_get_type ()
const char * GPU_backend_get_name ()
bool GPU_backend_type_selection_detect ()
void GPU_backend_type_selection_set_override (GPUBackendType backend_type)
bool GPU_backend_type_selection_is_overridden ()
int GPU_backend_vsync_get ()
void GPU_backend_vsync_set_override (int vsync)
bool GPU_backend_vsync_is_overridden ()
GPUContext * GPU_context_create (void *ghost_window, void *ghost_context)
void GPU_context_discard (GPUContext *)
void GPU_context_active_set (GPUContext *)
GPUContext * GPU_context_active_get ()
void GPU_context_begin_frame (GPUContext *ctx)
void GPU_context_end_frame (GPUContext *ctx)
void GPU_context_main_lock ()
void GPU_context_main_unlock ()
void GPU_render_begin ()
void GPU_render_end ()
void GPU_render_step (bool force_resource_release=false)
void GPU_backend_ghost_system_set (void *ghost_system_handle)
void * GPU_backend_ghost_system_get ()

Detailed Description

This interface allow GPU to manage VAOs for multiple context and threads.

Definition in file GPU_context.hh.

Function Documentation

◆ GPU_backend_get_name()

const char * GPU_backend_get_name ( )

◆ GPU_backend_get_type()

GPUBackendType GPU_backend_get_type ( )

Definition at line 514 of file gpu_context.cc.

References g_backend, GPU_BACKEND_METAL, GPU_BACKEND_NONE, GPU_BACKEND_OPENGL, and GPU_BACKEND_VULKAN.

Referenced by blender::render::hydra::GPURenderTaskDelegate::bind(), buffer_from_list_inputs_sort(), blender::opensubdiv::compile_eval_patches_shader(), blender::opensubdiv::compile_eval_stencil_shader(), blender::opensubdiv::GPUVertexBuffer::Create(), blender::draw::compositor_engine::Instance::draw(), blender::workbench::Instance::draw_image_render(), blender::eevee::Instance::draw_viewport(), DRW_custom_pipeline_end(), blender::render::hydra::Engine::Engine(), get_padded_gpu_type(), GPU_backend_get_name(), GPU_pass_should_optimize(), GPU_shader_builtin_warm_up(), gpu_shader_create_info_compile(), BlenderDisplayDriver::graphics_interop_get_device(), BlenderDisplayDriver::graphics_interop_update_buffer(), immDrawPixelsTexTiled_scaling_clipping(), blender::eevee::ShadowModule::init(), is_subdivision_evaluation_possible_on_gpu(), playanim_toscreen_ex(), pygpu_platform_backend_type_get(), RE_PreviewRender(), blender::eevee::Instance::render_frame(), screen_opengl_render_doit(), blender::eevee::ShadowModule::set_view(), standard_defines(), blender::gpu::tests::test_texture_1d(), blender::gpu::tests::test_texture_1d_array(), blender::gpu::tests::test_texture_1d_array_upload(), blender::gpu::tests::test_texture_roundtrip__GPU_DATA_2_10_10_10_REV__GPU_RGB10_A2UI(), blender::gpu::tests::test_texture_roundtrip__GPU_DATA_FLOAT__GPU_DEPTH32F_STENCIL8(), WM_platform_support_perform_checks(), and wm_xr_init().

◆ GPU_backend_ghost_system_get()

void * GPU_backend_ghost_system_get ( )

◆ GPU_backend_ghost_system_set()

void GPU_backend_ghost_system_set ( void * ghost_system_handle)

For when we need access to a system context in order to create a GPU context.

Definition at line 354 of file gpu_context.cc.

References g_ghost_system.

Referenced by multitestapp_new(), blender::gpu::GPUTest::SetUpTestSuite(), wm_ghost_init(), wm_ghost_init_background(), and wm_main_playanim_intern().

◆ GPU_backend_supported()

◆ GPU_backend_type_selection_detect()

bool GPU_backend_type_selection_detect ( )

Detect the most suited GPUBackendType.

  • The detected backend will be set in GPU_backend_type_selection_set.
  • When GPU_backend_type_selection_is_overridden it checks the overridden backend. When not overridden it checks a default list.
  • OpenGL backend will be checked as a fallback for Metal.

Returns true when detection found a supported backend, otherwise returns false. When no supported backend is found GPU_backend_type_selection_set is called with GPU_BACKEND_NONE.

Definition at line 400 of file gpu_context.cc.

References blender::VectorSet< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::add(), G, g_backend_type_override, G_FLAG_GPU_BACKEND_FALLBACK, GPU_BACKEND_METAL, GPU_BACKEND_NONE, GPU_BACKEND_OPENGL, GPU_backend_supported(), GPU_backend_type_selection_set(), and GPU_BACKEND_VULKAN.

Referenced by wm_init_userdef(), and wm_main_playanim_intern().

◆ GPU_backend_type_selection_get()

GPUBackendType GPU_backend_type_selection_get ( )

◆ GPU_backend_type_selection_is_overridden()

bool GPU_backend_type_selection_is_overridden ( )

Check if the GPU_backend_type_selection_detect is overridden to only test a specific backend.

Definition at line 395 of file gpu_context.cc.

References g_backend_type_override.

Referenced by wm_gpu_backend_override_from_userdef().

◆ GPU_backend_type_selection_set()

void GPU_backend_type_selection_set ( const GPUBackendType backend)

◆ GPU_backend_type_selection_set_override()

void GPU_backend_type_selection_set_override ( GPUBackendType backend_type)

Alter the GPU_backend_type_selection_detect to only test a specific backend

Definition at line 390 of file gpu_context.cc.

References g_backend_type_override.

Referenced by arg_handle_gpu_backend_set(), and wm_gpu_backend_override_from_userdef().

◆ GPU_backend_vsync_get()

int GPU_backend_vsync_get ( )

Get the VSync value (when set).

Definition at line 370 of file gpu_context.cc.

References g_vsync_override.

Referenced by playanim_window_open(), WM_system_gpu_context_create(), and wm_window_ghostwindow_add().

◆ GPU_backend_vsync_is_overridden()

bool GPU_backend_vsync_is_overridden ( )

◆ GPU_backend_vsync_set_override()

void GPU_backend_vsync_set_override ( int vsync)

Override the default VSync.

Parameters
vsyncSee GHOST_TVSyncModes for details.

Definition at line 375 of file gpu_context.cc.

References g_vsync_override.

Referenced by arg_handle_gpu_vsync_set().

◆ GPU_context_active_get()

◆ GPU_context_active_set()

◆ GPU_context_begin_frame()

void GPU_context_begin_frame ( GPUContext * ctx)

Begin and end frame are used to mark the singular boundary representing the lifetime of a whole frame. This also acts as a divisor for ensuring workload submission and flushing, especially for background rendering when there is no call to present. This is required by explicit-API's where there is no implicit workload flushing.

Definition at line 265 of file gpu_context.cc.

References blender::gpu::Context::begin_frame(), and blender::gpu::unwrap().

Referenced by ContextShared::enable(), playanim_toscreen_ex(), blender::gpu::GPUTest::SetUpTestSuite(), wm_draw_surface(), wm_draw_window(), and WM_init().

◆ GPU_context_create()

◆ GPU_context_discard()

◆ GPU_context_end_frame()

◆ GPU_context_main_lock()

void GPU_context_main_lock ( )

Legacy GPU (Intel HD4000 series) do not support sharing GPU objects between GPU contexts. EEVEE/Workbench can create different contexts for image/preview rendering, baking or compiling. When a legacy GPU is detected (GPU_use_main_context_workaround()) any worker threads should use the draw manager opengl context and make sure that they are the only one using it by locking the main context using these two functions.

Definition at line 289 of file gpu_context.cc.

References main_context_mutex.

Referenced by DRW_render_context_enable(), and wm_draw_update().

◆ GPU_context_main_unlock()

void GPU_context_main_unlock ( )

Definition at line 294 of file gpu_context.cc.

References main_context_mutex.

Referenced by DRW_render_context_disable(), and wm_draw_update().

◆ GPU_render_begin()

void GPU_render_begin ( )

GPU Begin/end work blocks

Definition at line 308 of file gpu_context.cc.

References active_ctx, BLI_assert, blender::gpu::GPUBackend::get(), blender::gpu::printf_begin(), and blender::gpu::GPUBackend::render_begin().

Referenced by DRW_render_context_enable(), DRW_render_to_image(), DRW_submission_start(), ContextShared::enable(), blender::render::Compositor::execute(), blender::gpu::tests::gpu_shader_lib_test(), playanim_toscreen_ex(), RE_engine_gpu_context_enable(), RE_PreviewRender(), blender::gpu::GPUTest::SetUpTestSuite(), blender::gpu::tests::ShaderSpecializationConst::ShaderSpecializationConst(), blender::draw::test_draw_resource_id_gen(), blender::draw::test_draw_visibility(), blender::draw::test_eevee_lut_gen(), blender::draw::test_eevee_shadow_finalize(), blender::draw::test_eevee_shadow_free(), blender::draw::test_eevee_shadow_page_mask_ex(), blender::draw::test_eevee_shadow_shift(), blender::draw::test_eevee_shadow_shift_clear(), blender::draw::test_eevee_shadow_tag_update(), blender::draw::test_eevee_shadow_tilemap_amend(), blender::draw::test_eevee_surfel_list(), blender::gpu::tests::test_framebuffer_cube(), blender::gpu::tests::test_framebuffer_multi_viewport(), blender::gpu::tests::test_framebuffer_subpass_input(), blender::gpu::tests::test_texture_1d(), blender::gpu::tests::test_texture_1d_array(), blender::gpu::tests::test_texture_1d_array_upload(), blender::gpu::tests::test_texture_2d_array(), blender::gpu::tests::test_texture_2d_array_upload(), blender::gpu::tests::test_texture_3d(), blender::gpu::tests::test_texture_copy(), blender::gpu::tests::test_texture_cube(), blender::gpu::tests::test_texture_cube_array(), blender::gpu::tests::test_texture_read(), blender::draw::TestAlloc::TestAlloc(), wm_draw_update(), wm_event_do_handlers(), wm_event_do_notifiers(), WM_init(), wm_main_playanim_intern(), wm_window_events_process(), and wm_window_ghostwindow_add().

◆ GPU_render_end()

void GPU_render_end ( )

Definition at line 319 of file gpu_context.cc.

References active_ctx, BLI_assert, blender::gpu::GPUBackend::get(), blender::gpu::printf_end(), and blender::gpu::GPUBackend::render_end().

Referenced by ContextShared::disable(), DRW_render_context_disable(), DRW_render_to_image(), DRW_submission_end(), blender::render::Compositor::execute(), blender::gpu::tests::gpu_shader_lib_test(), playanim_toscreen_ex(), RE_engine_gpu_context_disable(), RE_PreviewRender(), blender::gpu::tests::ShaderSpecializationConst::ShaderSpecializationConst(), blender::gpu::GPUTest::TearDownTestSuite(), blender::draw::test_draw_resource_id_gen(), blender::draw::test_draw_visibility(), blender::draw::test_eevee_lut_gen(), blender::draw::test_eevee_shadow_finalize(), blender::draw::test_eevee_shadow_free(), blender::draw::test_eevee_shadow_page_mask_ex(), blender::draw::test_eevee_shadow_shift(), blender::draw::test_eevee_shadow_shift_clear(), blender::draw::test_eevee_shadow_tag_update(), blender::draw::test_eevee_shadow_tilemap_amend(), blender::draw::test_eevee_surfel_list(), blender::gpu::tests::test_framebuffer_cube(), blender::gpu::tests::test_framebuffer_multi_viewport(), blender::gpu::tests::test_framebuffer_subpass_input(), blender::gpu::tests::test_texture_1d(), blender::gpu::tests::test_texture_1d_array(), blender::gpu::tests::test_texture_1d_array_upload(), blender::gpu::tests::test_texture_2d_array(), blender::gpu::tests::test_texture_2d_array_upload(), blender::gpu::tests::test_texture_3d(), blender::gpu::tests::test_texture_copy(), blender::gpu::tests::test_texture_cube(), blender::gpu::tests::test_texture_cube_array(), blender::gpu::tests::test_texture_read(), blender::draw::TestAlloc::TestAlloc(), wm_draw_update(), wm_event_do_handlers(), wm_event_do_notifiers(), WM_init(), wm_main_playanim_intern(), wm_window_events_process(), and wm_window_ghostwindow_add().

◆ GPU_render_step()