Blender V4.3
draw_manager_data.cc File Reference
#include "DRW_pbvh.hh"
#include "draw_attributes.hh"
#include "draw_manager_c.hh"
#include "BKE_attribute.hh"
#include "BKE_curve.hh"
#include "BKE_duplilist.hh"
#include "BKE_global.hh"
#include "BKE_image.hh"
#include "BKE_mesh.hh"
#include "BKE_object.hh"
#include "BKE_paint.hh"
#include "BKE_volume.hh"
#include "WM_api.hh"
#include "wm_window.hh"
#include "DNA_curve_types.h"
#include "DNA_mesh_types.h"
#include "DNA_meta_types.h"
#include "DNA_screen_types.h"
#include "BLI_array.hh"
#include "BLI_hash.h"
#include "BLI_link_utils.h"
#include "BLI_listbase.h"
#include "BLI_math_bits.h"
#include "BLI_memblock.h"
#include "BLI_mempool.h"
#include "GPU_capabilities.hh"
#include "GPU_material.hh"
#include "GPU_uniform_buffer.hh"
#include "intern/gpu_codegen.hh"
#include "../../blenlib/intern/list_sort_impl.h"

Go to the source code of this file.

Classes

struct  DRWSculptCallbackData
 

Macros

#define DISABLE_DEBUG_SHADER_PRINT_BARRIER
 
#define KEY(a)   ((size_t((a).draw.batch) >> 6) % ARRAY_SIZE(idx))
 

Functions

Uniform Buffer Object (DRW_uniformbuffer)
static void draw_call_sort (DRWCommand *array, DRWCommand *array_tmp, int array_len)
 
void drw_resource_buffer_finish (DRWData *vmempool)
 
Uniforms (DRW_shgroup_uniform)
static void drw_shgroup_uniform_create_ex (DRWShadingGroup *shgroup, int loc, DRWUniformType type, const void *value, GPUSamplerState sampler_state, int length, int arraysize)
 
static void drw_shgroup_uniform (DRWShadingGroup *shgroup, const char *name, DRWUniformType type, const void *value, int length, int arraysize)
 
void DRW_shgroup_uniform_texture_ex (DRWShadingGroup *shgroup, const char *name, const GPUTexture *tex, GPUSamplerState sampler_state)
 
void DRW_shgroup_uniform_texture (DRWShadingGroup *shgroup, const char *name, const GPUTexture *tex)
 
void DRW_shgroup_uniform_texture_ref_ex (DRWShadingGroup *shgroup, const char *name, GPUTexture **tex, GPUSamplerState sampler_state)
 
void DRW_shgroup_uniform_texture_ref (DRWShadingGroup *shgroup, const char *name, GPUTexture **tex)
 
void DRW_shgroup_uniform_image (DRWShadingGroup *shgroup, const char *name, const GPUTexture *tex)
 
void DRW_shgroup_uniform_image_ref (DRWShadingGroup *shgroup, const char *name, GPUTexture **tex)
 
void DRW_shgroup_uniform_block_ex (DRWShadingGroup *shgroup, const char *name, const GPUUniformBuf *ubo DRW_DEBUG_FILE_LINE_ARGS)
 
void DRW_shgroup_uniform_block_ref_ex (DRWShadingGroup *shgroup, const char *name, GPUUniformBuf **ubo DRW_DEBUG_FILE_LINE_ARGS)
 
void DRW_shgroup_storage_block_ex (DRWShadingGroup *shgroup, const char *name, const GPUStorageBuf *ssbo DRW_DEBUG_FILE_LINE_ARGS)
 
void DRW_shgroup_storage_block_ref_ex (DRWShadingGroup *shgroup, const char *name, GPUStorageBuf **ssbo DRW_DEBUG_FILE_LINE_ARGS)
 
void DRW_shgroup_uniform_bool (DRWShadingGroup *shgroup, const char *name, const int *value, int arraysize)
 
void DRW_shgroup_uniform_float (DRWShadingGroup *shgroup, const char *name, const float *value, int arraysize)
 
void DRW_shgroup_uniform_vec2 (DRWShadingGroup *shgroup, const char *name, const float *value, int arraysize)
 
void DRW_shgroup_uniform_vec3 (DRWShadingGroup *shgroup, const char *name, const float *value, int arraysize)
 
void DRW_shgroup_uniform_vec4 (DRWShadingGroup *shgroup, const char *name, const float *value, int arraysize)
 
void DRW_shgroup_uniform_int (DRWShadingGroup *shgroup, const char *name, const int *value, int arraysize)
 
void DRW_shgroup_uniform_ivec2 (DRWShadingGroup *shgroup, const char *name, const int *value, int arraysize)
 
void DRW_shgroup_uniform_ivec3 (DRWShadingGroup *shgroup, const char *name, const int *value, int arraysize)
 
void DRW_shgroup_uniform_ivec4 (DRWShadingGroup *shgroup, const char *name, const int *value, int arraysize)
 
void DRW_shgroup_uniform_mat3 (DRWShadingGroup *shgroup, const char *name, const float(*value)[3])
 
void DRW_shgroup_uniform_mat4 (DRWShadingGroup *shgroup, const char *name, const float(*value)[4])
 
void DRW_shgroup_uniform_int_copy (DRWShadingGroup *shgroup, const char *name, const int value)
 
void DRW_shgroup_uniform_ivec2_copy (DRWShadingGroup *shgroup, const char *name, const int *value)
 
void DRW_shgroup_uniform_ivec3_copy (DRWShadingGroup *shgroup, const char *name, const int *value)
 
void DRW_shgroup_uniform_ivec4_copy (DRWShadingGroup *shgroup, const char *name, const int *value)
 
void DRW_shgroup_uniform_bool_copy (DRWShadingGroup *shgroup, const char *name, const bool value)
 
void DRW_shgroup_uniform_float_copy (DRWShadingGroup *shgroup, const char *name, const float value)
 
void DRW_shgroup_uniform_vec2_copy (DRWShadingGroup *shgroup, const char *name, const float *value)
 
