KiCad PCB EDA Suite
|
#include <vertex_container.h>
Public Member Functions | |
virtual | ~VERTEX_CONTAINER () |
virtual bool | IsCached () const =0 |
Return true if the container caches vertex data in RAM or video memory. | |
virtual void | Map () |
Prepare the container for vertices updates. | |
virtual void | Unmap () |
Finish the vertices updates stage. | |
virtual void | SetItem (VERTEX_ITEM *aItem)=0 |
Set the item for the further actions. | |
virtual void | FinishItem () |
Clean up after adding an item. | |
virtual VERTEX * | Allocate (unsigned int aSize)=0 |
Return allocated space for the requested number of vertices associated with the current item (set with SetItem()). | |
virtual void | Delete (VERTEX_ITEM *aItem)=0 |
Erase the data related to an item. | |
virtual void | Clear ()=0 |
Remove all data stored in the container and restores its original state. | |
VERTEX * | GetAllVertices () const |
Return pointer to the vertices stored in the container. | |
virtual VERTEX * | GetVertices (unsigned int aOffset) const |
Return vertices stored at the specific offset. | |
virtual unsigned int | GetSize () const |
Return amount of vertices currently stored in the container. | |
bool | IsDirty () const |
Return information about the container cache state. | |
void | SetDirty () |
Set the dirty flag, so vertices in the container are going to be reuploaded to the GPU on the next frame. | |
void | ClearDirty () |
Clear the dirty flag to prevent reuploading vertices to the GPU memory. | |
Static Public Member Functions | |
static VERTEX_CONTAINER * | MakeContainer (bool aCached) |
Return a pointer to a new container of an appropriate type. | |
Protected Member Functions | |
VERTEX_CONTAINER (unsigned int aSize=DEFAULT_SIZE) | |
unsigned int | usedSpace () const |
Return size of the used memory space. | |
Protected Attributes | |
unsigned int | m_freeSpace |
Current container size, expressed in vertices. | |
unsigned int | m_currentSize |
Store the initial size, so it can be resized to this on Clear() | |
unsigned int | m_initialSize |
Actual storage memory. | |
VERTEX * | m_vertices |
bool | m_failed |
bool | m_dirty |
Default initial size of a container (expressed in vertices) | |
Static Protected Attributes | |
static constexpr unsigned int | DEFAULT_SIZE = 1048576 |
Definition at line 42 of file vertex_container.h.
|
virtual |
Definition at line 71 of file vertex_container.cpp.
|
protected |
Definition at line 60 of file vertex_container.cpp.
|
pure virtual |
Return allocated space for the requested number of vertices associated with the current item (set with SetItem()).
The allocated space is added at the end of the chunk used by the current item and may serve to store new vertices.
aSize | is the number of vertices to be allocated. |
Implemented in KIGFX::CACHED_CONTAINER, and KIGFX::NONCACHED_CONTAINER.
|
pure virtual |
Remove all data stored in the container and restores its original state.
Implemented in KIGFX::CACHED_CONTAINER, and KIGFX::NONCACHED_CONTAINER.
Referenced by KIGFX::GPU_NONCACHED_MANAGER::EndDrawing().
|
inline |
Clear the dirty flag to prevent reuploading vertices to the GPU memory.
Definition at line 152 of file vertex_container.h.
References m_dirty.
Referenced by KIGFX::GPU_CACHED_MANAGER::EndDrawing().
|
pure virtual |
Erase the data related to an item.
aItem | is the item to be erased. |
Implemented in KIGFX::CACHED_CONTAINER, and KIGFX::NONCACHED_CONTAINER.
|
inlinevirtual |
Clean up after adding an item.
Reimplemented in KIGFX::CACHED_CONTAINER.
Definition at line 78 of file vertex_container.h.
|
inline |
Return pointer to the vertices stored in the container.
Definition at line 107 of file vertex_container.h.
References m_vertices.
Referenced by KIGFX::GPU_NONCACHED_MANAGER::EndDrawing().
|
inlinevirtual |
Return amount of vertices currently stored in the container.
Reimplemented in KIGFX::NONCACHED_CONTAINER.
Definition at line 125 of file vertex_container.h.
References m_currentSize.
Referenced by KIGFX::GPU_NONCACHED_MANAGER::EndDrawing().
|
inlinevirtual |
Return vertices stored at the specific offset.
aOffset | is the offset. |
Definition at line 117 of file vertex_container.h.
References m_vertices.
|
pure virtual |
Return true if the container caches vertex data in RAM or video memory.
Otherwise it is a single batch draw which is later discarded.
Implemented in KIGFX::CACHED_CONTAINER, and KIGFX::NONCACHED_CONTAINER.
Referenced by KIGFX::GPU_MANAGER::MakeManager().
|
inline |
Return information about the container cache state.
Definition at line 135 of file vertex_container.h.
References m_dirty.
|
static |
Return a pointer to a new container of an appropriate type.
Definition at line 42 of file vertex_container.cpp.
Referenced by KIGFX::VERTEX_MANAGER::VERTEX_MANAGER().
|
inlinevirtual |
Prepare the container for vertices updates.
Reimplemented in KIGFX::CACHED_CONTAINER_GPU, KIGFX::CACHED_CONTAINER_RAM, and KIGFX::CACHED_CONTAINER.
Definition at line 61 of file vertex_container.h.
|
inline |
Set the dirty flag, so vertices in the container are going to be reuploaded to the GPU on the next frame.
Definition at line 144 of file vertex_container.h.
References m_dirty.
|
pure virtual |
Set the item for the further actions.
aItem | is the item or NULL in case of finishing the item. |
Implemented in KIGFX::CACHED_CONTAINER, and KIGFX::NONCACHED_CONTAINER.
|
inlinevirtual |
Finish the vertices updates stage.
Reimplemented in KIGFX::CACHED_CONTAINER_GPU, KIGFX::CACHED_CONTAINER_RAM, and KIGFX::CACHED_CONTAINER.
Definition at line 66 of file vertex_container.h.
|
inlineprotected |
Return size of the used memory space.
Definition at line 165 of file vertex_container.h.
References m_currentSize, and m_freeSpace.
Referenced by KIGFX::CACHED_CONTAINER::defragment(), KIGFX::CACHED_CONTAINER_GPU::defragmentResize(), KIGFX::CACHED_CONTAINER_RAM::defragmentResize(), and KIGFX::CACHED_CONTAINER_GPU::defragmentResizeMemcpy().
|
staticconstexprprotected |
Definition at line 187 of file vertex_container.h.
|
protected |
Store the initial size, so it can be resized to this on Clear()
Definition at line 174 of file vertex_container.h.
Referenced by KIGFX::CACHED_CONTAINER::addFreeChunk(), KIGFX::NONCACHED_CONTAINER::Allocate(), KIGFX::CACHED_CONTAINER_GPU::CACHED_CONTAINER_GPU(), KIGFX::CACHED_CONTAINER::Clear(), KIGFX::NONCACHED_CONTAINER::Clear(), KIGFX::CACHED_CONTAINER_GPU::defragmentResize(), KIGFX::CACHED_CONTAINER_RAM::defragmentResize(), KIGFX::CACHED_CONTAINER_GPU::defragmentResizeMemcpy(), KIGFX::CACHED_CONTAINER::Delete(), GetSize(), KIGFX::CACHED_CONTAINER::reallocate(), KIGFX::CACHED_CONTAINER::test(), and usedSpace().
|
protected |
Default initial size of a container (expressed in vertices)
Definition at line 184 of file vertex_container.h.
Referenced by KIGFX::CACHED_CONTAINER::Allocate(), ClearDirty(), KIGFX::CACHED_CONTAINER_RAM::defragmentResize(), IsDirty(), SetDirty(), and KIGFX::CACHED_CONTAINER_RAM::Unmap().
|
protected |
Definition at line 183 of file vertex_container.h.
Referenced by KIGFX::CACHED_CONTAINER::Allocate(), and KIGFX::CACHED_CONTAINER::Clear().
|
protected |
Current container size, expressed in vertices.
Definition at line 171 of file vertex_container.h.
Referenced by KIGFX::CACHED_CONTAINER::addFreeChunk(), KIGFX::NONCACHED_CONTAINER::Allocate(), KIGFX::CACHED_CONTAINER::Clear(), KIGFX::NONCACHED_CONTAINER::Clear(), KIGFX::CACHED_CONTAINER_GPU::defragmentResize(), KIGFX::CACHED_CONTAINER_RAM::defragmentResize(), KIGFX::CACHED_CONTAINER_GPU::defragmentResizeMemcpy(), KIGFX::CACHED_CONTAINER::Delete(), KIGFX::CACHED_CONTAINER::reallocate(), KIGFX::CACHED_CONTAINER::test(), and usedSpace().
|
protected |
Actual storage memory.
Definition at line 177 of file vertex_container.h.
Referenced by KIGFX::CACHED_CONTAINER::Delete().
|
protected |
Definition at line 180 of file vertex_container.h.
Referenced by KIGFX::CACHED_CONTAINER::Allocate(), KIGFX::NONCACHED_CONTAINER::Allocate(), KIGFX::CACHED_CONTAINER_RAM::CACHED_CONTAINER_RAM(), KIGFX::CACHED_CONTAINER::defragment(), KIGFX::CACHED_CONTAINER_RAM::defragmentResize(), GetAllVertices(), GetVertices(), KIGFX::CACHED_CONTAINER_GPU::Map(), KIGFX::NONCACHED_CONTAINER::NONCACHED_CONTAINER(), KIGFX::CACHED_CONTAINER::reallocate(), KIGFX::CACHED_CONTAINER_GPU::Unmap(), KIGFX::CACHED_CONTAINER_RAM::Unmap(), KIGFX::CACHED_CONTAINER_RAM::~CACHED_CONTAINER_RAM(), and KIGFX::NONCACHED_CONTAINER::~NONCACHED_CONTAINER().