Blender V5.0
blender::gpu::VertBuf Class Referenceabstract

#include <GPU_vertex_buffer.hh>

Inherited by blender::gpu::DummyVertexBuffer, blender::gpu::GLVertBuf, blender::gpu::MTLVertBuf, and blender::gpu::VKVertexBuffer.

Public Member Functions

 VertBuf ()
virtual ~VertBuf ()
void init (const GPUVertFormat &format, GPUUsageType usage)
void clear ()
void allocate (uint vert_len)
void resize (uint vert_len)
void upload ()
virtual void bind_as_ssbo (uint binding)=0
virtual void bind_as_texture (uint binding)=0
virtual void wrap_handle (uint64_t handle)=0
size_t size_alloc_get () const
size_t size_used_get () const
void reference_add ()
void reference_remove ()
GPUUsageType get_usage_type () const
template<typename T>
MutableSpan< Tdata ()
virtual void update_sub (uint start, uint len, const void *data)=0
virtual void read (void *data) const =0

Static Public Member Functions

template<typename FormatT>
static VertBufPtr from_size_with_format (const int size, GPUUsageType usage=GPU_USAGE_STATIC)
template<typename T>
static VertBufPtr from_size (const int size, GPUUsageType usage=GPU_USAGE_STATIC)
template<typename T>
static VertBufPtr from_span (const Span< T > data)
template<typename T>
static VertBufPtr from_varray (const VArray< T > &array)
template<typename T>
static VertBufPtr device_only (uint size)

Public Attributes

GPUVertFormat format = {}
uint vertex_len = 0
uint vertex_alloc = 0
GPUVertBufStatus flag = GPU_VERTBUF_INVALID
GPUUsageType extended_usage_ = GPU_USAGE_STATIC

Static Public Attributes

static size_t memory_usage = 0

Protected Member Functions

virtual void acquire_data ()=0
virtual void resize_data ()=0
virtual void release_data ()=0
virtual void upload_data ()=0

Protected Attributes

uchardata_ = nullptr
GPUUsageType usage_ = GPU_USAGE_STATIC

Detailed Description

Implementation of Vertex Buffers. Base class which is then specialized for each implementation (GL, VK, ...).

Definition at line 89 of file GPU_vertex_buffer.hh.

Constructor & Destructor Documentation

◆ VertBuf()

blender::gpu::VertBuf::VertBuf ( )

Definition at line 30 of file gpu_vertex_buffer.cc.

References format.

Referenced by blender::gpu::MTLVertBuf::MTLVertBuf().

◆ ~VertBuf()

blender::gpu::VertBuf::~VertBuf ( )
virtual

Definition at line 36 of file gpu_vertex_buffer.cc.

References BLI_assert, flag, and GPU_VERTBUF_INVALID.

Member Function Documentation

◆ acquire_data()

virtual void blender::gpu::VertBuf::acquire_data ( )
protectedpure virtual

◆ allocate()

◆ bind_as_ssbo()

virtual void blender::gpu::VertBuf::bind_as_ssbo ( uint binding)
pure virtual

◆ bind_as_texture()

virtual void blender::gpu::VertBuf::bind_as_texture ( uint binding)
pure virtual

◆ clear()

void blender::gpu::VertBuf::clear ( )

Definition at line 64 of file gpu_vertex_buffer.cc.

References flag, GPU_VERTBUF_INVALID, and release_data().

◆ data()

template<typename T>
MutableSpan< T > blender::gpu::VertBuf::data ( )
inline

Returns access to the data allocated for the vertex buffer. The size of the data type must match the data type used on the GPU.

Definition at line 217 of file GPU_vertex_buffer.hh.

References blender::MutableSpan< T >::cast(), data_, size_alloc_get(), and T.

