Blender  V2.93
Classes | Macros | Typedefs | Enumerations | Functions
GPU_vertex_buffer.h File Reference
#include "BLI_utildefines.h"
#include "GPU_vertex_format.h"

Go to the source code of this file.

Classes

struct  GPUVertBufRaw
 

Macros

#define GPU_vertbuf_create_with_format(format)    GPU_vertbuf_create_with_format_ex(format, GPU_USAGE_STATIC)
 
#define GPU_vertbuf_init_with_format(verts, format)    GPU_vertbuf_init_with_format_ex(verts, format, GPU_USAGE_STATIC)
 
#define GPU_VERTBUF_DISCARD_SAFE(verts)
 

Typedefs

typedef struct GPUVertBuf GPUVertBuf
 
typedef struct GPUVertBufRaw GPUVertBufRaw
 

Enumerations

enum  GPUVertBufStatus { GPU_VERTBUF_INVALID = 0 , GPU_VERTBUF_INIT = (1 << 0) , GPU_VERTBUF_DATA_DIRTY = (1 << 1) , GPU_VERTBUF_DATA_UPLOADED = (1 << 2) }
 
enum  GPUUsageType { GPU_USAGE_STREAM , GPU_USAGE_STATIC , GPU_USAGE_DYNAMIC }
 

Functions

GPUVertBufGPU_vertbuf_calloc (void)
 
GPUVertBufGPU_vertbuf_create_with_format_ex (const GPUVertFormat *, GPUUsageType)
 
void GPU_vertbuf_clear (GPUVertBuf *verts)
 
void GPU_vertbuf_discard (GPUVertBuf *)
 
void GPU_vertbuf_handle_ref_add (GPUVertBuf *verts)
 
void GPU_vertbuf_handle_ref_remove (GPUVertBuf *verts)
 
void GPU_vertbuf_init_with_format_ex (GPUVertBuf *, const GPUVertFormat *, GPUUsageType)
 
GPUVertBufGPU_vertbuf_duplicate (GPUVertBuf *verts)
 
void GPU_vertbuf_data_alloc (GPUVertBuf *, uint v_len)
 
void GPU_vertbuf_data_resize (GPUVertBuf *, uint v_len)
 
void GPU_vertbuf_data_len_set (GPUVertBuf *, uint v_len)
 
void GPU_vertbuf_attr_set (GPUVertBuf *, uint a_idx, uint v_idx, const void *data)
 
void GPU_vertbuf_vert_set (GPUVertBuf *verts, uint v_idx, const void *data)
 
void GPU_vertbuf_attr_fill (GPUVertBuf *, uint a_idx, const void *data)
 
void GPU_vertbuf_attr_fill_stride (GPUVertBuf *, uint a_idx, uint stride, const void *data)
 
GPU_INLINE void * GPU_vertbuf_raw_step (GPUVertBufRaw *a)
 
GPU_INLINE uint GPU_vertbuf_raw_used (GPUVertBufRaw *a)
 
void GPU_vertbuf_attr_get_raw_data (GPUVertBuf *, uint a_idx, GPUVertBufRaw *access)
 
void * GPU_vertbuf_steal_data (GPUVertBuf *verts)
 
void * GPU_vertbuf_get_data (const GPUVertBuf *verts)
 
const GPUVertFormatGPU_vertbuf_get_format (const GPUVertBuf *verts)
 
uint GPU_vertbuf_get_vertex_alloc (const GPUVertBuf *verts)
 
uint GPU_vertbuf_get_vertex_len (const GPUVertBuf *verts)
 
GPUVertBufStatus GPU_vertbuf_get_status (const GPUVertBuf *verts)
 
void GPU_vertbuf_use (GPUVertBuf *)
 
void GPU_vertbuf_update_sub (GPUVertBuf *verts, uint start, uint len, void *data)
 
uint GPU_vertbuf_get_memory_usage (void)
 

Detailed Description

GPU vertex buffer

Definition in file GPU_vertex_buffer.h.

Macro Definition Documentation

◆ GPU_vertbuf_create_with_format

#define GPU_vertbuf_create_with_format (   format)     GPU_vertbuf_create_with_format_ex(format, GPU_USAGE_STATIC)

Definition at line 70 of file GPU_vertex_buffer.h.

◆ GPU_VERTBUF_DISCARD_SAFE

