Blender V4.3
blender::gpu::IndexBuf Class Referenceabstract

#include <GPU_index_buffer.hh>

Inherited by blender::gpu::GLIndexBuf, blender::gpu::MTLIndexBuf, and blender::gpu::VKIndexBuffer.

Public Member Functions

 IndexBuf ()
 
virtual ~IndexBuf ()
 
void init (uint indices_len, uint32_t *indices, uint min_index, uint max_index, GPUPrimType prim_type, bool uses_restart_indices)
 
void init_subrange (IndexBuf *elem_src, uint start, uint length)
 
void init_build_on_device (uint index_len)
 
uint32_t index_len_get () const
 
uint32_t index_start_get () const
 
uint32_t index_base_get () const
 
bool is_32bit () const
 
size_t size_get () const
 
bool is_init () const
 
virtual void upload_data ()=0
 
virtual void bind_as_ssbo (uint binding)=0
 
virtual void read (uint32_t *data) const =0
 
virtual void update_sub (uint start, uint len, const void *data)=0
 

Protected Attributes

GPUIndexBufType index_type_ = GPU_INDEX_U32
 
uint32_t index_start_ = 0
 
uint32_t index_len_ = 0
 
uint32_t index_base_ = 0
 
bool is_init_ = false
 
bool is_subrange_ = false
 
bool is_empty_ = false
 
union { 
 
   void *   data_ = nullptr 
 
   IndexBuf *   src_ 
 
};  
 

Detailed Description

Base class which is then specialized for each implementation (GL, VK, ...).

Note
IndexBuf does not hold any GPUPrimType. This is because it can be interpreted differently by multiple batches.

Definition at line 40 of file GPU_index_buffer.hh.

Constructor & Destructor Documentation

◆ IndexBuf()

blender::gpu::IndexBuf::IndexBuf ( )
inline

Definition at line 65 of file GPU_index_buffer.hh.

◆ ~IndexBuf()

blender::gpu::IndexBuf::~IndexBuf ( )
virtual

Definition at line 306 of file gpu_index_buffer.cc.

References data_, is_subrange_, and MEM_SAFE_FREE.

Member Function Documentation

◆ bind_as_ssbo()

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

◆ index_base_get()

uint32_t blender::gpu::IndexBuf::index_base_get ( ) const
inline

Definition at line 88 of file GPU_index_buffer.hh.

References index_base_.

Referenced by blender::gpu::VKDrawList::append().

◆ index_len_get()

uint32_t blender::gpu::IndexBuf::index_len_get ( ) const
inline

Definition at line 78 of file GPU_index_buffer.hh.

References index_len_, and is_empty_.

Referenced by blender::gpu::VKDrawList::append().

◆ index_start_get()

uint32_t blender::gpu::IndexBuf::index_start_get ( ) const
inline

Definition at line 84 of file GPU_index_buffer.hh.

References index_start_.

Referenced by blender::gpu::VKDrawList::append(), and blender::gpu::VKBatch::draw().

◆ init()

void blender::gpu::IndexBuf::init ( uint indices_len,
uint32_t * indices,
uint min_index,
uint max_index,
GPUPrimType prim_type,
bool uses_restart_indices )

◆ init_build_on_device()

void blender::gpu::IndexBuf::init_build_on_device ( uint index_len)

◆ init_subrange()

void blender::gpu::IndexBuf::init_subrange ( IndexBuf * elem_src,
uint start,
uint length )

◆ is_32bit()

bool blender::gpu::IndexBuf::is_32bit ( ) const
inline

Definition at line 92 of file GPU_index_buffer.hh.

References blender::gpu::GPU_INDEX_U32, and index_type_.

◆ is_init()

bool blender::gpu::IndexBuf::is_init ( ) const
inline

Definition at line 102 of file GPU_index_buffer.hh.

References is_init_.

Referenced by GPU_indexbuf_is_init().

◆ read()

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

◆ size_get()

◆ update_sub()

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

◆ upload_data()

virtual void blender::gpu::IndexBuf::upload_data ( )
pure virtual

Member Data Documentation

◆ [union]

union { ... } blender::gpu::IndexBuf

◆ data_

void* blender::gpu::IndexBuf::data_ = nullptr

◆ index_base_

uint32_t blender::gpu::IndexBuf::index_base_ = 0
protected

Base index: Added to all indices after fetching. Allows index compression.

Definition at line 49 of file GPU_index_buffer.hh.

Referenced by blender::gpu::GLDrawList::append(), blender::gpu::MTLDrawList::append(), blender::gpu::MTLBatch::bind(), blender::gpu::GLBatch::draw(), index_base_get(), and init_subrange().

◆ index_len_

uint32_t blender::gpu::IndexBuf::index_len_ = 0
protected

◆ index_start_

uint32_t blender::gpu::IndexBuf::index_start_ = 0
protected

◆ index_type_

◆ is_empty_

bool blender::gpu::IndexBuf::is_empty_ = false
protected

True if buffer only contains restart indices.

Definition at line 55 of file GPU_index_buffer.hh.

Referenced by index_len_get(), and init().

◆ is_init_

bool blender::gpu::IndexBuf::is_init_ = false
protected

Bookkeeping.

Definition at line 51 of file GPU_index_buffer.hh.

Referenced by init(), init_build_on_device(), init_subrange(), and is_init().

◆ is_subrange_

◆ src_

IndexBuf* blender::gpu::IndexBuf::src_

If is_subrange is true, this is the source index buffer.

Definition at line 61 of file GPU_index_buffer.hh.

Referenced by blender::gpu::GLIndexBuf::bind(), blender::gpu::VKIndexBuffer::ensure_updated(), init_subrange(), and blender::gpu::MTLIndexBuf::upload_data().


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