Referenced by blender::draw::build_poly_other_map_vbo(), blender::draw::create_edit_points_data(), blender::draw::create_edit_points_position(), blender::draw::create_edit_points_position_vbo(), blender::draw::create_edit_points_selection(), blender::draw::curve_create_attribute(), blender::draw::draw_subdiv_cache_update_extra_coarse_face_data(), blender::draw::DRW_vertbuf_create_wiredata(), blender::draw::extract_data_bmesh_edge(), blender::draw::extract_data_bmesh_face(), blender::draw::extract_data_bmesh_loop(), blender::draw::extract_data_bmesh_vert(), blender::draw::pbvh::extract_data_corner_bmesh(), blender::draw::pbvh::extract_data_corner_mesh(), blender::draw::pbvh::extract_data_face_bmesh(), blender::draw::pbvh::extract_data_face_mesh(), blender::draw::extract_data_mesh_face(), blender::draw::extract_data_mesh_mapped_corner(), blender::draw::pbvh::extract_data_vert_bmesh(), blender::draw::pbvh::extract_data_vert_mesh(), blender::draw::extract_edge_index_subdiv(), blender::draw::extract_edit_subdiv_data_bm(), blender::draw::extract_edit_subdiv_data_mesh(), blender::draw::extract_edituv_lines_subdiv_bm(), blender::draw::extract_edituv_lines_subdiv_mesh(), blender::draw::extract_edituv_points_subdiv_bm(), blender::draw::extract_edituv_points_subdiv_mesh(), blender::draw::extract_edituv_stretch_area_subdiv(), blender::draw::extract_edituv_subdiv_data_bm(), blender::draw::extract_edituv_subdiv_data_mesh(), blender::draw::extract_lines_loose_geom_subdiv(), blender::draw::extract_lines_paint_mask_subdiv(), blender::draw::extract_points_subdiv_bm(), blender::draw::extract_points_subdiv_mesh(), blender::draw::extract_sculpt_data_subdiv(), blender::draw::extract_tangents_subdiv(), blender::draw::extract_vert_index_subdiv(), from_span(), blender::opensubdiv::EvalOutputAPI::getPatchMap(), blender::gpu::GLVertBuf::GLStorageBuf, blender::draw::grease_pencil_edit_batch_ensure(), blender::draw::grease_pencil_geom_batch_ensure(), blender::draw::grease_pencil_weight_batch_ensure(), blender::draw::pointcloud_extract_attribute(), blender::draw::pointcloud_extract_position_and_radius(), pygpu_vertbuf_fill(), blender::gpu::GLVertBuf::read(), blender::gpu::MTLVertBuf::read(), read(), blender::gpu::VKVertexBuffer::read(), blender::draw::test_draw_curves_interpolate_attributes(), blender::draw::test_draw_curves_interpolate_position(), blender::draw::test_draw_curves_lib(), blender::draw::test_draw_curves_topology(), blender::gpu::GLVertBuf::update_sub(), blender::gpu::MTLVertBuf::update_sub(), update_sub(), blender::gpu::VKVertexBuffer::update_sub(), waveform_draw_rgb(), and wm_xr_controller_model_batch_create().

◆ device_only()

◆ from_size()

template<typename T>
VertBufPtr blender::gpu::VertBuf::from_size ( const int size,
GPUUsageType usage = GPU_USAGE_STATIC )
inlinestatic

◆ from_size_with_format()

template<typename FormatT>
VertBufPtr blender::gpu::VertBuf::from_size_with_format ( const int size,
GPUUsageType usage = GPU_USAGE_STATIC )
inlinestatic

◆ from_span()

◆ from_varray()

◆ get_usage_type()

GPUUsageType blender::gpu::VertBuf::get_usage_type ( ) const
inline

Definition at line 208 of file GPU_vertex_buffer.hh.

References usage_.

Referenced by blender::gpu::MTLVertBuf::bind().

◆ init()

◆ read()

virtual void blender::gpu::VertBuf::read ( void * data) const
pure virtual

◆ reference_add()

void blender::gpu::VertBuf::reference_add ( )
inline

Definition at line 195 of file GPU_vertex_buffer.hh.

◆ reference_remove()

void blender::gpu::VertBuf::reference_remove ( )
inline

Definition at line 199 of file GPU_vertex_buffer.hh.

References BLI_assert.

◆ release_data()

virtual void blender::gpu::VertBuf::release_data ( )
protectedpure virtual

◆ resize()

void blender::gpu::VertBuf::resize ( uint vert_len)

◆ resize_data()

virtual void blender::gpu::VertBuf::resize_data ( )
protectedpure virtual

◆ size_alloc_get()

◆ size_used_get()

◆ update_sub()

virtual void blender::gpu::VertBuf::update_sub ( uint start,
uint len,
const void * data )
pure virtual

◆ upload()

void blender::gpu::VertBuf::upload ( )

Definition at line 93 of file gpu_vertex_buffer.cc.

References upload_data().

Referenced by blender::gpu::VKStorageBuffer::copy_sub().

◆ upload_data()

virtual void blender::gpu::VertBuf::upload_data ( )
protectedpure virtual

◆ wrap_handle()

virtual void blender::gpu::VertBuf::wrap_handle ( uint64_t handle)
pure virtual

Member Data Documentation

◆ data_

◆ extended_usage_

GPUUsageType blender::gpu::VertBuf::extended_usage_ = GPU_USAGE_STATIC

Usage including extended usage flags.

Definition at line 103 of file GPU_vertex_buffer.hh.

Referenced by GPU_texture_create_from_vertbuf(), and init().

◆ flag

◆ format

◆ memory_usage

size_t blender::gpu::VertBuf::memory_usage = 0
static

◆ usage_

◆ vertex_alloc

uint blender::gpu::VertBuf::vertex_alloc = 0

Number of verts data.

Definition at line 97 of file GPU_vertex_buffer.hh.

Referenced by allocate(), and resize().

◆ vertex_len


The documentation for this class was generated from the following files: