36 return cdata->_usage_hint;
48 return _array_format->has_column(name);
61 return get_handle()->get_num_rows();
88 return modify_handle()->set_num_rows(n);
106 return modify_handle()->unclean_set_num_rows(n);
121 return modify_handle()->reserve_num_rows(n);
132 return modify_handle()->clear_rows();
143 return cdata->_buffer.get_size();
156 return cdata->_modified;
171 return handle->request_resident();
184 get_handle(
Thread *current_thread)
const {
200 modify_handle(
Thread *current_thread) {
215 return &_independent_lru;
246 INLINE
void GeomVertexArrayData::
247 set_lru_size(
size_t lru_size) {
250 if ((
int)lru_size <= vertex_data_small_size) {
262 INLINE GeomVertexArrayData::CData::
264 _usage_hint(UH_unspecified),
265 _rw_lock(
"GeomVertexArrayData::CData::_rw_lock")
274 INLINE GeomVertexArrayData::CData::
275 CData(
const GeomVertexArrayData::CData ©) :
276 _usage_hint(copy._usage_hint),
277 _buffer(copy._buffer),
278 _modified(copy._modified),
279 _rw_lock(
"GeomVertexArrayData::CData::_rw_lock")
288 INLINE
void GeomVertexArrayData::CData::
289 operator = (
const GeomVertexArrayData::CData ©) {
290 _usage_hint = copy._usage_hint;
291 _buffer = copy._buffer;
292 _modified = copy._modified;
300 INLINE GeomVertexArrayDataHandle::
303 const GeomVertexArrayData::CData *cdata,
306 _current_thread(current_thread),
307 _cdata((GeomVertexArrayData::CData *)cdata),
311 nassertv(_object->test_ref_count_nonzero());
315 #endif // DO_PIPELINING 318 _cdata->_rw_lock.acquire();
319 #ifdef DO_MEMORY_USAGE 320 MemoryUsage::update_type(
this, get_class_type());
329 INLINE GeomVertexArrayDataHandle::
339 INLINE
void GeomVertexArrayDataHandle::
349 INLINE GeomVertexArrayDataHandle::
350 ~GeomVertexArrayDataHandle() {
352 nassertv(_object->test_ref_count_nonzero());
356 _object->_cycler.release_write(_cdata);
361 _cdata->_rw_lock.release();
365 #endif // DO_PIPELINING 378 INLINE
Thread *GeomVertexArrayDataHandle::
379 get_current_thread()
const {
380 return _current_thread;
398 return _cdata->_buffer.get_read_pointer(force);
426 INLINE
const GeomVertexArrayFormat *GeomVertexArrayDataHandle::
427 get_array_format()
const {
428 return _object->_array_format;
436 INLINE GeomVertexArrayDataHandle::UsageHint GeomVertexArrayDataHandle::
437 get_usage_hint()
const {
438 return _cdata->_usage_hint;
446 INLINE
int GeomVertexArrayDataHandle::
447 get_num_rows()
const {
448 nassertr(_object->_array_format->get_stride() != 0, 0);
457 INLINE
void GeomVertexArrayDataHandle::
467 INLINE
int GeomVertexArrayDataHandle::
468 get_data_size_bytes()
const {
469 return _cdata->_buffer.get_size();
477 INLINE
UpdateSeq GeomVertexArrayDataHandle::
478 get_modified()
const {
479 return _cdata->_modified;
493 return (get_read_pointer(
false) != (
const unsigned char *)NULL);
515 return _object->prepare_now(prepared_objects, gsg);
529 return string((
const char *)_cdata->_buffer.get_read_pointer(
true), _cdata->_buffer.get_size());
543 start = min(start, _cdata->_buffer.get_size());
544 size = min(size, _cdata->_buffer.get_size() - start);
545 return string((
const char *)_cdata->_buffer.get_read_pointer(
true) + start, size);
555 _object->set_lru_size(_object->get_lru_size());
An implementation of a very simple LRU algorithm.
static SimpleLru * get_small_lru()
Returns a pointer to the global LRU object that manages the GeomVertexArrayData's that are deemed too...
bool has_column(const InternalName *name) const
Returns true if the array has the named column, false otherwise.
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 alread...
A single page of data maintained by a PipelineCycler.
static VertexDataBook & get_book()
Returns the global VertexDataBook that will be used to allocate vertex data buffers.
This data object is returned by GeomVertexArrayData::get_handle() or modify_handle().
A table of objects that are saved within the graphics context for reference by handle later...
bool request_resident() const
Returns true if the vertex data is currently resident in memory.
void set_lru_size(size_t lru_size)
Specifies the size of this page, presumably in bytes, although any unit is possible.
This template class calls PipelineCycler::read_unlocked(), and then provides a transparent read-only ...
UpdateSeq get_modified() const
Returns a sequence number which is guaranteed to change at least every time the array vertex data is ...
bool reserve_num_rows(int n)
This ensures that enough memory space for n rows is allocated, so that you may increase the number of...
bool request_resident() const
Returns true if the vertex data is currently resident in memory.
VertexBufferContext * prepare_now(PreparedGraphicsObjects *prepared_objects, GraphicsStateGuardianBase *gsg) const
Creates a context for the data on the particular GSG, if it does not already exist.
const GeomVertexArrayFormat * get_array_format() const
Returns the format object that describes this array.
A collection of VertexDataPages, which can be used to allocate new VertexDataBlock objects...
const unsigned char * get_read_pointer(bool force) const
Returns a readable pointer to the beginning of the actual data stream, or NULL if the data is not cur...
static SimpleLru * get_independent_lru()
Returns a pointer to the global LRU object that manages the GeomVertexArrayData's that have not (yet)...
This is a base class for the GraphicsStateGuardian class, which is itself a base class for the variou...
int get_num_rows() const
Returns the number of rows stored in the array, based on the number of bytes and the stride...
const CycleDataType * read_unlocked(Thread *current_thread) const
See PipelineCyclerBase::read_unlocked().
void mark_used() const
Marks the array data recently-used.
A thread; that is, a lightweight process.
UsageHint get_usage_hint() const
Returns the usage hint that describes to the rendering backend how often the vertex data will be modi...
This is a special class object that holds all the information returned by a particular GSG to indicat...
CycleDataType * write_upstream(bool force_to_0, Thread *current_thread)
See PipelineCyclerBase::write_upstream().
string get_subdata(size_t start, size_t size) const
Returns a subset of the raw data of the GeomVertexArrayData object, formatted as a string...
bool unclean_set_num_rows(int n)
This method behaves like set_num_rows(), except the new data is not initialized.
void clear_rows()
Removes all of the rows in the array.
This is a sequence number that increments monotonically.
bool set_num_rows(int n)
Sets the length of the array to n rows.
int get_data_size_bytes() const
Returns the number of bytes stored in the array.
This is the data for one array of a GeomVertexData structure.
string get_data() const
Returns the entire raw data of the GeomVertexArrayData object, formatted as a string.