|
Blender V5.3
|
#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< T > | data () |
| virtual void | update_sub (uint start, uint len, const void *data)=0 |
| virtual void | copy_sub (VertBuf &source_buf, uint source_first_vertex, uint dest_first_vertex, uint vertex_len)=0 |
| Copy from part of source vertex buffer into the vertex buffer. | |
| 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 | |
| uchar * | data_ = nullptr |
| GPUUsageType | usage_ = GPU_USAGE_STATIC |
Implementation of Vertex Buffers. Base class which is then specialized for each implementation (GL, VK, ...).
Definition at line 92 of file GPU_vertex_buffer.hh.
| blender::gpu::VertBuf::VertBuf | ( | ) |
Definition at line 32 of file gpu_vertex_buffer.cc.
References blender::GPUVertFormat::attr_len, and format.
Referenced by blender::gpu::DummyVertexBuffer::copy_sub(), blender::gpu::GLVertBuf::copy_sub(), blender::gpu::MTLVertBuf::copy_sub(), copy_sub(), blender::gpu::VKVertexBuffer::copy_sub(), blender::gpu::GLVertBuf::GLStorageBuf, and blender::gpu::MTLVertBuf::MTLVertBuf().
|
virtual |
Definition at line 38 of file gpu_vertex_buffer.cc.
References blender::BLI_assert(), flag, and blender::GPU_VERTBUF_INVALID.
|
protectedpure virtual |
Implemented in blender::gpu::DummyVertexBuffer, blender::gpu::GLVertBuf, blender::gpu::MTLVertBuf, and blender::gpu::VKVertexBuffer.
Referenced by allocate().
| void blender::gpu::VertBuf::allocate | ( | uint | vert_len | ) |
Definition at line 72 of file gpu_vertex_buffer.cc.
References acquire_data(), blender::BLI_assert(), data_, flag, format, blender::GPU_VERTBUF_DATA_DIRTY, blender::GPUVertFormat::packed, vertex_alloc, and vertex_len.
Referenced by blender::draw::GSplatEvalCache::ensure_compute_buffers(), blender::GPU_vertbuf_data_alloc(), blender::draw::test_draw_curves_interpolate_attributes(), blender::draw::test_draw_curves_interpolate_position(), blender::draw::test_draw_curves_lib(), and blender::draw::test_draw_curves_topology().
|
pure virtual |
Implemented in blender::gpu::DummyVertexBuffer, blender::gpu::GLVertBuf, blender::gpu::MTLVertBuf, and blender::gpu::VKVertexBuffer.
Referenced by blender::GPU_vertbuf_bind_as_ssbo().
|
pure virtual |
Implemented in blender::gpu::DummyVertexBuffer, blender::gpu::GLVertBuf, blender::gpu::MTLVertBuf, and blender::gpu::VKVertexBuffer.
Referenced by blender::GPU_vertbuf_bind_as_texture().
| void blender::gpu::VertBuf::clear | ( | ) |
Definition at line 66 of file gpu_vertex_buffer.cc.
References flag, blender::GPU_VERTBUF_INVALID, and release_data().
Referenced by blender::GPU_vertbuf_clear(), and blender::GPU_vertbuf_discard().
|
pure virtual |
Copy from part of source vertex buffer into the vertex buffer.
| source_buf | source vertex buffer to copy data from. |
| source_first_vertex | starting vertex index to start copying the data from. |
| dest_first_vertex | starting vertex index to copy the data to. |
| vertex_len | the number of vertices to copy. |
Implemented in blender::gpu::DummyVertexBuffer, blender::gpu::GLVertBuf, blender::gpu::MTLVertBuf, and blender::gpu::VKVertexBuffer.
References VertBuf(), and vertex_len.
Referenced by blender::gpu::tests::test_vertex_buffer_copy_sub().
|
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 220 of file GPU_vertex_buffer.hh.
References data_, blender::MutableSpan< T >::MutableSpan(), 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_radius(), blender::draw::create_edit_points_selection(), blender::draw::curve_create_attribute(), blender::draw::curve_create_edit_data_and_handles(), blender::draw::draw_subdiv_cache_update_extra_coarse_face_data(), blender::draw::DRW_vertbuf_create_wiredata(), blender::draw::GSplatEvalCache::ensure_attribute(), 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::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(), blender::draw::pbvh::fill_face_data_grids(), from_span(), blender::opensubdiv::EvalOutputAPI::getPatchMap(), blender::gpu::GLVertBuf::GLStorageBuf, blender::GPU_vertbuf_attr_fill_stride(), blender::GPU_vertbuf_attr_get_raw_data(), blender::GPU_vertbuf_attr_set(), blender::GPU_vertbuf_data_len_set(), blender::GPU_vertbuf_vert_set(), blender::draw::grease_pencil_edit_batch_ensure(), blender::draw::grease_pencil_geom_batch_ensure(), blender::draw::grease_pencil_weight_batch_ensure(), blender::immBeginBatch(), blender::draw::pbvh::interpolate_corner_data_for_flat_layout(), blender::draw::pbvh::interpolate_corner_data_for_standard_layout(), blender::draw::pbvh::interpolate_vert_data_for_flat_layout(), blender::draw::pbvh::interpolate_vert_data_for_standard_layout(), blender::draw::lattice_batch_cache_create_overlay_batches(), blender::draw::pointcloud_extract_attribute(), blender::draw::pointcloud_extract_position_and_radius(), blender::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(), blender::ui::waveform_draw_rgb(), and blender::wm_xr_controller_model_batch_create().
|
inlinestatic |
Definition at line 163 of file GPU_vertex_buffer.hh.
References blender::BLI_assert(), blender::GPU_USAGE_DEVICE_ONLY, blender::GPU_USAGE_FLAG_BUFFER_TEXTURE_ONLY, and blender::GPU_vertbuf_create_with_format_ex().
Referenced by blender::draw::CurvesEvalCache::ensure_positions(), blender::draw::CurvesEvalCache::ensure_positions(), blender::draw::CurvesModule::evaluate_topology_indirection(), and blender::draw::CurvesEvalCache::indirection_buf_get().
|
inlinestatic |
Definition at line 135 of file GPU_vertex_buffer.hh.
References from_size_with_format(), and blender::GPU_USAGE_STATIC.
Referenced by blender::draw::bm_corner_indices_create(), blender::draw::CurvesEvalCache::ensure_positions(), and blender::draw::face_offsets_ensure().
|
inlinestatic |
Definition at line 125 of file GPU_vertex_buffer.hh.
References blender::BLI_assert(), blender::ceil_to_multiple_u(), blender::GPU_USAGE_STATIC, and blender::GPU_vertbuf_create_with_format_ex().
Referenced by from_size().
|
inlinestatic |
Definition at line 140 of file GPU_vertex_buffer.hh.
References blender::BLI_assert(), blender::ceil_to_multiple_u(), blender::array_utils::copy(), data(), blender::GPU_USAGE_FLAG_BUFFER_TEXTURE_ONLY, blender::GPU_USAGE_STATIC, blender::GPU_vertbuf_create_with_format_ex(), and T.
Referenced by blender::draw::corner_edges_ensure(), blender::draw::corner_verts_ensure(), blender::draw::CurvesEvalCache::ensure_bezier(), blender::draw::CurvesEvalCache::ensure_common(), blender::draw::CurvesEvalCache::ensure_common(), blender::draw::CurvesEvalCache::ensure_nurbs(), blender::draw::CurvesEvalCache::ensure_positions(), and blender::draw::face_offsets_ensure().
|
inlinestatic |
Definition at line 151 of file GPU_vertex_buffer.hh.
References blender::BLI_assert(), blender::ceil_to_multiple_u(), blender::array_utils::copy(), blender::GPU_USAGE_FLAG_BUFFER_TEXTURE_ONLY, blender::GPU_USAGE_STATIC, blender::GPU_vertbuf_create_with_format_ex(), array< T, alignment >::size(), and T.
Referenced by blender::draw::CurvesEvalCache::ensure_common(), blender::draw::CurvesEvalCache::ensure_common(), blender::draw::ensure_curve_attribute(), blender::draw::CurvesEvalCache::ensure_nurbs(), and blender::draw::CurvesEvalCache::ensure_positions().
|
inline |
Definition at line 211 of file GPU_vertex_buffer.hh.
References usage_.
Referenced by blender::gpu::MTLVertBuf::bind(), blender::GPU_vertbuf_attr_fill_stride(), blender::GPU_vertbuf_attr_set(), and blender::GPU_vertbuf_vert_set().
| void blender::gpu::VertBuf::init | ( | const GPUVertFormat & | format, |
| GPUUsageType | usage ) |
Definition at line 44 of file gpu_vertex_buffer.cc.
References BLI_assert_msg, extended_usage_, flag, format, blender::GPU_USAGE_FLAG_BUFFER_TEXTURE_ONLY, blender::GPU_VERTBUF_DATA_DIRTY, blender::GPU_VERTBUF_INIT, blender::GPU_vertformat_copy(), blender::GPUVertFormat::packed, usage_, and blender::VertexFormat_pack().
Referenced by blender::draw::GSplatEvalCache::ensure_compute_buffers(), blender::GPU_vertbuf_create_with_format_ex(), and blender::GPU_vertbuf_init_with_format_ex().
|
pure virtual |
Implemented in blender::gpu::DummyVertexBuffer, blender::gpu::GLVertBuf, blender::gpu::MTLVertBuf, and blender::gpu::VKVertexBuffer.
References data().
Referenced by blender::GPU_vertbuf_read().
|
inline |
Definition at line 198 of file GPU_vertex_buffer.hh.
Referenced by blender::GPU_vertbuf_handle_ref_add().
|
inline |
Definition at line 202 of file GPU_vertex_buffer.hh.
References blender::BLI_assert().
Referenced by blender::GPU_vertbuf_discard(), and blender::GPU_vertbuf_handle_ref_remove().
|
protectedpure virtual |
Implemented in blender::gpu::DummyVertexBuffer, blender::gpu::GLVertBuf, blender::gpu::MTLVertBuf, and blender::gpu::VKVertexBuffer.
Referenced by clear().
| void blender::gpu::VertBuf::resize | ( | uint | vert_len | ) |
Definition at line 84 of file gpu_vertex_buffer.cc.
References blender::BLI_assert(), flag, blender::GPU_VERTBUF_DATA_DIRTY, resize_data(), vertex_alloc, and vertex_len.
Referenced by blender::GPU_vertbuf_data_resize().
|
protectedpure virtual |
Implemented in blender::gpu::DummyVertexBuffer, blender::gpu::GLVertBuf, blender::gpu::MTLVertBuf, and blender::gpu::VKVertexBuffer.
Referenced by resize().
|
inline |
Definition at line 186 of file GPU_vertex_buffer.hh.
References blender::BLI_assert(), blender::GPUVertFormat::packed, and blender::GPUVertFormat::stride.
Referenced by blender::gpu::DummyVertexBuffer::acquire_data(), blender::gpu::GLVertBuf::acquire_data(), blender::gpu::MTLVertBuf::acquire_data(), blender::gpu::VKVertexBuffer::acquire_data(), data(), blender::gpu::GLVertBuf::resize_data(), blender::gpu::MTLVertBuf::resize_data(), and blender::gpu::VKVertexBuffer::resize_data().
|
inline |
Definition at line 192 of file GPU_vertex_buffer.hh.
References blender::BLI_assert(), format, and blender::GPUVertFormat::stride.
Referenced by blender::gpu::GLVertBuf::bind(), blender::gpu::MTLVertBuf::bind(), blender::gpu::GLVertBuf::read(), and blender::gpu::MTLVertBuf::read().
|
pure virtual |
Implemented in blender::gpu::DummyVertexBuffer, blender::gpu::GLVertBuf, blender::gpu::MTLVertBuf, and blender::gpu::VKVertexBuffer.
Referenced by blender::GPU_vertbuf_update_sub().
| void blender::gpu::VertBuf::upload | ( | ) |
Definition at line 95 of file gpu_vertex_buffer.cc.
References upload_data().
Referenced by blender::gpu::VKStorageBuffer::copy_sub(), blender::gpu::VKBatch::ensure_data_uploaded(), and blender::GPU_vertbuf_use().
|
protectedpure virtual |
Implemented in blender::gpu::DummyVertexBuffer, blender::gpu::GLVertBuf, blender::gpu::MTLVertBuf, and blender::gpu::VKVertexBuffer.
Referenced by upload().
|
pure virtual |
Implemented in blender::gpu::DummyVertexBuffer, blender::gpu::GLVertBuf, blender::gpu::MTLVertBuf, and blender::gpu::VKVertexBuffer.
Referenced by blender::GPU_vertbuf_wrap_handle().
NULL indicates data in VRAM (unmapped)
Definition at line 111 of file GPU_vertex_buffer.hh.
Referenced by blender::gpu::DummyVertexBuffer::acquire_data(), blender::gpu::GLVertBuf::acquire_data(), blender::gpu::MTLVertBuf::acquire_data(), blender::gpu::VKVertexBuffer::acquire_data(), allocate(), blender::gpu::GLVertBuf::bind(), blender::gpu::MTLVertBuf::bind(), data(), blender::gpu::DummyVertexBuffer::release_data(), blender::gpu::GLVertBuf::release_data(), blender::gpu::MTLVertBuf::release_data(), blender::gpu::VKVertexBuffer::release_data(), blender::gpu::GLVertBuf::resize_data(), blender::gpu::MTLVertBuf::resize_data(), blender::gpu::VKVertexBuffer::resize_data(), and blender::gpu::VKVertexBuffer::upload_data().
| GPUUsageType blender::gpu::VertBuf::extended_usage_ = GPU_USAGE_STATIC |
Usage including extended usage flags.
Definition at line 106 of file GPU_vertex_buffer.hh.
Referenced by init().
| GPUVertBufStatus blender::gpu::VertBuf::flag = GPU_VERTBUF_INVALID |
Status flag.
Definition at line 102 of file GPU_vertex_buffer.hh.
Referenced by allocate(), blender::gpu::GLVertBuf::bind(), blender::gpu::MTLVertBuf::bind(), clear(), blender::GPU_vertbuf_attr_fill(), blender::GPU_vertbuf_attr_fill_stride(), blender::GPU_vertbuf_attr_get_raw_data(), blender::GPU_vertbuf_attr_set(), blender::GPU_vertbuf_get_status(), blender::GPU_vertbuf_tag_dirty(), blender::GPU_vertbuf_vert_set(), init(), resize(), blender::gpu::VKVertexBuffer::upload_data(), blender::gpu::GLVertBuf::wrap_handle(), blender::gpu::MTLVertBuf::wrap_handle(), and ~VertBuf().
| GPUVertFormat blender::gpu::VertBuf::format = {} |
Definition at line 96 of file GPU_vertex_buffer.hh.
Referenced by blender::gpu::MTLBottomLevelAS::add_geometry(), blender::gpu::VKBottomLevelAS::add_geometry(), allocate(), blender::bind_attribute_as_ssbo(), blender::gpu::GLVertBuf::copy_sub(), blender::gpu::MTLVertBuf::copy_sub(), blender::gpu::VKVertexBuffer::copy_sub(), blender::GPU_vertbuf_attr_fill(), blender::GPU_vertbuf_attr_fill_stride(), blender::GPU_vertbuf_attr_get_raw_data(), blender::GPU_vertbuf_attr_set(), blender::GPU_vertbuf_get_format(), blender::GPU_vertbuf_vert_set(), init(), blender::eevee::VelocityModule::VelocityGeometryData::pos_buf_get(), size_used_get(), blender::gpu::VKVertexBuffer::to_vk_format(), blender::gpu::GLVertArray::update_bindings(), blender::gpu::VKVertexAttributeObject::update_bindings(), and VertBuf().
|
static |
Definition at line 94 of file GPU_vertex_buffer.hh.
Referenced by blender::gpu::GLVertBuf::bind(), blender::GPU_vertbuf_get_memory_usage(), and blender::gpu::GLVertBuf::release_data().
|
protected |
Usage hint for GL optimization.
Definition at line 114 of file GPU_vertex_buffer.hh.
Referenced by blender::gpu::GLVertBuf::acquire_data(), blender::gpu::MTLVertBuf::acquire_data(), blender::gpu::VKVertexBuffer::acquire_data(), blender::gpu::GLVertBuf::bind(), blender::gpu::MTLVertBuf::bind(), get_usage_type(), init(), blender::gpu::MTLVertBuf::read(), blender::gpu::GLVertBuf::resize_data(), blender::gpu::MTLVertBuf::resize_data(), blender::gpu::VKVertexBuffer::resize_data(), and blender::gpu::VKVertexBuffer::upload_data().
| uint blender::gpu::VertBuf::vertex_alloc = 0 |
Number of verts data.
Definition at line 100 of file GPU_vertex_buffer.hh.
Referenced by allocate(), blender::GPU_vertbuf_attr_get_raw_data(), blender::GPU_vertbuf_data_len_set(), blender::GPU_vertbuf_get_vertex_alloc(), and resize().
| uint blender::gpu::VertBuf::vertex_len = 0 |
Number of verts we want to draw.
Definition at line 98 of file GPU_vertex_buffer.hh.
Referenced by blender::gpu::VKBottomLevelAS::add_geometry(), allocate(), blender::bind_attribute_as_ssbo(), blender::gpu::GLVertBuf::copy_sub(), blender::gpu::MTLVertBuf::copy_sub(), copy_sub(), blender::gpu::VKVertexBuffer::copy_sub(), blender::gpu::GLVertBuf::GLStorageBuf, blender::GPU_vertbuf_attr_fill_stride(), blender::GPU_vertbuf_data_len_set(), blender::GPU_vertbuf_get_vertex_len(), blender::gpu::MTLTexture::init_internal(), resize(), blender::gpu::GLVertArray::update_bindings(), and blender::gpu::VKVertexAttributeObject::update_bindings().