void DRW_shgroup_uniform_vec3_copy (DRWShadingGroup *shgroup, const char *name, const float *value)
 
void DRW_shgroup_uniform_vec4_copy (DRWShadingGroup *shgroup, const char *name, const float *value)
 
void DRW_shgroup_uniform_mat4_copy (DRWShadingGroup *shgroup, const char *name, const float(*value)[4])
 
void DRW_shgroup_vertex_buffer_ex (DRWShadingGroup *shgroup, const char *name, blender::gpu::VertBuf *vertex_buffer DRW_DEBUG_FILE_LINE_ARGS)
 
void DRW_shgroup_vertex_buffer_ref_ex (DRWShadingGroup *shgroup, const char *name, blender::gpu::VertBuf **vertex_buffer DRW_DEBUG_FILE_LINE_ARGS)
 
void DRW_shgroup_buffer_texture (DRWShadingGroup *shgroup, const char *name, blender::gpu::VertBuf *vertex_buffer)
 
void DRW_shgroup_buffer_texture_ref (DRWShadingGroup *shgroup, const char *name, blender::gpu::VertBuf **vertex_buffer)
 
Shading Groups (DRW_shgroup)
static void drw_shgroup_init (DRWShadingGroup *shgroup, GPUShader *shader)
 
static DRWShadingGroupdrw_shgroup_create_ex (GPUShader *shader, DRWPass *pass)
 
static DRWShadingGroupdrw_shgroup_material_create_ex (GPUPass *gpupass, DRWPass *pass)
 
static void drw_shgroup_material_texture (DRWShadingGroup *grp, GPUTexture *gputex, const char *name, GPUSamplerState state)
 
void DRW_shgroup_add_material_resources (DRWShadingGroup *grp, GPUMaterial *material)
 
GPUVertFormatDRW_shgroup_instance_format_array (const DRWInstanceAttrFormat attrs[], int arraysize)
 
DRWShadingGroupDRW_shgroup_material_create (GPUMaterial *material, DRWPass *pass)
 
DRWShadingGroupDRW_shgroup_create (GPUShader *shader, DRWPass *pass)
 
DRWShadingGroupDRW_shgroup_transform_feedback_create (GPUShader *shader, DRWPass *pass, blender::gpu::VertBuf *tf_target)
 
void DRW_shgroup_state_enable (DRWShadingGroup *shgroup, DRWState state)
 
void DRW_shgroup_state_disable (DRWShadingGroup *shgroup, DRWState state)
 
void DRW_shgroup_stencil_set (DRWShadingGroup *shgroup, uint write_mask, uint reference, uint compare_mask)
 
void DRW_shgroup_stencil_mask (DRWShadingGroup *shgroup, uint mask)
 
void DRW_shgroup_clear_framebuffer (DRWShadingGroup *shgroup, eGPUFrameBufferBits channels, uchar r, uchar g, uchar b, uchar a, float depth, uchar stencil)
 
bool DRW_shgroup_is_empty (DRWShadingGroup *shgroup)
 
DRWShadingGroupDRW_shgroup_create_sub (DRWShadingGroup *shgroup)
 
View (DRW_view)
static void draw_frustum_boundbox_calc (const float(*viewinv)[4], const float(*projmat)[4], BoundBox *r_bbox)
 
static void draw_frustum_culling_planes_calc (const float(*persmat)[4], float(*frustum_planes)[4])
 
static void draw_frustum_bound_sphere_calc (const BoundBox *bbox, const float(*viewinv)[4], const float(*projmat)[4], const float(*projinv)[4], BoundSphere *bsphere)
 
static void draw_view_matrix_state_update (DRWView *view, const float viewmat[4][4], const float winmat[4][4])
 
DRWViewDRW_view_create (const float viewmat[4][4], const float winmat[4][4], const float(*culling_viewmat)[4], const float(*culling_winmat)[4], DRWCallVisibilityFn *visibility_fn)
 
DRWViewDRW_view_create_sub (const DRWView *parent_view, const float viewmat[4][4], const float winmat[4][4])
 
void DRW_view_update_sub (DRWView *view, const float viewmat[4][4], const float winmat[4][4])
 
void DRW_view_update (DRWView *view, const float viewmat[4][4], const float winmat[4][4], const float(*culling_viewmat)[4], const float(*culling_winmat)[4])
 
const DRWViewDRW_view_default_get ()
 
void DRW_view_reset ()
 
void DRW_view_default_set (const DRWView *view)
 
void DRW_view_clip_planes_set (DRWView *view, float(*planes)[4], int plane_len)
 
void DRW_view_frustum_corners_get (const DRWView *view, BoundBox *corners)
 
void DRW_view_frustum_planes_get (const DRWView *view, float planes[6][4])
 
bool DRW_view_is_persp_get (const DRWView *view)
 
float DRW_view_near_distance_get (const DRWView *view)
 
float DRW_view_far_distance_get (const DRWView *view)
 
void DRW_view_viewmat_get (const DRWView *view, float mat[4][4], bool inverse)
 
void DRW_view_winmat_get (const DRWView *view, float mat[4][4], bool inverse)
 
void DRW_view_persmat_get (const DRWView *view, float mat[4][4], bool inverse)
 

Draw Call (DRW_calls)

#define SCULPT_DEBUG_BUFFERS   (G.debug_value == 889)
 
#define SCULPT_DEBUG_COLOR(id)   (sculpt_debug_colors[id % 9])
 
static float sculpt_debug_colors [9][4]
 
static GPUVertFormat inst_select_format = {0}
 
static void drw_call_calc_orco (const Object *ob, float(*r_orcofacs)[4])
 
BLI_INLINE void drw_call_matrix_init (DRWObjectMatrix *ob_mats, const Object *ob, const float(*obmat)[4])
 
static void drw_call_obinfos_init (DRWObjectInfos *ob_infos, const Object *ob)
 
static void drw_call_culling_init (DRWCullingState *cull, const Object *ob)
 
static DRWResourceHandle drw_resource_handle_new (const float(*obmat)[4], const Object *ob)
 
