38#ifdef KICAD_GAL_PROFILE
55CACHED_CONTAINER_RAM::CACHED_CONTAINER_RAM(
unsigned int aSize ) :
60 checkGlError(
"generating vertices buffer", __FILE__, __LINE__ );
65 throw std::bad_alloc();
85 checkGlError(
"binding vertices buffer", __FILE__, __LINE__ );
87 checkGlError(
"transferring vertices", __FILE__, __LINE__ );
88 glBindBuffer( GL_ARRAY_BUFFER, 0 );
89 checkGlError(
"unbinding vertices buffer", __FILE__, __LINE__ );
96 wxT(
"Resizing & defragmenting container (memcpy) from %d to %d" ),
m_currentSize,
103#ifdef KICAD_GAL_PROFILE
110 throw std::bad_alloc();
118#ifdef KICAD_GAL_PROFILE
~CACHED_CONTAINER_RAM()
Finish the vertices updates stage.
void Unmap() override
Finish the vertices updates stage.
bool defragmentResize(unsigned int aNewSize) override
Defragment the currently stored data and resizes the buffer.
Class to store VERTEX instances with caching.
FREE_CHUNK_MAP m_freeChunks
Stored VERTEX_ITEMs.
void defragment(VERTEX *aTarget)
Transfer all stored data to a new buffer, removing empty spaces between the data chunks in the contai...
unsigned int m_currentSize
Store the initial size, so it can be resized to this on Clear()
unsigned int m_freeSpace
Current container size, expressed in vertices.
unsigned int usedSpace() const
Return size of the used memory space.
bool m_dirty
Default initial size of a container (expressed in vertices)
A small class to help profiling.
void Stop()
Save the time when this function was called, and set the counter stane to stop.
double msecs(bool aSinceLast=false)
This file is part of the common library.
static const wxChar *const traceGalCachedContainer
Flag to enable debug output of the GAL OpenGL cached container.
The Cairo implementation of the graphics abstraction layer.
static constexpr size_t VERTEX_SIZE
int checkGlError(const std::string &aInfo, const char *aFile, int aLine, bool aThrow)
Check if a recent OpenGL operation has failed.
Class to handle an item held in a container.