#define GPU_VERTBUF_DISCARD_SAFE (   verts)
Value:
do { \
if (verts != NULL) { \
GPU_vertbuf_discard(verts); \
verts = NULL; \
} \
} while (0)
static float verts[][3]

Definition at line 149 of file GPU_vertex_buffer.h.

◆ GPU_vertbuf_init_with_format

#define GPU_vertbuf_init_with_format (   verts,
  format 
)     GPU_vertbuf_init_with_format_ex(verts, format, GPU_USAGE_STATIC)

Definition at line 82 of file GPU_vertex_buffer.h.

Typedef Documentation

◆ GPUVertBuf

typedef struct GPUVertBuf GPUVertBuf

Opaque type hiding blender::gpu::VertBuf.

Definition at line 1 of file GPU_vertex_buffer.h.

◆ GPUVertBufRaw

typedef struct GPUVertBufRaw GPUVertBufRaw

Enumeration Type Documentation

◆ GPUUsageType

How to create a GPUVertBuf: 1) verts = GPU_vertbuf_calloc() 2) GPU_vertformat_attr_add(verts->format, ...) 3) GPU_vertbuf_data_alloc(verts, vertex_len) <– finalizes/packs vertex format 4) GPU_vertbuf_attr_fill(verts, pos, application_pos_buffer)

Enumerator
GPU_USAGE_STREAM 
GPU_USAGE_STATIC 
GPU_USAGE_DYNAMIC 

Definition at line 57 of file GPU_vertex_buffer.h.

◆ GPUVertBufStatus

Enumerator
GPU_VERTBUF_INVALID 

Initial state.

GPU_VERTBUF_INIT 

Was init with a vertex format.

GPU_VERTBUF_DATA_DIRTY 

Data has been touched and need to be re-uploaded.

GPU_VERTBUF_DATA_UPLOADED 

The buffer has been created inside GPU memory.

Definition at line 32 of file GPU_vertex_buffer.h.

Function Documentation

◆ GPU_vertbuf_attr_fill()

void GPU_vertbuf_attr_fill ( GPUVertBuf verts_,
uint  a_idx,
const void *  data 
)

◆ GPU_vertbuf_attr_fill_stride()

void GPU_vertbuf_attr_fill_stride ( GPUVertBuf verts_,
uint  a_idx,
uint  stride,
const void *  data 
)

◆ GPU_vertbuf_attr_get_raw_data()

void GPU_vertbuf_attr_get_raw_data ( GPUVertBuf verts_,
uint  a_idx,
GPUVertBufRaw access 
)

◆ GPU_vertbuf_attr_set()

void GPU_vertbuf_attr_set ( GPUVertBuf verts_,
uint  a_idx,
uint  v_idx,
const void *  data 
)

◆ GPU_vertbuf_calloc()

GPUVertBuf* GPU_vertbuf_calloc ( void  )

◆ GPU_vertbuf_clear()

void GPU_vertbuf_clear ( GPUVertBuf verts)

Same as discard but does not free.

Definition at line 153 of file gpu_vertex_buffer.cc.

References blender::gpu::unwrap(), and verts.

Referenced by extract_edge_fac_finish().

◆ GPU_vertbuf_create_with_format_ex()

GPUVertBuf* GPU_vertbuf_create_with_format_ex ( const GPUVertFormat format,
GPUUsageType  usage 
)

◆ GPU_vertbuf_data_alloc()

void GPU_vertbuf_data_alloc ( GPUVertBuf verts,
uint  v_len 
)

Definition at line 177 of file gpu_vertex_buffer.cc.

References blender::gpu::unwrap(), and verts.