uint32_t DRW_object_resource_id_get (Object *)
 
static DRWResourceHandle drw_resource_handle (DRWShadingGroup *shgroup, const float(*obmat)[4], const Object *ob)
 
static void command_type_set (uint64_t *command_type_bits, int index, eDRWCommandType type)
 
eDRWCommandType command_type_get (const uint64_t *command_type_bits, int index)
 
static void * drw_command_create (DRWShadingGroup *shgroup, eDRWCommandType type)
 
static void drw_command_draw (DRWShadingGroup *shgroup, blender::gpu::Batch *batch, DRWResourceHandle handle)
 
static void drw_command_draw_range (DRWShadingGroup *shgroup, blender::gpu::Batch *batch, DRWResourceHandle handle, uint start, uint count)
 
static void drw_command_draw_instance (DRWShadingGroup *shgroup, blender::gpu::Batch *batch, DRWResourceHandle handle, uint count, bool use_attr)
 
static void drw_command_draw_intance_range (DRWShadingGroup *shgroup, blender::gpu::Batch *batch, DRWResourceHandle handle, uint start, uint count)
 
static void drw_command_compute (DRWShadingGroup *shgroup, int groups_x_len, int groups_y_len, int groups_z_len)
 
static void drw_command_compute_ref (DRWShadingGroup *shgroup, int groups_ref[3])
 
static void drw_command_compute_indirect (DRWShadingGroup *shgroup, GPUStorageBuf *indirect_buf)
 
static void drw_command_barrier (DRWShadingGroup *shgroup, eGPUBarrier type)
 
static void drw_command_draw_procedural (DRWShadingGroup *shgroup, blender::gpu::Batch *batch, DRWResourceHandle handle, uint vert_count)
 
static void drw_command_draw_indirect (DRWShadingGroup *shgroup, blender::gpu::Batch *batch, DRWResourceHandle handle, GPUStorageBuf *indirect_buf)
 
static void drw_command_set_select_id (DRWShadingGroup *shgroup, blender::gpu::VertBuf *buf, uint select_id)
 
static void drw_command_set_stencil_mask (DRWShadingGroup *shgroup, uint write_mask, uint reference, uint compare_mask)
 
static void drw_command_clear (DRWShadingGroup *shgroup, eGPUFrameBufferBits channels, uchar r, uchar g, uchar b, uchar a, float depth, uchar stencil)
 
static void drw_command_set_mutable_state (DRWShadingGroup *shgroup, DRWState enable, DRWState disable)
 
void DRW_shgroup_call_ex (DRWShadingGroup *shgroup, const Object *ob, const float(*obmat)[4], blender::gpu::Batch *geom, bool bypass_culling, void *user_data)
 
void DRW_shgroup_call_range (DRWShadingGroup *shgroup, const Object *ob, blender::gpu::Batch *geom, uint v_sta, uint v_num)
 
void DRW_shgroup_call_instance_range (DRWShadingGroup *shgroup, const Object *ob, blender::gpu::Batch *geom, uint i_sta, uint i_num)
 
void DRW_shgroup_call_compute (DRWShadingGroup *shgroup, int groups_x_len, int groups_y_len, int groups_z_len)
 
void DRW_shgroup_call_compute_ref (DRWShadingGroup *shgroup, int groups_ref[3])
 
void DRW_shgroup_call_compute_indirect (DRWShadingGroup *shgroup, GPUStorageBuf *indirect_buf)
 
void DRW_shgroup_barrier (DRWShadingGroup *shgroup, eGPUBarrier type)
 
static void drw_shgroup_call_procedural_add_ex (DRWShadingGroup *shgroup, blender::gpu::Batch *geom, const Object *ob, uint vert_count)
 
void DRW_shgroup_call_procedural_points (DRWShadingGroup *shgroup, const Object *ob, uint point_count)
 
void DRW_shgroup_call_procedural_lines (DRWShadingGroup *shgroup, const Object *ob, uint line_count)
 
void DRW_shgroup_call_procedural_triangles (DRWShadingGroup *shgroup, const Object *ob, uint tri_count)
 
void DRW_shgroup_call_procedural_indirect (DRWShadingGroup *shgroup, GPUPrimType primitive_type, Object *ob, GPUStorageBuf *indirect_buf)
 
void DRW_shgroup_call_instances (DRWShadingGroup *shgroup, const Object *ob, blender::gpu::Batch *geom, uint count)
 
void DRW_shgroup_call_instances_with_attrs (DRWShadingGroup *shgroup, const Object *ob, blender::gpu::Batch *geom, blender::gpu::Batch *inst_attributes)
 
static void draw_pbvh_nodes (const Object &object, const blender::Span< blender::gpu::Batch * > batches, const blender::Span< int > material_indices, const blender::Span< DRWShadingGroup * > shading_groups, const blender::IndexMask &nodes_to_draw)
 
void DRW_sculpt_debug_cb (blender::bke::pbvh::Node *node, void *user_data, const float bmin[3], const float bmax[3], PBVHNodeFlags flag)
 
static void drw_sculpt_get_frustum_planes (const Object *ob, float planes[6][4])
 
static void drw_sculpt_generate_calls (DRWSculptCallbackData *scd)
 
void DRW_shgroup_call_sculpt (DRWShadingGroup *shgroup, Object *ob, bool use_wire, bool use_mask, bool use_fset, bool use_color, bool use_uv)
 
void DRW_shgroup_call_sculpt_with_materials (DRWShadingGroup **shgroups, GPUMaterial **gpumats, int num_shgroups, const Object *ob)
 
DRWCallBufferDRW_shgroup_call_buffer (DRWShadingGroup *shgroup, GPUVertFormat *format, GPUPrimType prim_type)
 
DRWCallBufferDRW_shgroup_call_buffer_instance (DRWShadingGroup *shgroup, GPUVertFormat *format, blender::gpu::Batch *geom)
 
void DRW_buffer_add_entry_struct (DRWCallBuffer *callbuf, const void *data)
 
