Panda3D
|
A block of bytes that holds one or more VertexDataBlocks. More...
#include "vertexDataPage.h"
Public Types | |
enum | RamClass { RC_resident , RC_compressed , RC_disk , RC_end_of_list } |
Public Member Functions | |
VertexDataBlock * | alloc (size_t size) |
Allocates a new block. | |
VertexDataBook * | get_book () const |
Returns a pointer to the book that owns this page. | |
VertexDataBlock * | get_first_block () const |
Returns a pointer to the first allocated block, or NULL if there are no allocated blocks. | |
unsigned char * | get_page_data (bool force) |
Returns a pointer to the page's data area, or NULL if the page is not currently resident. | |
RamClass | get_pending_ram_class () const |
Returns the pending ram class of the array. | |
RamClass | get_ram_class () const |
Returns the current ram class of the array. | |
bool | operator< (const VertexDataPage &other) const |
This comparison method is used to order pages within a book. | |
virtual void | output (std::ostream &out) const |
void | request_resident () |
Ensures that the page will become resident soon. | |
bool | save_to_disk () |
Writes the page to disk, but does not evict it from memory or affect its LRU status. | |
virtual void | write (std::ostream &out, int indent_level) const |
![]() | |
SimpleAllocator (SimpleAllocator &&from) noexcept | |
Move constructor. | |
SimpleAllocator (size_t max_size, Mutex &lock) | |
SimpleAllocatorBlock * | alloc (size_t size, size_t alignment=1) |
Allocates a new block. | |
size_t | get_contiguous () const |
Returns an upper-bound estimate of the size of the largest contiguous block that may be allocated. | |
SimpleAllocatorBlock * | get_first_block () const |
Returns a pointer to the first allocated block, or NULL if there are no allocated blocks. | |
size_t | get_max_size () const |
Returns the available space for allocated objects. | |
size_t | get_total_size () const |
Returns the total size of allocated objects. | |
bool | is_empty () const |
Returns true if there are no blocks allocated on this page, or false if there is at least one. | |
void | output (std::ostream &out) const |
void | set_max_size (size_t max_size) |
Changes the available space for allocated objects. | |
void | write (std::ostream &out) const |
![]() | |
SimpleLruPage (const SimpleLruPage ©) | |
SimpleLruPage (size_t lru_size) | |
void | dequeue_lru () |
Removes the page from its SimpleLru. | |
void | enqueue_lru (SimpleLru *lru) |
Adds the page to the LRU for the first time, or marks it recently-accessed if it has already been added. | |
SimpleLru * | get_lru () const |
Returns the LRU that manages this page, or NULL if it is not currently managed by any LRU. | |
size_t | get_lru_size () const |
Returns the size of this page as reported to the LRU, presumably in bytes. | |
void | mark_used_lru () const |
To be called when the page is used; this will move it to the tail of the SimpleLru queue it is already on. | |
void | mark_used_lru (SimpleLru *lru) |
To be called when the page is used; this will move it to the tail of the specified SimpleLru queue. | |
void | operator= (const SimpleLruPage ©) |
void | set_lru_size (size_t lru_size) |
Specifies the size of this page, presumably in bytes, although any unit is possible. | |
Static Public Member Functions | |
static void | flush_threads () |
Waits for all of the pending thread tasks to finish before returning. | |
static TypeHandle | get_class_type () |
static SimpleLru * | get_global_lru (RamClass rclass) |
Returns a pointer to the global LRU object that manages the VertexDataPage's with the indicated RamClass. | |
static int | get_num_pending_reads () |
Returns the number of read requests that are waiting to be serviced by a thread. | |
static int | get_num_pending_writes () |
Returns the number of write requests that are waiting to be serviced by a thread. | |
static int | get_num_threads () |
Returns the number of threads that have been spawned to service vertex paging requests, or 0 if no threads have been spawned (which may mean either that all paging requests will be handled by the main thread, or simply that no paging requests have yet been issued). | |
static SimpleLru * | get_pending_lru () |
Returns a pointer to the global LRU object that manages the VertexDataPage's that are pending processing by the thread. | |
static VertexDataSaveFile * | get_save_file () |
static void | init_type () |
static void | stop_threads () |
Call this to stop the paging threads, if they were started. | |
Public Attributes | |
get_save_file | |
Returns the global VertexDataSaveFile that will be used to save vertex data buffers to disk when necessary. | |
Friends | |
class | PageThread |
class | VertexDataBook |
A block of bytes that holds one or more VertexDataBlocks.
The entire page may be paged out, in the form of in-memory compression or to an on-disk cache file, if necessary.
Definition at line 37 of file vertexDataPage.h.
enum VertexDataPage::RamClass |
Definition at line 47 of file vertexDataPage.h.
|
inline |
Allocates a new block.
Returns NULL if a block of the requested size cannot be allocated.
To free the allocated block, call block->free(), or simply delete the block pointer.
Definition at line 54 of file vertexDataPage.I.
|
static |
Waits for all of the pending thread tasks to finish before returning.
Definition at line 189 of file vertexDataPage.cxx.
References stop_threads().
|
inline |
Returns a pointer to the book that owns this page.
Definition at line 73 of file vertexDataPage.I.
|
inlinestatic |
Definition at line 217 of file vertexDataPage.h.
|
inline |
Returns a pointer to the first allocated block, or NULL if there are no allocated blocks.
Definition at line 64 of file vertexDataPage.I.
References SimpleAllocator::get_first_block().
|
inlinestatic |
Returns a pointer to the global LRU object that manages the VertexDataPage's with the indicated RamClass.
Definition at line 82 of file vertexDataPage.I.
Referenced by GeomVertexArrayData::lru_epoch(), and GraphicsEngine::render_frame().
|
inlinestatic |
Returns the number of read requests that are waiting to be serviced by a thread.
Definition at line 139 of file vertexDataPage.I.
|
inlinestatic |
Returns the number of write requests that are waiting to be serviced by a thread.
Definition at line 152 of file vertexDataPage.I.
|
inlinestatic |
Returns the number of threads that have been spawned to service vertex paging requests, or 0 if no threads have been spawned (which may mean either that all paging requests will be handled by the main thread, or simply that no paging requests have yet been issued).
Definition at line 126 of file vertexDataPage.I.
|
inline |
Returns a pointer to the page's data area, or NULL if the page is not currently resident.
If the page is not currently resident, this will implicitly request it to become resident soon.
If force is true, this method will never return NULL, but may block until the page is available.
Definition at line 169 of file vertexDataPage.I.
References SimpleLruPage::mark_used_lru().
Referenced by VertexDataBlock::get_pointer().
|
inlinestatic |
Returns a pointer to the global LRU object that manages the VertexDataPage's that are pending processing by the thread.
Definition at line 92 of file vertexDataPage.I.
Referenced by GraphicsEngine::render_frame().
|
inline |
Returns the pending ram class of the array.
If this is different from get_ram_class(), this page has been queued to be processed by the thread. Eventually the page will be set to this ram class.
Definition at line 29 of file vertexDataPage.I.
|
inline |
Returns the current ram class of the array.
If this is other than RC_resident, the array data is not resident in memory.
Definition at line 18 of file vertexDataPage.I.
|
inlinestatic |
Definition at line 220 of file vertexDataPage.h.
|
inline |
This comparison method is used to order pages within a book.
Definition at line 191 of file vertexDataPage.I.
|
virtual |
Reimplemented from SimpleLruPage.
Definition at line 213 of file vertexDataPage.cxx.
|
inline |
Ensures that the page will become resident soon.
Future calls to get_page_data() will eventually return non-NULL.
Definition at line 39 of file vertexDataPage.I.
|
inline |
Writes the page to disk, but does not evict it from memory or affect its LRU status.
If it gets evicted later without having been modified, it will not need to write itself to disk again.
Definition at line 114 of file vertexDataPage.I.
|
static |
Call this to stop the paging threads, if they were started.
This may block until all of the pending tasks have been completed.
Definition at line 170 of file vertexDataPage.cxx.
Referenced by flush_threads(), and GraphicsEngine::remove_all_windows().
|
virtual |
Reimplemented from SimpleLruPage.
Definition at line 221 of file vertexDataPage.cxx.
|
friend |
Definition at line 227 of file vertexDataPage.h.
|
friend |
Definition at line 228 of file vertexDataPage.h.
|
inline |
Returns the global VertexDataSaveFile that will be used to save vertex data buffers to disk when necessary.
Definition at line 67 of file vertexDataPage.h.
Referenced by GraphicsEngine::render_frame().