Blender V5.3
DRW_engine.hh File Reference
#include "BLI_string_ref.hh"

Go to the source code of this file.

Namespaces

namespace  blender
 BMesh Iterators.
namespace  blender::bke
namespace  blender::draw

Typedefs

using blender::DRW_SelectPassFn = bool (*)(eDRWSelectStage stage, void *user_data)
using blender::DRW_ObjectFilterFn = bool (*)(Object *ob, void *user_data)

Enumerations

enum  blender::eDRWSelectStage { blender::DRW_SELECT_PASS_PRE = 1 , blender::DRW_SELECT_PASS_POST }

Functions

void blender::DRW_engine_external_free (RegionView3D *rv3d)
void blender::draw::DRW_cache_free_old_subdiv ()
void blender::draw::DRW_cdlayer_attr_aliases_add (GPUVertFormat *format, const char *base_name, bke::AttrType data_type, StringRef layer_name, bool is_active_render, bool is_active_layer)
DRW_engines
void blender::DRW_engines_register ()
void blender::DRW_engines_free ()
DRW_module
void blender::DRW_module_init ()
void blender::DRW_module_exit ()
Main Draw Loops (DRW_draw)
void blender::DRW_draw_view (const bContext *C)
void blender::DRW_draw_render_loop_offscreen (Depsgraph *depsgraph, RenderEngineType *engine_type, ARegion *region, View3D *v3d, bContext *context, bool is_image_render, bool draw_background, bool do_color_management, GPUOffScreen *ofs, GPUViewport *viewport)
void blender::DRW_draw_select_loop (Depsgraph *depsgraph, ARegion *region, View3D *v3d, bool draw_surface, bool use_nearest, bool do_material_sub_selection, const rcti *rect, DRW_SelectPassFn select_pass_fn, void *select_pass_user_data, DRW_ObjectFilterFn object_filter_fn, void *object_filter_user_data)
void blender::DRW_draw_depth_loop (Depsgraph *depsgraph, ARegion *region, View3D *v3d, GPUViewport *viewport, const bool use_gpencil, const bool use_only_selected, const bool use_only_active_object)
void blender::DRW_draw_select_id (Depsgraph *depsgraph, ARegion *region, View3D *v3d)
bool blender::DRW_draw_in_progress ()
bool blender::DRW_render_check_grease_pencil (Depsgraph *depsgraph, View3D *v3d=nullptr)
void blender::DRW_render_gpencil (RenderEngine *engine, Depsgraph *depsgraph)
Rendering (DRW_engines)
void blender::DRW_draw_region_engine_info (int xoffset, int *yoffset, int line_height)
Draw GPU Context
void blender::DRW_render_context_enable (Render *render)
void blender::DRW_render_context_disable (Render *render)
void blender::DRW_gpu_context_enable ()
bool blender::DRW_gpu_context_try_enable ()
bool blender::DRW_gpu_context_is_enabled ()
void blender::DRW_gpu_context_disable ()
void blender::DRW_gpu_context_enable_ex (bool restore)
void blender::DRW_gpu_context_disable_ex (bool restore)
void blender::DRW_system_gpu_render_context_enable (GHOST_IContext *re_system_gpu_context)
void blender::DRW_system_gpu_render_context_disable (GHOST_IContext *re_system_gpu_context)
void blender::DRW_blender_gpu_render_context_enable (void *re_gpu_context)
void blender::DRW_blender_gpu_render_context_disable (void *re_gpu_context)
Submission critical section

The usage of gpu::Shader objects is currently not thread safe. Since they are shared resources between render engine instances, we cannot allow pass submissions in a concurrent manner.

void blender::DRW_mutexes_init ()
void blender::DRW_mutexes_exit ()
void blender::DRW_lock_start ()
void blender::DRW_lock_end ()
void blender::DRW_submission_start ()
void blender::DRW_submission_end ()
GPU & System Context

A global GPUContext is used for rendering every viewports (even on different windows). This is because some resources cannot be shared between contexts (GPUFramebuffers, GPUBatch).

void blender::DRW_gpu_context_create ()
void blender::DRW_gpu_context_destroy ()
Garbage Collection
void blender::DRW_cache_free_old_batches (Main *bmain)
Viewport (DRW_viewport)
DRWData * blender::DRW_viewport_data_create ()
void blender::DRW_viewport_data_free (DRWData *drw_data)
Draw manager context release/activation

These functions are used in cases when an GPU context creation is needed during the draw. This happens, for example, when an external engine needs to create its own GPU context from the engine initialization.

Example of context creation:

const bool drw_state = DRW_gpu_context_release(); viewport_system_gpu_context = WM_system_gpu_context_create(); DRW_gpu_context_activate(drw_state);

Example of context destruction:

const bool drw_state = DRW_gpu_context_release(); WM_system_gpu_context_activate(viewport_system_gpu_context); WM_system_gpu_context_dispose(viewport_system_gpu_context); DRW_gpu_context_activate(drw_state);

NOTE: Will only perform context modification when on main thread. This way these functions can be used in an engine without check on whether it is a draw manager which manages GPU context on the current thread. The downside of this is that if the engine performs GPU creation from a non-main thread, that thread is supposed to not have GPU context ever bound by Blender.

bool blender::DRW_gpu_context_release ()
void blender::DRW_gpu_context_activate (bool drw_state)