void DRW_buffer_add_entry_array (DRWCallBuffer *callbuf, const void *attr[], uint attr_len)
 

Passes (DRW_pass)

#define SORT_IMPL_LINKTYPE   DRWShadingGroup
 
#define SORT_IMPL_FUNC   shgroup_sort_fn_r
 
DRWPassDRW_pass_create (const char *name, DRWState state)
 
DRWPassDRW_pass_create_instance (const char *name, DRWPass *original, DRWState state)
 
void DRW_pass_link (DRWPass *first, DRWPass *second)
 
bool DRW_pass_is_empty (DRWPass *pass)
 
void DRW_pass_foreach_shgroup (DRWPass *pass, void(*callback)(void *user_data, DRWShadingGroup *shgrp), void *user_data)
 
static int pass_shgroup_dist_sort (const void *a, const void *b)
 
void DRW_pass_sort_shgroup_z (DRWPass *pass)
 
void DRW_pass_sort_shgroup_reverse (DRWPass *pass)
 

Macro Definition Documentation

◆ DISABLE_DEBUG_SHADER_PRINT_BARRIER

#define DISABLE_DEBUG_SHADER_PRINT_BARRIER

IMPORTANT: In order to be able to write to the same print buffer sequentially, we add a barrier to allow multiple shader calls writing to the same buffer. However, this adds explicit synchronization events which might change the rest of the application behavior and hide some bugs. If you know you are using shader debug print in only one shader pass, you can comment this out to remove the aforementioned barrier.

Definition at line 59 of file draw_manager_data.cc.

◆ KEY

#define KEY ( a)    ((size_t((a).draw.batch) >> 6) % ARRAY_SIZE(idx))

Referenced by draw_call_sort().

◆ SCULPT_DEBUG_BUFFERS

#define SCULPT_DEBUG_BUFFERS   (G.debug_value == 889)

Definition at line 1221 of file draw_manager_data.cc.

Referenced by draw_pbvh_nodes(), and drw_sculpt_generate_calls().

◆ SCULPT_DEBUG_COLOR

#define SCULPT_DEBUG_COLOR ( id)    (sculpt_debug_colors[id % 9])

Definition at line 1236 of file draw_manager_data.cc.

Referenced by draw_pbvh_nodes(), and DRW_sculpt_debug_cb().

◆ SORT_IMPL_FUNC

#define SORT_IMPL_FUNC   shgroup_sort_fn_r

Definition at line 2501 of file draw_manager_data.cc.

◆ SORT_IMPL_LINKTYPE

#define SORT_IMPL_LINKTYPE   DRWShadingGroup

Definition at line 2499 of file draw_manager_data.cc.

Function Documentation

◆ command_type_get()

eDRWCommandType command_type_get ( const uint64_t * command_type_bits,
int index )

◆ command_type_set()

static void command_type_set ( uint64_t * command_type_bits,
int index,
eDRWCommandType type )
static

Definition at line 840 of file draw_manager_data.cc.

Referenced by drw_command_create().

◆ draw_call_sort()

static void draw_call_sort ( DRWCommand * array,
DRWCommand * array_tmp,
int array_len )
static

Definition at line 65 of file draw_manager_data.cc.

References ARRAY_SIZE, BLI_assert, and KEY.

Referenced by drw_resource_buffer_finish().

◆ draw_frustum_bound_sphere_calc()

static void draw_frustum_bound_sphere_calc ( const BoundBox * bbox,
const float(*) viewinv[4],
const float(*) projmat[4],
const float(*) projinv[4],
BoundSphere * bsphere )
static

◆ draw_frustum_boundbox_calc()

static void draw_frustum_boundbox_calc ( const float(*) viewinv[4],
const float(*) projmat[4],
BoundBox * r_bbox )
static

◆ draw_frustum_culling_planes_calc()

static void draw_frustum_culling_planes_calc ( const float(*) persmat[4],
float(*) frustum_planes[4] )
static

Definition at line 2053 of file draw_manager_data.cc.

References normalize_v3(), and planes_from_projmat().

Referenced by DRW_view_update().

◆ draw_pbvh_nodes()

static void draw_pbvh_nodes ( const Object & object,
const blender::Span< blender::gpu::Batch * > batches,
const blender::Span< int > material_indices,
const blender::Span< DRWShadingGroup * > shading_groups,
const blender::IndexMask & nodes_to_draw )
static

◆ draw_view_matrix_state_update()

static void draw_view_matrix_state_update ( DRWView * view,
const float viewmat[4][4],
const float winmat[4][4] )
static

◆ DRW_buffer_add_entry_array()

◆ DRW_buffer_add_entry_struct()

◆ drw_call_calc_orco()

◆ drw_call_culling_init()

◆ drw_call_matrix_init()

BLI_INLINE void drw_call_matrix_init ( DRWObjectMatrix * ob_mats,
const Object * ob,
const float(*) obmat[4] )

◆ drw_call_obinfos_init()

◆ drw_command_barrier()

static void drw_command_barrier ( DRWShadingGroup * shgroup,
eGPUBarrier type )
static

Definition at line 953 of file draw_manager_data.cc.

References DRW_CMD_BARRIER, drw_command_create(), and DRWCommandBarrier::type.

Referenced by DRW_shgroup_barrier().

◆ drw_command_clear()

◆ drw_command_compute()

static void drw_command_compute ( DRWShadingGroup * shgroup,
int groups_x_len,
int groups_y_len,
int groups_z_len )
static

◆ drw_command_compute_indirect()

static void drw_command_compute_indirect ( DRWShadingGroup * shgroup,
GPUStorageBuf * indirect_buf )
static

◆ drw_command_compute_ref()

static void drw_command_compute_ref ( DRWShadingGroup * shgroup,
int groups_ref[3] )
static

◆ drw_command_create()

◆ drw_command_draw()

static void drw_command_draw ( DRWShadingGroup * shgroup,
blender::gpu::Batch * batch,
DRWResourceHandle handle )
static

◆ drw_command_draw_indirect()

