|
KiCad PCB EDA Suite
|
#include <noncached_container.h>
Public Member Functions | |
| NONCACHED_CONTAINER (unsigned int aSize=DEFAULT_SIZE) | |
| Construct a non-cached container object. | |
| virtual | ~NONCACHED_CONTAINER () |
| bool | IsCached () const override |
| Return true if the container caches vertex data in RAM or video memory. | |
| virtual void | SetItem (VERTEX_ITEM *aItem) override |
| Set the item for the further actions. | |
| virtual VERTEX * | Allocate (unsigned int aSize) override |
| Return allocated space for the requested number of vertices associated with the current item (set with SetItem()). | |
| void | Delete (VERTEX_ITEM *aItem) override |
| Erase the data related to an item. | |
| virtual void | Clear () override |
| Remove all data stored in the container and restores its original state. | |
| virtual unsigned int | GetSize () const override |
| Return amount of vertices currently stored in the container. | |
| virtual void | Map () |
| Prepare the container for vertices updates. | |
| virtual void | Unmap () |
| Finish the vertices updates stage. | |
| virtual void | FinishItem () |
| Clean up after adding an item. | |
| 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. | |
| 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 | |
| unsigned int | usedSpace () const |
| Return size of the used memory space. | |
Protected Attributes | |
| unsigned int | m_freePtr |
| < Index of the free first space where a vertex can be stored | |
| 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 38 of file noncached_container.h.
| NONCACHED_CONTAINER::NONCACHED_CONTAINER | ( | unsigned int | aSize = DEFAULT_SIZE | ) |
Construct a non-cached container object.
| aSize | is the size of the cache. |
| bad_alloc | exception if memory allocation fails. |
Definition at line 35 of file noncached_container.cpp.
References m_freePtr, KIGFX::VERTEX_CONTAINER::m_vertices, and KIGFX::VERTEX_CONTAINER::VERTEX_CONTAINER().
|
virtual |
Definition at line 51 of file noncached_container.cpp.
References KIGFX::VERTEX_CONTAINER::m_vertices.
|
overridevirtual |
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. |
Implements KIGFX::VERTEX_CONTAINER.
Definition at line 64 of file noncached_container.cpp.
References KIGFX::VERTEX_CONTAINER::m_currentSize, m_freePtr, KIGFX::VERTEX_CONTAINER::m_freeSpace, and KIGFX::VERTEX_CONTAINER::m_vertices.
|
overridevirtual |
Remove all data stored in the container and restores its original state.
Implements KIGFX::VERTEX_CONTAINER.
Definition at line 94 of file noncached_container.cpp.
References KIGFX::VERTEX_CONTAINER::m_currentSize, m_freePtr, and KIGFX::VERTEX_CONTAINER::m_freeSpace.
|
inlineinherited |
Clear the dirty flag to prevent reuploading vertices to the GPU memory.
Definition at line 148 of file vertex_container.h.
References m_dirty.
Referenced by KIGFX::GPU_CACHED_MANAGER::EndDrawing().
|
inlineoverridevirtual |
Erase the data related to an item.
| aItem | is the item to be erased. |
Implements KIGFX::VERTEX_CONTAINER.
Definition at line 62 of file noncached_container.h.
|
inlinevirtualinherited |
Clean up after adding an item.
Reimplemented in KIGFX::CACHED_CONTAINER.
Definition at line 74 of file vertex_container.h.
|
inlineinherited |
Return pointer to the vertices stored in the container.
Definition at line 103 of file vertex_container.h.
References m_vertices.
|
inlineoverridevirtual |
Return amount of vertices currently stored in the container.
Reimplemented from KIGFX::VERTEX_CONTAINER.
Definition at line 68 of file noncached_container.h.
References m_freePtr.
|
inlinevirtualinherited |
Return vertices stored at the specific offset.
| aOffset | is the offset. |
Definition at line 113 of file vertex_container.h.
References m_vertices.
|
inlineoverridevirtual |
Return true if the container caches vertex data in RAM or video memory.
Otherwise it is a single batch draw which is later discarded.
Implements KIGFX::VERTEX_CONTAINER.
Definition at line 50 of file noncached_container.h.
|
inlineinherited |
Return information about the container cache state.
Definition at line 131 of file vertex_container.h.
References m_dirty.
|
staticinherited |
Return a pointer to a new container of an appropriate type.
Definition at line 38 of file vertex_container.cpp.
References VERTEX_CONTAINER().
Referenced by KIGFX::VERTEX_MANAGER::VERTEX_MANAGER().
|
inlinevirtualinherited |
Prepare the container for vertices updates.
Reimplemented in KIGFX::CACHED_CONTAINER, KIGFX::CACHED_CONTAINER_GPU, and KIGFX::CACHED_CONTAINER_RAM.
Definition at line 57 of file vertex_container.h.
|
inlineinherited |
Set the dirty flag, so vertices in the container are going to be reuploaded to the GPU on the next frame.
Definition at line 140 of file vertex_container.h.
References m_dirty.
|
overridevirtual |
Set the item for the further actions.
| aItem | is the item or NULL in case of finishing the item. |
Implements KIGFX::VERTEX_CONTAINER.
Definition at line 57 of file noncached_container.cpp.
|
inlinevirtualinherited |
Finish the vertices updates stage.
Reimplemented in KIGFX::CACHED_CONTAINER, KIGFX::CACHED_CONTAINER_GPU, and KIGFX::CACHED_CONTAINER_RAM.
Definition at line 62 of file vertex_container.h.
|
inlineprotectedinherited |
Return size of the used memory space.
Definition at line 161 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(), KIGFX::CACHED_CONTAINER_GPU::defragmentResizeMemcpy(), and KIGFX::CACHED_CONTAINER_GPU::defragmentResizeStaged().
|
staticconstexprprotectedinherited |
Definition at line 183 of file vertex_container.h.
|
protectedinherited |
Store the initial size, so it can be resized to this on Clear()
Definition at line 170 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_GPU::defragmentResizeStaged(), KIGFX::CACHED_CONTAINER::Delete(), GetSize(), KIGFX::CACHED_CONTAINER::reallocate(), KIGFX::CACHED_CONTAINER::test(), usedSpace(), and VERTEX_CONTAINER().
|
protectedinherited |
Default initial size of a container (expressed in vertices)
Definition at line 180 of file vertex_container.h.
Referenced by KIGFX::CACHED_CONTAINER::Allocate(), ClearDirty(), KIGFX::CACHED_CONTAINER_RAM::defragmentResize(), IsDirty(), SetDirty(), KIGFX::CACHED_CONTAINER_RAM::Unmap(), and VERTEX_CONTAINER().
|
protectedinherited |
Definition at line 179 of file vertex_container.h.
Referenced by KIGFX::CACHED_CONTAINER::Allocate(), KIGFX::CACHED_CONTAINER::Clear(), and VERTEX_CONTAINER().
|
protected |
< Index of the free first space where a vertex can be stored
Definition at line 77 of file noncached_container.h.
Referenced by Allocate(), Clear(), GetSize(), and NONCACHED_CONTAINER().
|
protectedinherited |
Current container size, expressed in vertices.
Definition at line 167 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_GPU::defragmentResizeStaged(), KIGFX::CACHED_CONTAINER::Delete(), KIGFX::CACHED_CONTAINER::reallocate(), KIGFX::CACHED_CONTAINER::test(), usedSpace(), and VERTEX_CONTAINER().
|
protectedinherited |
Actual storage memory.
Definition at line 173 of file vertex_container.h.
Referenced by KIGFX::CACHED_CONTAINER::Delete(), and VERTEX_CONTAINER().
|
protectedinherited |
Definition at line 176 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(), KIGFX::CACHED_CONTAINER_GPU::defragmentResizeStaged(), 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(), VERTEX_CONTAINER(), KIGFX::CACHED_CONTAINER_RAM::~CACHED_CONTAINER_RAM(), and KIGFX::NONCACHED_CONTAINER::~NONCACHED_CONTAINER().