Referenced by batch_screen_edges_get(), batch_sphere_wire(), blf_batch_draw_init(), curve_create_curves_pos(), curve_create_edit_curves_nor(), curve_create_edit_data_and_handles(), draw_cache_view_init_fn(), draw_line_bounds(), draw_line_loop(), draw_line_pairs(), draw_seq_fcurve_overlay(), DRW_cache_bone_arrows_get(), DRW_cache_bone_box_get(), DRW_cache_bone_dof_lines_get(), DRW_cache_bone_dof_sphere_get(), DRW_cache_bone_envelope_outline_get(), DRW_cache_bone_envelope_solid_get(), DRW_cache_bone_octahedral_get(), DRW_cache_bone_point_get(), DRW_cache_bone_point_wire_outline_get(), DRW_cache_bone_stick_get(), DRW_cache_camera_distances_get(), DRW_cache_camera_frame_get(), DRW_cache_camera_tria_get(), DRW_cache_camera_tria_wire_get(), DRW_cache_camera_volume_get(), DRW_cache_camera_volume_wire_get(), DRW_cache_circle_get(), DRW_cache_cube_get(), DRW_cache_cursor_get(), DRW_cache_empty_capsule_body_get(), DRW_cache_empty_capsule_cap_get(), DRW_cache_empty_cone_get(), DRW_cache_empty_cube_get(), DRW_cache_empty_cylinder_get(), DRW_cache_field_cone_limit_get(), DRW_cache_field_curve_get(), DRW_cache_field_force_get(), DRW_cache_field_sphere_limit_get(), DRW_cache_field_tube_limit_get(), DRW_cache_field_vortex_get(), DRW_cache_field_wind_get(), DRW_cache_fullscreen_quad_get(), DRW_cache_grid_get(), DRW_cache_groundline_get(), DRW_cache_light_area_disk_lines_get(), DRW_cache_light_area_square_lines_get(), DRW_cache_light_point_lines_get(), DRW_cache_light_spot_lines_get(), DRW_cache_light_spot_volume_get(), DRW_cache_light_sun_lines_get(), DRW_cache_lightprobe_cube_get(), DRW_cache_lightprobe_grid_get(), DRW_cache_lightprobe_planar_get(), DRW_cache_normal_arrow_get(), DRW_cache_particles_get_prim(), DRW_cache_plain_axes_get(), drw_cache_procedural_lines_get(), drw_cache_procedural_points_get(), drw_cache_procedural_triangles_get(), DRW_cache_quad_get(), DRW_cache_quad_wires_get(), DRW_cache_single_arrow_get(), DRW_cache_speaker_get(), DRW_cache_sphere_get(), drw_debug_draw_spheres(), DRW_displist_vertbuf_create_loop_pos_and_nor_and_uv_and_tan(), DRW_displist_vertbuf_create_pos_and_nor(), DRW_gpencil_dummy_buffer_get(), DRW_hair_init(), DRW_temp_buffer_request(), DRW_vertbuf_create_wiredata(), drw_volume_selection_surface_cb(), drw_volume_wireframe_cb(), ED_draw_object_facemap(), extract_edge_fac_finish(), extract_edge_fac_init(), extract_edit_data_init(), extract_edituv_data_init(), extract_edituv_stretch_angle_init(), extract_edituv_stretch_area_init(), extract_fdots_edituv_data_init(), extract_fdots_nor_hq_init(), extract_fdots_nor_init(), extract_fdots_pos_init(), extract_fdots_uv_init(), extract_lnor_hq_init(), extract_lnor_init(), extract_mesh_analysis_init(), extract_orco_init(), extract_pos_nor_hq_init(), extract_pos_nor_init(), extract_sculpt_data_init(), extract_select_fdot_idx_init(), extract_select_idx_init(), extract_skin_roots_init(), extract_tan_ex(), extract_uv_init(), extract_vcol_init(), extract_weights_init(), gpencil_batches_ensure(), gpencil_edit_batches_ensure(), gpencil_sbuffer_stroke_ensure(), gpu_batch_preset_panel_drag_widget(), GPU_batch_preset_quad(), gpu_batch_sphere(), GPU_batch_tris_from_poly_2d_encoded(), GPU_batch_wire_from_poly_2d_encoded(), gpu_pbvh_vert_buf_data_set(), gpu_viewport_batch_create(), hair_batch_cache_ensure_procedural_final_points(), hair_batch_cache_ensure_procedural_indices(), hair_batch_cache_ensure_procedural_pos(), hair_batch_cache_ensure_procedural_strand_data(), immBeginBatch(), knifetool_draw(), lattice_batch_cache_create_overlay_batches(), lattice_batch_cache_get_pos(), mpath_vbo_get(), nodelink_batch_init(), particle_batch_cache_ensure_edit_inner_pos(), particle_batch_cache_ensure_edit_pos_and_seg(), particle_batch_cache_ensure_edit_tip_pos(), particle_batch_cache_ensure_pos(), particle_batch_cache_ensure_pos_and_seg(), particle_batch_cache_ensure_procedural_final_points(), particle_batch_cache_ensure_procedural_indices(), particle_batch_cache_ensure_procedural_pos(), particle_batch_cache_ensure_procedural_strand_data(), pointcloud_batch_cache_ensure_geom(), pointcloud_batch_cache_ensure_pos(), pygpu_vertbuf__tp_new(), sphere_wire_vbo(), stitch_draw(), ui_batch_roundbox_shadow_get(), ui_batch_roundbox_widget_get(), waveform_draw_one(), and wm_gizmo_geometryinfo_draw().