static void drw_command_draw_indirect ( DRWShadingGroup * shgroup,
blender::gpu::Batch * batch,
DRWResourceHandle handle,
GPUStorageBuf * indirect_buf )
static

◆ drw_command_draw_instance()

static void drw_command_draw_instance ( DRWShadingGroup * shgroup,
blender::gpu::Batch * batch,
DRWResourceHandle handle,
uint count,
bool use_attr )
static

◆ drw_command_draw_intance_range()

◆ drw_command_draw_procedural()

static void drw_command_draw_procedural ( DRWShadingGroup * shgroup,
blender::gpu::Batch * batch,
DRWResourceHandle handle,
uint vert_count )
static

◆ drw_command_draw_range()

static void drw_command_draw_range ( DRWShadingGroup * shgroup,
blender::gpu::Batch * batch,
DRWResourceHandle handle,
uint start,
uint count )
static

◆ drw_command_set_mutable_state()

static void drw_command_set_mutable_state ( DRWShadingGroup * shgroup,
DRWState enable,
DRWState disable )
static

◆ drw_command_set_select_id()

◆ drw_command_set_stencil_mask()

static void drw_command_set_stencil_mask ( DRWShadingGroup * shgroup,
uint write_mask,
uint reference,
uint compare_mask )
static

◆ DRW_object_resource_id_get()

uint32_t DRW_object_resource_id_get ( Object * ob)

Can only be called during iteration phase.

Definition at line 790 of file draw_manager_data.cc.

References DST, DRWManager::ob_handle, and DRWManager::resource_handle.

◆ DRW_pass_create()

◆ DRW_pass_create_instance()

DRWPass * DRW_pass_create_instance ( const char * name,
DRWPass * original,
DRWState state )

Create an instance of the original pass that will execute the same drawcalls but with its own DRWState.

Definition at line 2439 of file draw_manager_data.cc.

References DRW_pass_create(), and state.

◆ DRW_pass_foreach_shgroup()

void DRW_pass_foreach_shgroup ( DRWPass * pass,
void(* callback )(void *user_data, DRWShadingGroup *shgrp),
void * user_data )

Definition at line 2468 of file draw_manager_data.cc.

References callback, and LISTBASE_FOREACH.

◆ DRW_pass_is_empty()

◆ DRW_pass_link()

void DRW_pass_link ( DRWPass * first,
DRWPass * second )

Link two passes so that they are both rendered if the first one is being drawn.

Definition at line 2447 of file draw_manager_data.cc.

References BLI_assert, and DRWPass::next.

◆ DRW_pass_sort_shgroup_reverse()

void DRW_pass_sort_shgroup_reverse ( DRWPass * pass)

Reverse Shading group submission order.

Definition at line 2558 of file draw_manager_data.cc.

References BLI_linklist_reverse(), and DRWShadingGroup::last.

◆ DRW_pass_sort_shgroup_z()

◆ drw_resource_buffer_finish()

◆ drw_resource_handle()

◆ drw_resource_handle_new()

◆ DRW_sculpt_debug_cb()

void DRW_sculpt_debug_cb ( blender::bke::pbvh::Node * node,
void * user_data,
const float bmin[3],
const float bmax[3],
PBVHNodeFlags flag )

◆ drw_sculpt_generate_calls()

◆ drw_sculpt_get_frustum_planes()

static void drw_sculpt_get_frustum_planes ( const Object * ob,
float planes[6][4] )
static

◆ DRW_shgroup_add_material_resources()

◆ DRW_shgroup_barrier()

void DRW_shgroup_barrier ( DRWShadingGroup * shgroup,
eGPUBarrier type )

Issue a barrier command.

Definition at line 1115 of file draw_manager_data.cc.

References drw_command_barrier().

◆ DRW_shgroup_buffer_texture()

◆ DRW_shgroup_buffer_texture_ref()

◆ DRW_shgroup_call_buffer()

◆ DRW_shgroup_call_buffer_instance()

◆ DRW_shgroup_call_compute()

void DRW_shgroup_call_compute ( DRWShadingGroup * shgroup,
int groups_x_len,
int groups_y_len,
int groups_z_len )

◆ DRW_shgroup_call_compute_indirect()

void DRW_shgroup_call_compute_indirect ( DRWShadingGroup * shgroup,
GPUStorageBuf * indirect_buf )
Note
No need for a barrier. indirect_buf is internally synchronized.

Definition at line 1110 of file draw_manager_data.cc.

References drw_command_compute_indirect().

◆ DRW_shgroup_call_compute_ref()

void DRW_shgroup_call_compute_ref ( DRWShadingGroup * shgroup,
int groups_ref[3] )
Warning
this keeps the ref to groups_ref until it actually dispatch.

Definition at line 1105 of file draw_manager_data.cc.

References drw_command_compute_ref().

◆ DRW_shgroup_call_ex()

void DRW_shgroup_call_ex ( DRWShadingGroup * shgroup,
const Object * ob,
const float(*) obmat[4],
blender::gpu::Batch * geom,
bool bypass_culling,
void * user_data )

◆ DRW_shgroup_call_instance_range()

void DRW_shgroup_call_instance_range ( DRWShadingGroup * shgroup,
const Object * ob,
blender::gpu::Batch * geom,
uint i_sta,
uint i_num )

A count of 0 instance will use the default number of instance in the batch.

Definition at line 1084 of file draw_manager_data.cc.

References BLI_assert, drw_command_draw_intance_range(), drw_command_set_select_id(), drw_resource_handle(), DST, G, G_FLAG_PICKSEL, and DRWManager::select_id.

◆ DRW_shgroup_call_instances()

void DRW_shgroup_call_instances ( DRWShadingGroup * shgroup,
const Object * ob,
blender::gpu::Batch * geom,
uint count )
Warning
Only use with Shaders that have IN_PLACE_INSTANCES defined. TODO: Should be removed.

Definition at line 1190 of file draw_manager_data.cc.

References BLI_assert, count, drw_command_draw_instance(), drw_command_set_select_id(), drw_resource_handle(), DST, G, G_FLAG_PICKSEL, and DRWManager::select_id.

