Blender V4.3
gpu_vertex_buffer.cc File Reference
#include "MEM_guardedalloc.h"
#include "gpu_backend.hh"
#include "gpu_vertex_format_private.hh"
#include "GPU_vertex_buffer.hh"
#include "gpu_context_private.hh"
#include <cstring>

Go to the source code of this file.

Namespaces

namespace  blender
 
namespace  blender::gpu
 

Functions

C-API
VertBufGPU_vertbuf_calloc ()
 
VertBufGPU_vertbuf_create_with_format_ex (const GPUVertFormat &format, GPUUsageType usage)
 
void GPU_vertbuf_init_with_format_ex (VertBuf &verts, const GPUVertFormat &format, GPUUsageType usage)
 
void GPU_vertbuf_init_build_on_device (VertBuf &verts, const GPUVertFormat &format, uint v_len)
 
VertBufGPU_vertbuf_duplicate (VertBuf *verts)
 
void GPU_vertbuf_read (const VertBuf *verts, void *data)
 
void GPU_vertbuf_clear (VertBuf *verts)
 
void GPU_vertbuf_discard (VertBuf *verts)
 
void GPU_vertbuf_handle_ref_add (VertBuf *verts)
 
void GPU_vertbuf_handle_ref_remove (VertBuf *verts)
 
void GPU_vertbuf_data_alloc (VertBuf &verts, uint v_len)
 
void GPU_vertbuf_data_resize (VertBuf &verts, uint v_len)
 
void GPU_vertbuf_data_len_set (VertBuf &verts, uint v_len)
 
void GPU_vertbuf_attr_set (VertBuf *verts, uint a_idx, uint v_idx, const void *data)
 
void GPU_vertbuf_attr_fill (VertBuf *verts, uint a_idx, const void *data)
 
void GPU_vertbuf_vert_set (VertBuf *verts, uint v_idx, const void *data)
 
void GPU_vertbuf_attr_fill_stride (VertBuf *verts, uint a_idx, uint stride, const void *data)
 
void GPU_vertbuf_attr_get_raw_data (VertBuf *verts, uint a_idx, GPUVertBufRaw *access)
 
const GPUVertFormatGPU_vertbuf_get_format (const VertBuf *verts)
 
uint GPU_vertbuf_get_vertex_alloc (const VertBuf *verts)
 
uint GPU_vertbuf_get_vertex_len (const VertBuf *verts)
 
GPUVertBufStatus GPU_vertbuf_get_status (const VertBuf *verts)
 
void GPU_vertbuf_tag_dirty (VertBuf *verts)
 
uint GPU_vertbuf_get_memory_usage ()
 
void GPU_vertbuf_use (VertBuf *verts)
 
void GPU_vertbuf_wrap_handle (VertBuf *verts, uint64_t handle)
 
void GPU_vertbuf_bind_as_ssbo (VertBuf *verts, int binding)
 
void GPU_vertbuf_bind_as_texture (VertBuf *verts, int binding)
 
void GPU_vertbuf_update_sub (VertBuf *verts, uint start, uint len, const void *data)
 

Detailed Description

GPU vertex buffer

Definition in file gpu_vertex_buffer.cc.

Function Documentation

◆ GPU_vertbuf_attr_fill()

◆ GPU_vertbuf_attr_fill_stride()

void GPU_vertbuf_attr_fill_stride ( VertBuf * verts,
uint a_idx,
uint stride,
const void * data )

◆ GPU_vertbuf_attr_get_raw_data()

◆ GPU_vertbuf_attr_set()

void GPU_vertbuf_attr_set ( blender::gpu::VertBuf * verts,
uint a_idx,
uint v_idx,
const void * data )

◆ GPU_vertbuf_bind_as_ssbo()

◆ GPU_vertbuf_bind_as_texture()

void GPU_vertbuf_bind_as_texture ( VertBuf * verts,
int binding )

◆ GPU_vertbuf_calloc()

◆ GPU_vertbuf_clear()

void GPU_vertbuf_clear ( blender::gpu::VertBuf * verts)

Same as discard but does not free.

Definition at line 164 of file gpu_vertex_buffer.cc.

References verts.

◆ GPU_vertbuf_create_with_format_ex()

◆ GPU_vertbuf_data_alloc()

void GPU_vertbuf_data_alloc ( blender::gpu::VertBuf & verts,
uint v_len )

Create a new allocation, discarding any existing data.

Definition at line 187 of file gpu_vertex_buffer.cc.

References verts.

