28 CDReader cdata(_cycler);
29 return cdata->_usage_hint;
38 return _array_format->has_column(name);
49 nassertr(_array_format->get_stride() != 0, 0);
50 return cdata->_buffer.get_size() / _array_format->get_stride();
71 return modify_handle()->set_num_rows(n);
85 return modify_handle()->unclean_set_num_rows(n);
97 return modify_handle()->reserve_num_rows(n);
106 return modify_handle()->clear_rows();
114 CDReader cdata(_cycler);
115 return cdata->_buffer.get_size();
124 CDReader cdata(_cycler);
125 return cdata->_modified;
136 const GeomVertexArrayData::CData *cdata = _cycler.
read_unlocked(current_thread);
142 cdata->_rw_lock.acquire();
145 bool is_resident = (cdata->_buffer.get_read_pointer(
false) !=
nullptr);
147 cdata->_rw_lock.release();
163 get_handle(
Thread *current_thread)
const {
174 modify_handle(
Thread *current_thread) {
184 return &_independent_lru;
208 INLINE
void GeomVertexArrayData::
209 set_lru_size(
size_t lru_size) {
212 if ((
int)lru_size <= vertex_data_small_size) {
221 INLINE
void GeomVertexArrayData::
233 INLINE GeomVertexArrayData::CData::
234 CData(UsageHint usage_hint) :
235 _usage_hint(usage_hint),
236 _rw_lock(
"GeomVertexArrayData::CData::_rw_lock")
243 INLINE GeomVertexArrayData::CData::
244 CData(GeomVertexArrayData::CData &&from) noexcept :
245 _usage_hint(std::move(from._usage_hint)),
246 _buffer(std::move(from._buffer)),
247 _modified(std::move(from._modified)),
248 _rw_lock(
"GeomVertexArrayData::CData::_rw_lock")
255 INLINE GeomVertexArrayData::CData::
256 CData(
const GeomVertexArrayData::CData ©) :
257 _usage_hint(copy._usage_hint),
258 _buffer(copy._buffer),
259 _modified(copy._modified),
260 _rw_lock(
"GeomVertexArrayData::CData::_rw_lock")
267 INLINE
void GeomVertexArrayData::CData::
268 operator = (
const GeomVertexArrayData::CData ©) {
269 _usage_hint = copy._usage_hint;
270 _buffer = copy._buffer;
271 _modified = copy._modified;
277 INLINE GeomVertexArrayDataHandle::
280 _current_thread(current_thread),
284 _object.swap(
object);
287 nassertv(_object->test_ref_count_nonzero());
291 #endif // DO_PIPELINING
294 _cdata->_rw_lock.acquire();
295 #ifdef DO_MEMORY_USAGE
303 INLINE GeomVertexArrayDataHandle::
307 _current_thread(current_thread),
312 nassertv(_object->test_ref_count_nonzero());
316 #endif // DO_PIPELINING
319 _cdata->_rw_lock.acquire();
320 #ifdef DO_MEMORY_USAGE
328 INLINE GeomVertexArrayDataHandle::
331 _current_thread(current_thread),
332 _cdata(object->_cycler.write_upstream(true, current_thread)),
335 _object.swap(
object);
338 nassertv(_object->test_ref_count_nonzero());
342 #endif // DO_PIPELINING
345 _cdata->_rw_lock.acquire();
346 #ifdef DO_MEMORY_USAGE
354 INLINE GeomVertexArrayDataHandle::
358 _current_thread(current_thread),
359 _cdata(object->_cycler.write_upstream(true, current_thread)),
363 nassertv(_object->test_ref_count_nonzero());
367 #endif // DO_PIPELINING
370 _cdata->_rw_lock.acquire();
371 #ifdef DO_MEMORY_USAGE
379 INLINE GeomVertexArrayDataHandle::
380 ~GeomVertexArrayDataHandle() {
382 nassertv(_object->test_ref_count_nonzero());
386 _object->_cycler.release_write(_cdata);
391 _cdata->_rw_lock.release();
395 #endif // DO_PIPELINING
406 INLINE
Thread *GeomVertexArrayDataHandle::
407 get_current_thread()
const {
408 return _current_thread;
422 return _cdata->_buffer.get_read_pointer(force);
445 get_array_format()
const {
446 return _object->_array_format;
452 INLINE GeomVertexArrayDataHandle::UsageHint GeomVertexArrayDataHandle::
453 get_usage_hint()
const {
454 return _cdata->_usage_hint;
460 INLINE
int GeomVertexArrayDataHandle::
461 get_num_rows()
const {
462 nassertr(_object->_array_format->get_stride() != 0, 0);
469 INLINE
void GeomVertexArrayDataHandle::
477 INLINE
size_t GeomVertexArrayDataHandle::
478 get_data_size_bytes()
const {
479 return _cdata->_buffer.get_size();
485 INLINE
UpdateSeq GeomVertexArrayDataHandle::
486 get_modified()
const {
487 return _cdata->_modified;
515 return _object->prepare_now(prepared_objects, gsg);
526 const unsigned char *ptr = _cdata->_buffer.get_read_pointer(
true);
527 return vector_uchar(ptr, ptr + _cdata->_buffer.get_size());
538 start = std::min(start, _cdata->_buffer.get_size());
539 size = std::min(size, _cdata->_buffer.get_size() - start);
540 const unsigned char *ptr = _cdata->_buffer.get_read_pointer(
true) + start;
541 return vector_uchar(ptr, ptr + size);
549 _object->mark_used();
552 INLINE std::ostream &