Referenced by OVERLAY_edit_curve_cache_populate().

◆ DRW_shgroup_call_instances_with_attrs()

void DRW_shgroup_call_instances_with_attrs ( DRWShadingGroup * shgroup,
const Object * ob,
blender::gpu::Batch * geom,
blender::gpu::Batch * inst_attributes )

◆ drw_shgroup_call_procedural_add_ex()

static void drw_shgroup_call_procedural_add_ex ( DRWShadingGroup * shgroup,
blender::gpu::Batch * geom,
const Object * ob,
uint vert_count )
static

◆ DRW_shgroup_call_procedural_indirect()

◆ DRW_shgroup_call_procedural_lines()

void DRW_shgroup_call_procedural_lines ( DRWShadingGroup * shgroup,
const Object * ob,
uint line_count )

◆ DRW_shgroup_call_procedural_points()

void DRW_shgroup_call_procedural_points ( DRWShadingGroup * shgroup,
const Object * ob,
uint point_count )

◆ DRW_shgroup_call_procedural_triangles()

◆ DRW_shgroup_call_range()

void DRW_shgroup_call_range ( DRWShadingGroup * shgroup,
const Object * ob,
blender::gpu::Batch * geom,
uint v_sta,
uint v_num )

◆ DRW_shgroup_call_sculpt()

◆ DRW_shgroup_call_sculpt_with_materials()

◆ DRW_shgroup_clear_framebuffer()

void DRW_shgroup_clear_framebuffer ( DRWShadingGroup * shgroup,
eGPUFrameBufferBits channels,
uchar r,
uchar g,
uchar b,
uchar a,
float depth,
uchar stencil )

Issue a clear command.

Definition at line 1954 of file draw_manager_data.cc.

References b, and drw_command_clear().

Referenced by GPENCIL_antialiasing_init().

◆ DRW_shgroup_create()

DRWShadingGroup * DRW_shgroup_create ( GPUShader * shader,
DRWPass * pass )

Definition at line 1907 of file draw_manager_data.cc.

References drw_shgroup_create_ex(), and drw_shgroup_init().

Referenced by basic_cache_init(), blender::draw::drw_curves_cache_update_compute(), drw_hair_particle_cache_update_compute(), external_cache_init(), GPENCIL_antialiasing_init(), GPENCIL_cache_init(), gpencil_layer_cache_add(), gpencil_vfx_pass_create(), grease_pencil_layer_cache_add(), OVERLAY_antialiasing_cache_init(), OVERLAY_armature_cache_init(), OVERLAY_background_cache_init(), OVERLAY_edit_curve_cache_init(), OVERLAY_edit_curves_cache_init(), OVERLAY_edit_gpencil_legacy_cache_init(), OVERLAY_edit_grease_pencil_cache_init(), OVERLAY_edit_lattice_cache_init(), OVERLAY_edit_mesh_cache_init(), OVERLAY_edit_particle_cache_init(), OVERLAY_edit_text_cache_init(), OVERLAY_edit_uv_cache_init(), OVERLAY_extra_cache_init(), OVERLAY_facing_cache_init(), OVERLAY_fade_cache_init(), OVERLAY_gpencil_legacy_cache_init(), OVERLAY_grease_pencil_cache_init(), OVERLAY_grid_cache_init(), OVERLAY_image_camera_cache_populate(), OVERLAY_image_empty_cache_populate(), OVERLAY_metaball_cache_init(), OVERLAY_mode_transfer_cache_populate(), OVERLAY_motion_path_cache_init(), OVERLAY_outline_cache_init(), OVERLAY_paint_cache_init(), OVERLAY_particle_cache_init(), OVERLAY_sculpt_cache_init(), OVERLAY_sculpt_curves_cache_init(), OVERLAY_viewer_attribute_cache_init(), OVERLAY_volume_cache_init(), OVERLAY_volume_extra(), OVERLAY_wireframe_cache_init(), select_cache_init(), and select_debug_engine_init().

◆ drw_shgroup_create_ex()

◆ DRW_shgroup_create_sub()

◆ drw_shgroup_init()

◆ DRW_shgroup_instance_format_array()

◆ DRW_shgroup_is_empty()

◆ DRW_shgroup_material_create()

◆ drw_shgroup_material_create_ex()

static DRWShadingGroup * drw_shgroup_material_create_ex ( GPUPass * gpupass,
DRWPass * pass )
static

Definition at line 1802 of file draw_manager_data.cc.

References drw_shgroup_create_ex(), and GPU_pass_shader_get().

Referenced by DRW_shgroup_material_create().

◆ drw_shgroup_material_texture()

static void drw_shgroup_material_texture ( DRWShadingGroup * grp,
GPUTexture * gputex,
const char * name,
GPUSamplerState state )
static

◆ DRW_shgroup_state_disable()

◆ DRW_shgroup_state_enable()

◆ DRW_shgroup_stencil_mask()

void DRW_shgroup_stencil_mask ( DRWShadingGroup * shgroup,
uint mask )

TODO: remove this function. Obsolete version. mask is actually reference value.

Definition at line 1949 of file draw_manager_data.cc.

References drw_command_set_stencil_mask().

Referenced by gpencil_layer_cache_add(), and grease_pencil_layer_cache_add().

◆ DRW_shgroup_stencil_set()

void DRW_shgroup_stencil_set ( DRWShadingGroup * shgroup,
uint write_mask,
uint reference,
uint compare_mask )

Reminders:

  • (compare_mask & reference) is what is tested against (compare_mask & stencil_value) stencil_value being the value stored in the stencil buffer.
  • (write-mask & reference) is what gets written if the test condition is fulfilled.

Definition at line 1941 of file draw_manager_data.cc.

References drw_command_set_stencil_mask().

◆ DRW_shgroup_storage_block_ex()

void DRW_shgroup_storage_block_ex ( DRWShadingGroup * shgroup,
const char * name,
const GPUStorageBuf *ssbo DRW_DEBUG_FILE_LINE_ARGS )