Referenced by blender::draw::alloc_final_attribute_vbo(), blender::draw::alloc_final_points_vbo(), batch_screen_edges_get(), batch_sphere_wire(), blf_batch_draw_init(), blender::draw::build_poly_other_map_vbo(), blender::draw::calc_final_indices(), circle_draw_rgb(), blender::draw::create_curve_offsets_vbos(), blender::draw::create_edit_points_position_and_data(), blender::draw::create_edit_points_position_vbo(), blender::draw::create_edit_points_selection(), blender::draw::create_points_position_time_vbo(), blender::draw::curve_create_attribute(), blender::draw::curve_create_curves_pos(), blender::draw::curve_create_edit_curves_nor(), blender::draw::curve_create_edit_data_and_handles(), draw_line_bounds(), draw_line_loop(), draw_line_pairs(), blender::draw::draw_subdiv_cache_update_extra_coarse_face_data(), blender::draw::draw_subdiv_init_origindex_buffer(), blender::draw::draw_subdiv_topology_info_cb(), blender::render::hydra::DrawTexture::DrawTexture(), 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_icon_inner_lines_get(), DRW_cache_light_icon_outer_lines_get(), DRW_cache_light_icon_sun_rays_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_triangle_strips_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(), blender::draw::drw_curves_ensure_dummy_vbo(), DRW_gpencil_dummy_buffer_get(), drw_hair_ensure_vbo(), blender::draw::DRW_pointcloud_init(), DRW_temp_buffer_request(), blender::draw::DRW_vertbuf_create_wiredata(), blender::draw::drw_volume_selection_surface_cb(), blender::draw::drw_volume_wireframe_cb(), blender::draw::ensure_control_point_attribute(), blender::draw::pbvh::ensure_vbos_allocated_bmesh(), blender::draw::pbvh::ensure_vbos_allocated_grids(), blender::draw::pbvh::ensure_vbos_allocated_mesh(), blender::draw::extract_attr_viewer(), blender::draw::extract_attributes_subdiv(), blender::draw::extract_edge_factor(), blender::draw::extract_edit_data(), blender::draw::extract_edit_data_subdiv(), blender::draw::extract_edituv_data(), blender::draw::extract_edituv_data_subdiv(), blender::draw::extract_edituv_stretch_angle(), blender::draw::extract_edituv_stretch_area(), blender::draw::extract_edituv_stretch_area_subdiv(), blender::draw::extract_face_dot_normals(), blender::draw::extract_face_dots_edituv_data(), blender::draw::extract_face_dots_position(), blender::draw::extract_face_dots_uv(), blender::draw::extract_lines_loose_geom_subdiv(), blender::draw::extract_mesh_analysis(), blender::draw::extract_normals(), blender::draw::extract_orco(), blender::draw::extract_positions(), blender::draw::extract_positions_subdiv(), blender::draw::extract_sculpt_data(), blender::draw::extract_sculpt_data_subdiv(), blender::draw::extract_skin_roots(), blender::draw::extract_tangents(), blender::draw::extract_tangents_subdiv(), blender::draw::extract_uv_maps(), blender::draw::extract_vert_normals(), blender::draw::extract_weights(), blender::gpu::MTLContext::get_dummy_texture(), 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(), blender::gpu::tests::gpu_shader_lib_test(), blender::draw::gpu_vertbuf_create_from_format(), GPU_vertbuf_init_build_on_device(), gpu_viewport_batch_create(), blender::draw::grease_pencil_edit_batch_ensure(), blender::draw::grease_pencil_geom_batch_ensure(), blender::draw::grease_pencil_weight_batch_ensure(), immBeginBatch(), blender::draw::init_vbo_data(), blender::draw::init_vbo_for_attribute(), knifetool_draw(), blender::draw::lattice_batch_cache_create_overlay_batches(), blender::draw::lattice_batch_cache_get_pos(), mpath_vbo_get(), blender::ed::space_node::nodelink_batch_init(), blender::draw::particle_batch_cache_ensure_edit_inner_pos(), blender::draw::particle_batch_cache_ensure_edit_pos_and_seg(), blender::draw::particle_batch_cache_ensure_edit_tip_pos(), blender::draw::particle_batch_cache_ensure_pos(), blender::draw::particle_batch_cache_ensure_pos_and_seg(), blender::draw::particle_batch_cache_ensure_procedural_final_points(), blender::draw::particle_batch_cache_ensure_procedural_indices(), blender::draw::particle_batch_cache_ensure_procedural_pos(), blender::draw::particle_batch_cache_ensure_procedural_strand_data(), blender::draw::pointcloud_extract_attribute(), blender::draw::pointcloud_extract_position_and_radius(), pygpu_vertbuf__tp_new(), SeqQuadsBatch::SeqQuadsBatch(), sphere_wire_vbo(), stitch_draw(), blender::gpu::tests::test_buffer_texture(), blender::gpu::tests::test_framebuffer_multi_viewport(), blender::gpu::tests::test_framebuffer_subpass_input(), blender::gpu::tests::test_shader_compute_vbo(), blender::gpu::tests::test_storage_buffer_copy_from_vertex_buffer(), ui_batch_roundbox_shadow_get(), ui_batch_roundbox_widget_get(), blender::gpu::tests::ShaderSpecializationConst::validate(), blender::draw::overlay::vbo_from_vector(), blender::draw::overlay::vbo_from_vector(), blender::draw::overlay::vbo_from_vector(), blender::draw::vertbuf_alloc(), blender::draw::vertbuf_device_alloc(), blender::gpu::tests::vertex_buffer_fetch_mode(), waveform_draw_one(), waveform_draw_rgb(), wm_gizmo_geometryinfo_draw(), and wm_xr_controller_model_batch_create().

