|
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 | Abandon () |
| Give up ownership of any GL objects without deleting them. | |
| 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 |
| Free space left in the container, expressed in vertices. | |
| unsigned int | m_currentSize |
| Current container size, expressed in vertices. | |
| unsigned int | m_initialSize |
| Store the initial size, so it can be resized to this on Clear() | |
| VERTEX * | m_vertices |
| Actual storage memory. | |
| bool | m_failed |
| bool | m_dirty |
Static Protected Attributes | |
| static constexpr unsigned int | DEFAULT_SIZE = 1048576 |
| Default initial size of a container (expressed in vertices) | |
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.
|
inlinevirtualinherited |
Give up ownership of any GL objects without deleting them.
Used when the owning context can no longer be made current, so a delete would be executed against whichever context is, possibly one from another share group. The names are released when the owning context is destroyed.
Reimplemented in KIGFX::CACHED_CONTAINER_GPU.
Definition at line 61 of file vertex_container.h.
|
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 157 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 83 of file vertex_container.h.
|
inlineinherited |
Return pointer to the vertices stored in the container.
Definition at line 112 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 122 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 140 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 66 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 149 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 71 of file vertex_container.h.
|
inlineprotectedinherited |
Return size of the used memory space.
Definition at line 170 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 |
Default initial size of a container (expressed in vertices)
Definition at line 192 of file vertex_container.h.
|
protectedinherited |
Current container size, expressed in vertices.
Definition at line 179 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 |
Definition at line 189 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 188 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 |
Free space left in the container, expressed in vertices.
Definition at line 176 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 |
Store the initial size, so it can be resized to this on Clear()
Definition at line 182 of file vertex_container.h.
Referenced by KIGFX::CACHED_CONTAINER::Delete(), and VERTEX_CONTAINER().
|
protectedinherited |
Actual storage memory.
Definition at line 185 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().