◆ DRW_shgroup_storage_block_ref_ex()

void DRW_shgroup_storage_block_ref_ex ( DRWShadingGroup * shgroup,
const char * name,
GPUStorageBuf **ssbo DRW_DEBUG_FILE_LINE_ARGS )

◆ DRW_shgroup_transform_feedback_create()

◆ drw_shgroup_uniform()

◆ DRW_shgroup_uniform_block_ex()

void DRW_shgroup_uniform_block_ex ( DRWShadingGroup * shgroup,
const char * name,
const GPUUniformBuf *ubo DRW_DEBUG_FILE_LINE_ARGS )

◆ DRW_shgroup_uniform_block_ref_ex()

void DRW_shgroup_uniform_block_ref_ex ( DRWShadingGroup * shgroup,
const char * name,
GPUUniformBuf **ubo DRW_DEBUG_FILE_LINE_ARGS )

◆ DRW_shgroup_uniform_bool()

void DRW_shgroup_uniform_bool ( DRWShadingGroup * shgroup,
const char * name,
const int * value,
int arraysize )

Definition at line 389 of file draw_manager_data.cc.

References drw_shgroup_uniform(), and DRW_UNIFORM_INT.

Referenced by GPENCIL_cache_init(), and OVERLAY_edit_uv_cache_init().

◆ DRW_shgroup_uniform_bool_copy()

◆ drw_shgroup_uniform_create_ex()

static void drw_shgroup_uniform_create_ex ( DRWShadingGroup * shgroup,
int loc,
DRWUniformType type,
const void * value,
GPUSamplerState sampler_state,
int length,
int arraysize )
static

◆ DRW_shgroup_uniform_float()

void DRW_shgroup_uniform_float ( DRWShadingGroup * shgroup,
const char * name,
const float * value,
int arraysize )

Definition at line 398 of file draw_manager_data.cc.

References drw_shgroup_uniform(), and DRW_UNIFORM_FLOAT.

Referenced by OVERLAY_edit_uv_cache_init().

◆ DRW_shgroup_uniform_float_copy()

◆ DRW_shgroup_uniform_image()

void DRW_shgroup_uniform_image ( DRWShadingGroup * shgroup,
const char * name,
const GPUTexture * tex )

◆ DRW_shgroup_uniform_image_ref()

void DRW_shgroup_uniform_image_ref ( DRWShadingGroup * shgroup,
const char * name,
GPUTexture ** tex )

◆ DRW_shgroup_uniform_int()

◆ DRW_shgroup_uniform_int_copy()

◆ DRW_shgroup_uniform_ivec2()

void DRW_shgroup_uniform_ivec2 ( DRWShadingGroup * shgroup,
const char * name,
const int * value,
int arraysize )

Definition at line 438 of file draw_manager_data.cc.

References drw_shgroup_uniform(), and DRW_UNIFORM_INT.

◆ DRW_shgroup_uniform_ivec2_copy()

void DRW_shgroup_uniform_ivec2_copy ( DRWShadingGroup * shgroup,
const char * name,
const int * value )

Definition at line 477 of file draw_manager_data.cc.

References drw_shgroup_uniform(), and DRW_UNIFORM_INT_COPY.

◆ DRW_shgroup_uniform_ivec3()

void DRW_shgroup_uniform_ivec3 ( DRWShadingGroup * shgroup,
const char * name,
const int * value,
int arraysize )

Definition at line 446 of file draw_manager_data.cc.

References drw_shgroup_uniform(), and DRW_UNIFORM_INT.

◆ DRW_shgroup_uniform_ivec3_copy()

void DRW_shgroup_uniform_ivec3_copy ( DRWShadingGroup * shgroup,
const char * name,
const int * value )

Definition at line 482 of file draw_manager_data.cc.

References drw_shgroup_uniform(), and DRW_UNIFORM_INT_COPY.

Referenced by OVERLAY_volume_extra().

◆ DRW_shgroup_uniform_ivec4()

void DRW_shgroup_uniform_ivec4 ( DRWShadingGroup * shgroup,
const char * name,
const int * value,
int arraysize )

Definition at line 454 of file draw_manager_data.cc.

References drw_shgroup_uniform(), and DRW_UNIFORM_INT.

Referenced by OVERLAY_edit_mesh_cache_init().

◆ DRW_shgroup_uniform_ivec4_copy()

void DRW_shgroup_uniform_ivec4_copy ( DRWShadingGroup * shgroup,
const char * name,
const int * value )

◆ DRW_shgroup_uniform_mat3()

void DRW_shgroup_uniform_mat3 ( DRWShadingGroup * shgroup,
const char * name,
const float(*) value[3] )

Definition at line 462 of file draw_manager_data.cc.

References drw_shgroup_uniform(), and DRW_UNIFORM_FLOAT.

◆ DRW_shgroup_uniform_mat4()

void DRW_shgroup_uniform_mat4 ( DRWShadingGroup * shgroup,
const char * name,
const float(*) value[4] )

Definition at line 467 of file draw_manager_data.cc.

References drw_shgroup_uniform(), and DRW_UNIFORM_FLOAT.

◆ DRW_shgroup_uniform_mat4_copy()

◆ DRW_shgroup_uniform_texture()

◆ DRW_shgroup_uniform_texture_ex()

void DRW_shgroup_uniform_texture_ex ( DRWShadingGroup * shgroup,
const char * name,
const GPUTexture * tex,
GPUSamplerState sampler_state )

◆ DRW_shgroup_uniform_texture_ref()

◆ DRW_shgroup_uniform_texture_ref_ex()

void DRW_shgroup_uniform_texture_ref_ex ( DRWShadingGroup * shgroup,
const char * name,
GPUTexture ** tex,
GPUSamplerState sampler_state )

◆ DRW_shgroup_uniform_vec2()

void DRW_shgroup_uniform_vec2 ( DRWShadingGroup * shgroup,
const char * name,
const float * value,
int arraysize )

Definition at line 406 of file draw_manager_data.cc.