◆ GPU_vertbuf_data_len_set()

void GPU_vertbuf_data_len_set ( blender::gpu::VertBuf & verts,
uint v_len )

Set vertex count but does not change allocation. Only this many verts will be uploaded to the GPU and rendered. This is useful for streaming data.

Definition at line 197 of file gpu_vertex_buffer.cc.

References BLI_assert, and verts.

Referenced by blf_batch_draw(), DRW_instance_buffer_finish(), and blender::ed::space_node::nodelink_batch_draw().

◆ GPU_vertbuf_data_resize()

◆ GPU_vertbuf_discard()

◆ GPU_vertbuf_duplicate()

VertBuf * GPU_vertbuf_duplicate ( VertBuf * verts)

Definition at line 154 of file gpu_vertex_buffer.cc.

References blender::gpu::VertBuf::duplicate(), and verts.

◆ GPU_vertbuf_get_format()

◆ GPU_vertbuf_get_memory_usage()

uint GPU_vertbuf_get_memory_usage ( )

Definition at line 305 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 VertBuf * verts)

◆ GPU_vertbuf_get_vertex_alloc()

uint GPU_vertbuf_get_vertex_alloc ( const VertBuf * verts)

◆ GPU_vertbuf_get_vertex_len()

◆ GPU_vertbuf_handle_ref_add()

void GPU_vertbuf_handle_ref_add ( blender::gpu::VertBuf * verts)

Avoid blender::gpu::VertBuf data-block being free but not its data.

Definition at line 175 of file gpu_vertex_buffer.cc.

References verts.

Referenced by instancing_batch_references_add().

◆ GPU_vertbuf_handle_ref_remove()

void GPU_vertbuf_handle_ref_remove ( VertBuf * verts)

Definition at line 180 of file gpu_vertex_buffer.cc.

References verts.

Referenced by instancing_batch_references_remove().

◆ GPU_vertbuf_init_build_on_device()

◆ GPU_vertbuf_init_with_format_ex()

◆ GPU_vertbuf_read()

void GPU_vertbuf_read ( const blender::gpu::VertBuf * verts,
void * data )

(Download and) fill data with the data from the vertex buffer. NOTE: caller is responsible to reserve enough memory of the data parameter.

Definition at line 159 of file gpu_vertex_buffer.cc.

References blender::gpu::VertBuf::read(), and verts.

Referenced by blender::gpu::tests::test_shader_compute_vbo().

◆ GPU_vertbuf_tag_dirty()

◆ GPU_vertbuf_update_sub()

void GPU_vertbuf_update_sub ( blender::gpu::VertBuf * verts,
uint start,
uint len,
const void * data )

XXX: do not use! This is just a wrapper for the use of the Hair refine workaround. To be used with GPU_vertbuf_use().

Definition at line 330 of file gpu_vertex_buffer.cc.

References len, and verts.

Referenced by blender::draw::extract_edge_factor_subdiv(), blender::draw::extract_loose_positions_subdiv(), blender::draw::extract_normals_subdiv(), and blender::draw::vertbuf_update_data().

◆ GPU_vertbuf_use()

◆ GPU_vertbuf_vert_set()

◆ GPU_vertbuf_wrap_handle()

void GPU_vertbuf_wrap_handle ( VertBuf * verts,
uint64_t handle )

Definition at line 315 of file gpu_vertex_buffer.cc.

References verts.

Referenced by blender::draw::vertbuf_wrap_device_handle().