Blender  V3.3
Public Member Functions | Protected Attributes | List of all members
blender::gpu::IndexBuf Class Referenceabstract

#include <gpu_index_buffer_private.hh>

Inheritance diagram for blender::gpu::IndexBuf:
blender::gpu::GLIndexBuf

Public Member Functions

 IndexBuf ()
 
virtual ~IndexBuf ()
 
void init (uint indices_len, uint32_t *indices, uint min_index, uint max_index)
 
void init_subrange (IndexBuf *elem_src, uint start, uint length)
 
void init_build_on_device (uint index_len)
 
uint32_t index_len_get () const
 
size_t size_get () const
 
bool is_init () const
 
virtual void upload_data ()=0
 
virtual void bind_as_ssbo (uint binding)=0
 
virtual const uint32_tread () const =0
 
uint32_tunmap (const uint32_t *mapped_memory) const
 
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 34 of file gpu_index_buffer_private.hh.

Constructor & Destructor Documentation

◆ IndexBuf()

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

Definition at line 59 of file gpu_index_buffer_private.hh.

◆ ~IndexBuf()

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

Definition at line 222 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

Implemented in blender::gpu::GLIndexBuf.

◆ index_len_get()

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

Definition at line 67 of file gpu_index_buffer_private.hh.

References index_len_, and is_empty_.

◆ init()

void blender::gpu::IndexBuf::init ( uint  indices_len,
uint32_t indices,
uint  min_index,
uint  max_index 
)

◆ 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_init()

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

Definition at line 79 of file gpu_index_buffer_private.hh.

References is_init_.

◆ read()

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

Implemented in blender::gpu::GLIndexBuf.

◆ size_get()

size_t blender::gpu::IndexBuf::size_get ( ) const
inline

◆ unmap()

uint32_t * blender::gpu::IndexBuf::unmap ( const uint32_t mapped_memory) const

Definition at line 326 of file gpu_index_buffer.cc.

References MEM_mallocN, result, size(), and size_get().

◆ update_sub()

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

Implemented in blender::gpu::GLIndexBuf.

◆ upload_data()

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

Implemented in blender::gpu::GLIndexBuf.

Member Data Documentation

◆ 

union { ... }

◆ data_

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

Mapped buffer data. non-NULL indicates not yet sent to VRAM.

Definition at line 53 of file gpu_index_buffer_private.hh.

Referenced by blender::gpu::GLIndexBuf::bind(), blender::gpu::GLIndexBuf::bind_as_ssbo(), init(), init_build_on_device(), and ~IndexBuf().

◆ 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 43 of file gpu_index_buffer_private.hh.

Referenced by blender::gpu::GLDrawList::append(), blender::gpu::GLBatch::draw(), and init_subrange().

◆ index_len_

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

Number of indices to render.

Definition at line 41 of file gpu_index_buffer_private.hh.

Referenced by blender::gpu::GLDrawList::append(), index_len_get(), init(), init_build_on_device(), init_subrange(), and size_get().

◆ index_start_

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

Offset in this buffer to the first index to render. Is 0 if not a subrange.

Definition at line 39 of file gpu_index_buffer_private.hh.

Referenced by blender::gpu::GLDrawList::append(), init(), init_build_on_device(), init_subrange(), and blender::gpu::GLIndexBuf::offset_ptr().

◆ index_type_

GPUIndexBufType blender::gpu::IndexBuf::index_type_ = GPU_INDEX_U32
protected

◆ is_empty_

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

True if buffer only contains restart indices.

Definition at line 49 of file gpu_index_buffer_private.hh.

Referenced by index_len_get(), and init().

◆ is_init_

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

Bookkeeping.

Definition at line 45 of file gpu_index_buffer_private.hh.

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

◆ is_subrange_

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

Is this object only a reference to a subrange of another IndexBuf.

Definition at line 47 of file gpu_index_buffer_private.hh.

Referenced by blender::gpu::GLIndexBuf::bind(), init_subrange(), and ~IndexBuf().

◆ src_

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

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

Definition at line 55 of file gpu_index_buffer_private.hh.

Referenced by blender::gpu::GLIndexBuf::bind(), and init_subrange().


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