References drw_shgroup_uniform(), and DRW_UNIFORM_FLOAT.

◆ DRW_shgroup_uniform_vec2_copy()

◆ DRW_shgroup_uniform_vec3()

void DRW_shgroup_uniform_vec3 ( DRWShadingGroup * shgroup,
const char * name,
const float * value,
int arraysize )

◆ DRW_shgroup_uniform_vec3_copy()

◆ DRW_shgroup_uniform_vec4()

void DRW_shgroup_uniform_vec4 ( DRWShadingGroup * shgroup,
const char * name,
const float * value,
int arraysize )

◆ DRW_shgroup_uniform_vec4_copy()

◆ DRW_shgroup_vertex_buffer_ex()

void DRW_shgroup_vertex_buffer_ex ( DRWShadingGroup * shgroup,
const char * name,
blender::gpu::VertBuf *vertex_buffer DRW_DEBUG_FILE_LINE_ARGS )

◆ DRW_shgroup_vertex_buffer_ref_ex()

void DRW_shgroup_vertex_buffer_ref_ex ( DRWShadingGroup * shgroup,
const char * name,
blender::gpu::VertBuf **vertex_buffer DRW_DEBUG_FILE_LINE_ARGS )

◆ DRW_view_clip_planes_set()

void DRW_view_clip_planes_set ( DRWView * view,
float(*) planes[4],
int plane_len )

This only works if DRWPasses have been tagged with DRW_STATE_CLIP_PLANES, and if the shaders have support for it (see usage of gl_ClipDistance).

Note
planes must be in world space.

Definition at line 2345 of file draw_manager_data.cc.

References BLI_assert, and MAX_CLIP_PLANES.

Referenced by drw_manager_init().

◆ DRW_view_create()

DRWView * DRW_view_create ( const float viewmat[4][4],
const float winmat[4][4],
const float(*) culling_viewmat[4],
const float(*) culling_winmat[4],
DRWCallVisibilityFn * visibility_fn )

◆ DRW_view_create_sub()

DRWView * DRW_view_create_sub ( const DRWView * parent_view,
const float viewmat[4][4],
const float winmat[4][4] )

Create a view with culling done by another view.

Definition at line 2224 of file draw_manager_data.cc.

References BLI_memblock_alloc(), DRW_view_update_sub(), DST, DRWView::parent, view, DRWData::views, and DRWManager::vmempool.

Referenced by DRW_view_create_with_zoffset().

◆ DRW_view_default_get()

◆ DRW_view_default_set()

void DRW_view_default_set ( const DRWView * view)

MUST only be called once per render and only in render mode. Sets default view.

Definition at line 2339 of file draw_manager_data.cc.

References BLI_assert, DST, and DRWManager::view_default.

Referenced by blender::draw::DRW_curves_update(), GPENCIL_render_init(), and workbench_render_to_image().

◆ DRW_view_far_distance_get()

◆ DRW_view_frustum_corners_get()

void DRW_view_frustum_corners_get ( const DRWView * view,
BoundBox * corners )
Returns
world space frustum corners.

Definition at line 2354 of file draw_manager_data.cc.

◆ DRW_view_frustum_planes_get()

void DRW_view_frustum_planes_get ( const DRWView * view,
float planes[6][4] )
Returns
world space frustum sides as planes. See draw_frustum_culling_planes_calc() for the plane order.

Definition at line 2359 of file draw_manager_data.cc.

Referenced by drw_sculpt_get_frustum_planes(), and blender::draw::sculpt_batches_get_ex().

◆ DRW_view_is_persp_get()

◆ DRW_view_near_distance_get()

float DRW_view_near_distance_get ( const DRWView * view)

These are in view-space, so negative if in perspective. Extract near and far clip distance from the projection matrix.

Definition at line 2370 of file draw_manager_data.cc.

References DRW_view_is_persp_get(), DST, view, and DRWManager::view_default.

Referenced by GPENCIL_render_init(), GPENCIL_render_result_z(), blender::eevee::Camera::sync(), and write_render_z_output().

◆ DRW_view_persmat_get()

◆ DRW_view_reset()

void DRW_view_reset ( )
Warning
Only use in render AND only if you are going to set view_default again.

Definition at line 2332 of file draw_manager_data.cc.

References DST, DRWManager::view_active, DRWManager::view_default, and DRWManager::view_previous.

Referenced by DRW_render_gpencil(), and DRW_render_to_image().

◆ DRW_view_update()

void DRW_view_update ( DRWView * view,
const float viewmat[4][4],
const float winmat[4][4],
const float(*) culling_viewmat[4],
const float(*) culling_winmat[4] )

◆ DRW_view_update_sub()

void DRW_view_update_sub ( DRWView * view,
const float viewmat[4][4],
const float winmat[4][4] )

Update matrices of a view created with DRW_view_create_sub.

Definition at line 2249 of file draw_manager_data.cc.

References BLI_assert, draw_view_matrix_state_update(), and is_negative_m4().

Referenced by DRW_view_create_sub().

◆ DRW_view_viewmat_get()

◆ DRW_view_winmat_get()

◆ pass_shgroup_dist_sort()

static int pass_shgroup_dist_sort ( const void * a,
const void * b )
static

Variable Documentation

◆ inst_select_format

GPUVertFormat inst_select_format = {0}
static

◆ sculpt_debug_colors

float sculpt_debug_colors[9][4]
static
Initial value:
= {
{1.0f, 0.2f, 0.2f, 1.0f},
{0.2f, 1.0f, 0.2f, 1.0f},
{0.2f, 0.2f, 1.0f, 1.0f},
{1.0f, 1.0f, 0.2f, 1.0f},
{0.2f, 1.0f, 1.0f, 1.0f},
{1.0f, 0.2f, 1.0f, 1.0f},
{1.0f, 0.7f, 0.2f, 1.0f},
{0.2f, 1.0f, 0.7f, 1.0f},
{0.7f, 0.2f, 1.0f, 1.0f},
}

Definition at line 1237 of file draw_manager_data.cc.