◆ GPU_vertbuf_data_len_set()

void GPU_vertbuf_data_len_set ( GPUVertBuf verts_,
uint  v_len 
)

◆ GPU_vertbuf_data_resize()

void GPU_vertbuf_data_resize ( GPUVertBuf verts,
uint  v_len 
)

◆ GPU_vertbuf_discard()

void GPU_vertbuf_discard ( GPUVertBuf verts)

◆ GPU_vertbuf_duplicate()

GPUVertBuf* GPU_vertbuf_duplicate ( GPUVertBuf verts)

Definition at line 147 of file gpu_vertex_buffer.cc.

References blender::gpu::unwrap(), and blender::gpu::wrap().

Referenced by EEVEE_motion_blur_cache_finish().

◆ GPU_vertbuf_get_data()

void* GPU_vertbuf_get_data ( const GPUVertBuf verts)

◆ GPU_vertbuf_get_format()

const GPUVertFormat* GPU_vertbuf_get_format ( const GPUVertBuf verts)

◆ GPU_vertbuf_get_memory_usage()

uint GPU_vertbuf_get_memory_usage ( void  )

Definition at line 316 of file gpu_vertex_buffer.cc.

References blender::gpu::VertBuf::memory_usage.

Referenced by DRW_stats_draw().

◆ GPU_vertbuf_get_status()

GPUVertBufStatus GPU_vertbuf_get_status ( const GPUVertBuf verts)

◆ GPU_vertbuf_get_vertex_alloc()

uint GPU_vertbuf_get_vertex_alloc ( const GPUVertBuf verts)

◆ GPU_vertbuf_get_vertex_len()

uint GPU_vertbuf_get_vertex_len ( const GPUVertBuf verts)

◆ GPU_vertbuf_handle_ref_add()

void GPU_vertbuf_handle_ref_add ( GPUVertBuf verts)

Definition at line 164 of file gpu_vertex_buffer.cc.

References blender::gpu::unwrap(), and verts.

Referenced by instancing_batch_references_add().

◆ GPU_vertbuf_handle_ref_remove()

void GPU_vertbuf_handle_ref_remove ( GPUVertBuf verts)

Definition at line 169 of file gpu_vertex_buffer.cc.

References blender::gpu::unwrap(), and verts.

Referenced by instancing_batch_references_remove().

◆ GPU_vertbuf_init_with_format_ex()

void GPU_vertbuf_init_with_format_ex ( GPUVertBuf verts_,
const GPUVertFormat format,
GPUUsageType  usage 
)

Definition at line 140 of file gpu_vertex_buffer.cc.

References blender::gpu::unwrap().

Referenced by DRW_temp_buffer_request().

◆ GPU_vertbuf_raw_step()

GPU_INLINE void* GPU_vertbuf_raw_step ( GPUVertBufRaw a)

◆ GPU_vertbuf_raw_used()

GPU_INLINE uint GPU_vertbuf_raw_used ( GPUVertBufRaw a)

◆ GPU_vertbuf_steal_data()

void* GPU_vertbuf_steal_data ( GPUVertBuf verts)

Definition at line 286 of file gpu_vertex_buffer.cc.

References BLI_assert, data, blender::gpu::unwrap(), and verts.

Referenced by extract_edge_fac_finish().

◆ GPU_vertbuf_update_sub()

void GPU_vertbuf_update_sub ( GPUVertBuf verts,
uint  start,
uint  len,
void *  data 
)

Definition at line 329 of file gpu_vertex_buffer.cc.

References data, len, blender::gpu::unwrap(), and verts.

Referenced by DRW_hair_update().

◆ GPU_vertbuf_use()

void GPU_vertbuf_use ( GPUVertBuf verts)

◆ GPU_vertbuf_vert_set()

void GPU_vertbuf_vert_set ( GPUVertBuf verts_,
uint  v_idx,
const void *  data 
)