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 41 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 39 of file noncached_container.cpp.
References KIGFX::VERTEX_CONTAINER::m_vertices.
|
virtual |
Definition at line 55 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 68 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 98 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 152 of file vertex_container.h.
References KIGFX::VERTEX_CONTAINER::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 65 of file noncached_container.h.
|
inlinevirtualinherited |
Clean up after adding an item.
Reimplemented in KIGFX::CACHED_CONTAINER.
Definition at line 78 of file vertex_container.h.
|
inlineinherited |
Return pointer to the vertices stored in the container.
Definition at line 107 of file vertex_container.h.
References KIGFX::VERTEX_CONTAINER::m_vertices.
Referenced by KIGFX::GPU_NONCACHED_MANAGER::EndDrawing().
|
inlineoverridevirtual |
Return amount of vertices currently stored in the container.
Reimplemented from KIGFX::VERTEX_CONTAINER.
Definition at line 71 of file noncached_container.h.
References m_freePtr.
|
inlinevirtualinherited |
Return vertices stored at the specific offset.
aOffset | is the offset. |
Definition at line 117 of file vertex_container.h.
References KIGFX::VERTEX_CONTAINER::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 53 of file noncached_container.h.
|
inlineinherited |
Return information about the container cache state.
Definition at line 135 of file vertex_container.h.
References KIGFX::VERTEX_CONTAINER::m_dirty.
|
staticinherited |
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().
|
inlinevirtualinherited |
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.
|
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 144 of file vertex_container.h.
References KIGFX::VERTEX_CONTAINER::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 61 of file noncached_container.cpp.
|
inlinevirtualinherited |
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.
|
inlineprotectedinherited |
Return size of the used memory space.
Definition at line 165 of file vertex_container.h.
References KIGFX::VERTEX_CONTAINER::m_currentSize, and KIGFX::VERTEX_CONTAINER::m_freeSpace.
Referenced by KIGFX::CACHED_CONTAINER::defragment(), KIGFX::CACHED_CONTAINER_GPU::defragmentResize(), KIGFX::CACHED_CONTAINER_RAM::defragmentResize(), and KIGFX::CACHED_CONTAINER_GPU::defragmentResizeMemcpy().
|
staticconstexprprotectedinherited |
Definition at line 187 of file vertex_container.h.
|
protectedinherited |
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(), Allocate(), KIGFX::CACHED_CONTAINER_GPU::CACHED_CONTAINER_GPU(), KIGFX::CACHED_CONTAINER::Clear(), Clear(), KIGFX::CACHED_CONTAINER_GPU::defragmentResize(), KIGFX::CACHED_CONTAINER_RAM::defragmentResize(), KIGFX::CACHED_CONTAINER_GPU::defragmentResizeMemcpy(), KIGFX::CACHED_CONTAINER::Delete(), KIGFX::VERTEX_CONTAINER::GetSize(), KIGFX::CACHED_CONTAINER::reallocate(), KIGFX::CACHED_CONTAINER::test(), and KIGFX::VERTEX_CONTAINER::usedSpace().
|
protectedinherited |
Default initial size of a container (expressed in vertices)
Definition at line 184 of file vertex_container.h.
Referenced by KIGFX::CACHED_CONTAINER::Allocate(), KIGFX::VERTEX_CONTAINER::ClearDirty(), KIGFX::CACHED_CONTAINER_RAM::defragmentResize(), KIGFX::VERTEX_CONTAINER::IsDirty(), KIGFX::VERTEX_CONTAINER::SetDirty(), and KIGFX::CACHED_CONTAINER_RAM::Unmap().
|
protectedinherited |
Definition at line 183 of file vertex_container.h.
Referenced by KIGFX::CACHED_CONTAINER::Allocate(), and KIGFX::CACHED_CONTAINER::Clear().
|
protected |
< Index of the free first space where a vertex can be stored
Definition at line 80 of file noncached_container.h.
Referenced by Allocate(), Clear(), and GetSize().
|
protectedinherited |
Current container size, expressed in vertices.
Definition at line 171 of file vertex_container.h.
Referenced by KIGFX::CACHED_CONTAINER::addFreeChunk(), Allocate(), KIGFX::CACHED_CONTAINER::Clear(), 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 KIGFX::VERTEX_CONTAINER::usedSpace().
|
protectedinherited |
Actual storage memory.
Definition at line 177 of file vertex_container.h.
Referenced by KIGFX::CACHED_CONTAINER::Delete().
|
protectedinherited |
Definition at line 180 of file vertex_container.h.
Referenced by KIGFX::CACHED_CONTAINER::Allocate(), Allocate(), KIGFX::CACHED_CONTAINER_RAM::CACHED_CONTAINER_RAM(), KIGFX::CACHED_CONTAINER::defragment(), KIGFX::CACHED_CONTAINER_RAM::defragmentResize(), KIGFX::VERTEX_CONTAINER::GetAllVertices(), KIGFX::VERTEX_CONTAINER::GetVertices(), KIGFX::CACHED_CONTAINER_GPU::Map(), NONCACHED_CONTAINER(), KIGFX::CACHED_CONTAINER::reallocate(), KIGFX::CACHED_CONTAINER_GPU::Unmap(), KIGFX::CACHED_CONTAINER_RAM::Unmap(), KIGFX::CACHED_CONTAINER_RAM::~CACHED_CONTAINER_RAM(), and ~NONCACHED_CONTAINER().