|
@@ -17,6 +17,7 @@
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#include "qpgeomVertexData.h"
|
|
#include "qpgeomVertexData.h"
|
|
|
|
|
+#include "qpgeomVertexCacheManager.h"
|
|
|
#include "bamReader.h"
|
|
#include "bamReader.h"
|
|
|
#include "bamWriter.h"
|
|
#include "bamWriter.h"
|
|
|
#include "pset.h"
|
|
#include "pset.h"
|
|
@@ -82,6 +83,25 @@ operator = (const qpGeomVertexData ©) {
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
qpGeomVertexData::
|
|
qpGeomVertexData::
|
|
|
~qpGeomVertexData() {
|
|
~qpGeomVertexData() {
|
|
|
|
|
+ // When we destruct, we should ensure that all of our cached
|
|
|
|
|
+ // entries, across all pipeline stages, are properly removed from
|
|
|
|
|
+ // the cache manager.
|
|
|
|
|
+ qpGeomVertexCacheManager *cache_mgr =
|
|
|
|
|
+ qpGeomVertexCacheManager::get_global_ptr();
|
|
|
|
|
+
|
|
|
|
|
+ int num_stages = _cycler.get_num_stages();
|
|
|
|
|
+ for (int i = 0; i < num_stages; i++) {
|
|
|
|
|
+ if (_cycler.is_stage_unique(i)) {
|
|
|
|
|
+ CData *cdata = _cycler.write_stage(i);
|
|
|
|
|
+ for (ConvertedCache::iterator ci = cdata->_converted_cache.begin();
|
|
|
|
|
+ ci != cdata->_converted_cache.end();
|
|
|
|
|
+ ++ci) {
|
|
|
|
|
+ cache_mgr->remove_data(this, (*ci).first);
|
|
|
|
|
+ }
|
|
|
|
|
+ cdata->_converted_cache.clear();
|
|
|
|
|
+ _cycler.release_write_stage(i, cdata);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
@@ -117,11 +137,14 @@ set_num_vertices(int n) {
|
|
|
CDWriter cdata(_cycler);
|
|
CDWriter cdata(_cycler);
|
|
|
nassertv(_format->get_num_arrays() == (int)cdata->_arrays.size());
|
|
nassertv(_format->get_num_arrays() == (int)cdata->_arrays.size());
|
|
|
|
|
|
|
|
|
|
+ bool any_changed = false;
|
|
|
|
|
+
|
|
|
for (size_t i = 0; i < cdata->_arrays.size(); i++) {
|
|
for (size_t i = 0; i < cdata->_arrays.size(); i++) {
|
|
|
int stride = _format->get_array(i)->get_stride();
|
|
int stride = _format->get_array(i)->get_stride();
|
|
|
int delta = n - (cdata->_arrays[i].size() / stride);
|
|
int delta = n - (cdata->_arrays[i].size() / stride);
|
|
|
|
|
|
|
|
if (delta != 0) {
|
|
if (delta != 0) {
|
|
|
|
|
+ any_changed = true;
|
|
|
if (cdata->_arrays[i].get_ref_count() > 1) {
|
|
if (cdata->_arrays[i].get_ref_count() > 1) {
|
|
|
// Copy-on-write: the array is already reffed somewhere else,
|
|
// Copy-on-write: the array is already reffed somewhere else,
|
|
|
// so we're just going to make a copy.
|
|
// so we're just going to make a copy.
|
|
@@ -145,6 +168,10 @@ set_num_vertices(int n) {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ if (any_changed) {
|
|
|
|
|
+ clear_cache();
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
@@ -190,6 +217,8 @@ modify_array_data(int array) {
|
|
|
cdata->_arrays[array] = PTA_uchar();
|
|
cdata->_arrays[array] = PTA_uchar();
|
|
|
cdata->_arrays[array].v() = orig_data.v();
|
|
cdata->_arrays[array].v() = orig_data.v();
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ clear_cache();
|
|
|
return cdata->_arrays[array];
|
|
return cdata->_arrays[array];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -209,105 +238,23 @@ set_array_data(int array, PTA_uchar array_data) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
-// Function: qpGeomVertexData::set_data
|
|
|
|
|
|
|
+// Function: qpGeomVertexData::get_num_bytes
|
|
|
// Access: Published
|
|
// Access: Published
|
|
|
-// Description: Sets the nth vertex to a particular value. Query the
|
|
|
|
|
-// format to get the array index and data_type
|
|
|
|
|
-// parameters for the particular data type you want to
|
|
|
|
|
-// set.
|
|
|
|
|
-//
|
|
|
|
|
-// This flavor of set_data() accepts a generic float
|
|
|
|
|
-// array and a specific number of dimensions. The new
|
|
|
|
|
-// data will be copied from the num_values elements
|
|
|
|
|
-// of data.
|
|
|
|
|
|
|
+// Description: Returns the total number of bytes consumed by the
|
|
|
|
|
+// different arrays of the vertex data.
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
-void qpGeomVertexData::
|
|
|
|
|
-set_data(int array, const qpGeomVertexDataType *data_type,
|
|
|
|
|
- int vertex, const float *data, int num_values) {
|
|
|
|
|
- int stride = _format->get_array(array)->get_stride();
|
|
|
|
|
- int element = vertex * stride + data_type->get_start();
|
|
|
|
|
-
|
|
|
|
|
- {
|
|
|
|
|
- CDReader cdata(_cycler);
|
|
|
|
|
- int array_size = (int)cdata->_arrays[array].size();
|
|
|
|
|
- if (element + data_type->get_total_bytes() > array_size) {
|
|
|
|
|
- // Whoops, we need more vertices!
|
|
|
|
|
- set_num_vertices(vertex + 1);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- PTA_uchar array_data = modify_array_data(array);
|
|
|
|
|
- nassertv(element >= 0 && element + data_type->get_total_bytes() <= (int)array_data.size());
|
|
|
|
|
-
|
|
|
|
|
- switch (data_type->get_numeric_type()) {
|
|
|
|
|
- case qpGeomVertexDataType::NT_uint8:
|
|
|
|
|
- {
|
|
|
|
|
- nassertv(num_values <= data_type->get_num_values());
|
|
|
|
|
- for (int i = 0; i < num_values; i++) {
|
|
|
|
|
- int value = (int)(data[i] * 255.0f);
|
|
|
|
|
- *(unsigned char *)&array_data[element] = value;
|
|
|
|
|
- element += 1;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- break;
|
|
|
|
|
-
|
|
|
|
|
- case qpGeomVertexDataType::NT_packed_argb:
|
|
|
|
|
- {
|
|
|
|
|
- nassertv(num_values == 4);
|
|
|
|
|
- *(PN_uint32 *)&array_data[element] = pack_argb(data);
|
|
|
|
|
- }
|
|
|
|
|
- break;
|
|
|
|
|
|
|
+int qpGeomVertexData::
|
|
|
|
|
+get_num_bytes() const {
|
|
|
|
|
+ CDReader cdata(_cycler);
|
|
|
|
|
+
|
|
|
|
|
+ int num_bytes = 0;
|
|
|
|
|
|
|
|
- case qpGeomVertexDataType::NT_float:
|
|
|
|
|
- nassertv(num_values == data_type->get_num_values());
|
|
|
|
|
- memcpy(&array_data[element], data, data_type->get_total_bytes());
|
|
|
|
|
- break;
|
|
|
|
|
|
|
+ Arrays::const_iterator ai;
|
|
|
|
|
+ for (ai = cdata->_arrays.begin(); ai != cdata->_arrays.end(); ++ai) {
|
|
|
|
|
+ num_bytes += (*ai).size();
|
|
|
}
|
|
}
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-////////////////////////////////////////////////////////////////////
|
|
|
|
|
-// Function: qpGeomVertexData::get_data
|
|
|
|
|
-// Access: Published
|
|
|
|
|
-// Description: Returns the data associated with the nth vertex for a
|
|
|
|
|
-// particular value. Query the format to get the array
|
|
|
|
|
-// index and data_type parameters for the particular
|
|
|
|
|
-// data type you want to get.
|
|
|
|
|
-//
|
|
|
|
|
-// This flavor of get_data() copies its data into a
|
|
|
|
|
-// generic float array.
|
|
|
|
|
-////////////////////////////////////////////////////////////////////
|
|
|
|
|
-void qpGeomVertexData::
|
|
|
|
|
-get_data(int array, const qpGeomVertexDataType *data_type,
|
|
|
|
|
- int vertex, float *data, int num_values) const {
|
|
|
|
|
- CPTA_uchar array_data = get_array_data(array);
|
|
|
|
|
- int stride = _format->get_array(array)->get_stride();
|
|
|
|
|
- int element = vertex * stride + data_type->get_start();
|
|
|
|
|
- nassertv(element >= 0 && element + data_type->get_total_bytes() <= (int)array_data.size());
|
|
|
|
|
-
|
|
|
|
|
- switch (data_type->get_numeric_type()) {
|
|
|
|
|
- case qpGeomVertexDataType::NT_uint8:
|
|
|
|
|
- {
|
|
|
|
|
- nassertv(num_values <= data_type->get_num_values());
|
|
|
|
|
- for (int i = 0; i < num_values; i++) {
|
|
|
|
|
- int value = *(unsigned char *)&array_data[element];
|
|
|
|
|
- element += 1;
|
|
|
|
|
- data[i] = (float)value / 255.0f;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- break;
|
|
|
|
|
|
|
|
|
|
- case qpGeomVertexDataType::NT_packed_argb:
|
|
|
|
|
- {
|
|
|
|
|
- nassertv(num_values == 4);
|
|
|
|
|
- unpack_argb(data, *(PN_uint32 *)&array_data[element]);
|
|
|
|
|
- }
|
|
|
|
|
- break;
|
|
|
|
|
-
|
|
|
|
|
- case qpGeomVertexDataType::NT_float:
|
|
|
|
|
- nassertv(num_values <= data_type->get_num_values());
|
|
|
|
|
- memcpy(data, &array_data[element], num_values * sizeof(PN_float32));
|
|
|
|
|
- break;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ return num_bytes;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
@@ -318,10 +265,43 @@ get_data(int array, const qpGeomVertexDataType *data_type,
|
|
|
// the data vertex-by-vertex to a new set of data arrays
|
|
// the data vertex-by-vertex to a new set of data arrays
|
|
|
// in the new format.
|
|
// in the new format.
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
-PT(qpGeomVertexData) qpGeomVertexData::
|
|
|
|
|
|
|
+CPT(qpGeomVertexData) qpGeomVertexData::
|
|
|
convert_to(const qpGeomVertexFormat *new_format) const {
|
|
convert_to(const qpGeomVertexFormat *new_format) const {
|
|
|
|
|
+ if (new_format == _format) {
|
|
|
|
|
+ // Trivial case: no change is needed.
|
|
|
|
|
+ return this;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // Look up the format in our cache--maybe we've recently converted
|
|
|
|
|
+ // to the requested format.
|
|
|
|
|
+ {
|
|
|
|
|
+ // Use read() and release_read() instead of CDReader, because the
|
|
|
|
|
+ // call to record_data() might recursively call back into this
|
|
|
|
|
+ // object, and require a write.
|
|
|
|
|
+ const CData *cdata = _cycler.read();
|
|
|
|
|
+ ConvertedCache::const_iterator ci =
|
|
|
|
|
+ cdata->_converted_cache.find(new_format);
|
|
|
|
|
+ if (ci != cdata->_converted_cache.end()) {
|
|
|
|
|
+ _cycler.release_read(cdata);
|
|
|
|
|
+ // Record a cache hit, so this element will stay in the cache a
|
|
|
|
|
+ // while longer.
|
|
|
|
|
+ qpGeomVertexCacheManager *cache_mgr =
|
|
|
|
|
+ qpGeomVertexCacheManager::get_global_ptr();
|
|
|
|
|
+ cache_mgr->record_data(this, new_format, (*ci).second->get_num_bytes());
|
|
|
|
|
+
|
|
|
|
|
+ return (*ci).second;
|
|
|
|
|
+ }
|
|
|
|
|
+ _cycler.release_read(cdata);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // Okay, convert the data to the new format.
|
|
|
int num_vertices = get_num_vertices();
|
|
int num_vertices = get_num_vertices();
|
|
|
|
|
|
|
|
|
|
+ if (gobj_cat.is_debug()) {
|
|
|
|
|
+ gobj_cat.debug()
|
|
|
|
|
+ << "Converting " << num_vertices << " vertices.\n";
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
PT(qpGeomVertexData) new_data = new qpGeomVertexData(new_format);
|
|
PT(qpGeomVertexData) new_data = new qpGeomVertexData(new_format);
|
|
|
|
|
|
|
|
pset<int> done_arrays;
|
|
pset<int> done_arrays;
|
|
@@ -383,6 +363,19 @@ convert_to(const qpGeomVertexFormat *new_format) const {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ // Record the new result in the cache.
|
|
|
|
|
+ {
|
|
|
|
|
+ CDWriter cdata(((qpGeomVertexData *)this)->_cycler);
|
|
|
|
|
+ cdata->_converted_cache[new_format] = new_data;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // And tell the cache manager about the new entry. (It might
|
|
|
|
|
+ // immediately request a delete from the cache of the thing we just
|
|
|
|
|
+ // added.)
|
|
|
|
|
+ qpGeomVertexCacheManager *cache_mgr =
|
|
|
|
|
+ qpGeomVertexCacheManager::get_global_ptr();
|
|
|
|
|
+ cache_mgr->record_data(this, new_format, new_data->get_num_bytes());
|
|
|
|
|
+
|
|
|
return new_data;
|
|
return new_data;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -406,6 +399,130 @@ write(ostream &out, int indent_level) const {
|
|
|
_format->write_with_data(out, indent_level, this);
|
|
_format->write_with_data(out, indent_level, this);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+////////////////////////////////////////////////////////////////////
|
|
|
|
|
+// Function: qpGeomVertexData::clear_cache
|
|
|
|
|
+// Access: Published
|
|
|
|
|
+// Description: Removes all of the previously-cached results of
|
|
|
|
|
+// convert_to().
|
|
|
|
|
+////////////////////////////////////////////////////////////////////
|
|
|
|
|
+void qpGeomVertexData::
|
|
|
|
|
+clear_cache() {
|
|
|
|
|
+ // Probably we shouldn't do anything at all here unless we are
|
|
|
|
|
+ // running in pipeline stage 0.
|
|
|
|
|
+ qpGeomVertexCacheManager *cache_mgr =
|
|
|
|
|
+ qpGeomVertexCacheManager::get_global_ptr();
|
|
|
|
|
+
|
|
|
|
|
+ CData *cdata = CDWriter(_cycler);
|
|
|
|
|
+ for (ConvertedCache::iterator ci = cdata->_converted_cache.begin();
|
|
|
|
|
+ ci != cdata->_converted_cache.end();
|
|
|
|
|
+ ++ci) {
|
|
|
|
|
+ cache_mgr->remove_data(this, (*ci).first);
|
|
|
|
|
+ }
|
|
|
|
|
+ cdata->_converted_cache.clear();
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+////////////////////////////////////////////////////////////////////
|
|
|
|
|
+// Function: qpGeomVertexData::set_data
|
|
|
|
|
+// Access: Public
|
|
|
|
|
+// Description: Sets the nth vertex to a particular value. Query the
|
|
|
|
|
+// format to get the array index and data_type
|
|
|
|
|
+// parameters for the particular data type you want to
|
|
|
|
|
+// set.
|
|
|
|
|
+//
|
|
|
|
|
+// This flavor of set_data() accepts a generic float
|
|
|
|
|
+// array and a specific number of dimensions. The new
|
|
|
|
|
+// data will be copied from the num_values elements
|
|
|
|
|
+// of data.
|
|
|
|
|
+////////////////////////////////////////////////////////////////////
|
|
|
|
|
+void qpGeomVertexData::
|
|
|
|
|
+set_data(int array, const qpGeomVertexDataType *data_type,
|
|
|
|
|
+ int vertex, const float *data, int num_values) {
|
|
|
|
|
+ int stride = _format->get_array(array)->get_stride();
|
|
|
|
|
+ int element = vertex * stride + data_type->get_start();
|
|
|
|
|
+
|
|
|
|
|
+ {
|
|
|
|
|
+ CDReader cdata(_cycler);
|
|
|
|
|
+ int array_size = (int)cdata->_arrays[array].size();
|
|
|
|
|
+ if (element + data_type->get_total_bytes() > array_size) {
|
|
|
|
|
+ // Whoops, we need more vertices!
|
|
|
|
|
+ set_num_vertices(vertex + 1);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ PTA_uchar array_data = modify_array_data(array);
|
|
|
|
|
+ nassertv(element >= 0 && element + data_type->get_total_bytes() <= (int)array_data.size());
|
|
|
|
|
+
|
|
|
|
|
+ switch (data_type->get_numeric_type()) {
|
|
|
|
|
+ case qpGeomVertexDataType::NT_uint8:
|
|
|
|
|
+ {
|
|
|
|
|
+ nassertv(num_values <= data_type->get_num_values());
|
|
|
|
|
+ for (int i = 0; i < num_values; i++) {
|
|
|
|
|
+ int value = (int)(data[i] * 255.0f);
|
|
|
|
|
+ *(unsigned char *)&array_data[element] = value;
|
|
|
|
|
+ element += 1;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ break;
|
|
|
|
|
+
|
|
|
|
|
+ case qpGeomVertexDataType::NT_packed_argb:
|
|
|
|
|
+ {
|
|
|
|
|
+ nassertv(num_values == 4);
|
|
|
|
|
+ *(PN_uint32 *)&array_data[element] = pack_argb(data);
|
|
|
|
|
+ }
|
|
|
|
|
+ break;
|
|
|
|
|
+
|
|
|
|
|
+ case qpGeomVertexDataType::NT_float:
|
|
|
|
|
+ nassertv(num_values == data_type->get_num_values());
|
|
|
|
|
+ memcpy(&array_data[element], data, data_type->get_total_bytes());
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+////////////////////////////////////////////////////////////////////
|
|
|
|
|
+// Function: qpGeomVertexData::get_data
|
|
|
|
|
+// Access: Public
|
|
|
|
|
+// Description: Returns the data associated with the nth vertex for a
|
|
|
|
|
+// particular value. Query the format to get the array
|
|
|
|
|
+// index and data_type parameters for the particular
|
|
|
|
|
+// data type you want to get.
|
|
|
|
|
+//
|
|
|
|
|
+// This flavor of get_data() copies its data into a
|
|
|
|
|
+// generic float array.
|
|
|
|
|
+////////////////////////////////////////////////////////////////////
|
|
|
|
|
+void qpGeomVertexData::
|
|
|
|
|
+get_data(int array, const qpGeomVertexDataType *data_type,
|
|
|
|
|
+ int vertex, float *data, int num_values) const {
|
|
|
|
|
+ CPTA_uchar array_data = get_array_data(array);
|
|
|
|
|
+ int stride = _format->get_array(array)->get_stride();
|
|
|
|
|
+ int element = vertex * stride + data_type->get_start();
|
|
|
|
|
+ nassertv(element >= 0 && element + data_type->get_total_bytes() <= (int)array_data.size());
|
|
|
|
|
+
|
|
|
|
|
+ switch (data_type->get_numeric_type()) {
|
|
|
|
|
+ case qpGeomVertexDataType::NT_uint8:
|
|
|
|
|
+ {
|
|
|
|
|
+ nassertv(num_values <= data_type->get_num_values());
|
|
|
|
|
+ for (int i = 0; i < num_values; i++) {
|
|
|
|
|
+ int value = *(unsigned char *)&array_data[element];
|
|
|
|
|
+ element += 1;
|
|
|
|
|
+ data[i] = (float)value / 255.0f;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ break;
|
|
|
|
|
+
|
|
|
|
|
+ case qpGeomVertexDataType::NT_packed_argb:
|
|
|
|
|
+ {
|
|
|
|
|
+ nassertv(num_values == 4);
|
|
|
|
|
+ unpack_argb(data, *(PN_uint32 *)&array_data[element]);
|
|
|
|
|
+ }
|
|
|
|
|
+ break;
|
|
|
|
|
+
|
|
|
|
|
+ case qpGeomVertexDataType::NT_float:
|
|
|
|
|
+ nassertv(num_values <= data_type->get_num_values());
|
|
|
|
|
+ memcpy(data, &array_data[element], num_values * sizeof(PN_float32));
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: qpGeomVertexData::get_array_info
|
|
// Function: qpGeomVertexData::get_array_info
|
|
|
// Access: Public
|
|
// Access: Public
|
|
@@ -546,6 +663,27 @@ unpack_argb(float data[4], unsigned int packed_argb) {
|
|
|
data[3] = (float)((packed_argb >> 24) & 0xff) / 255.0f;
|
|
data[3] = (float)((packed_argb >> 24) & 0xff) / 255.0f;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+////////////////////////////////////////////////////////////////////
|
|
|
|
|
+// Function: qpGeomVertexData::remove_cache_entry
|
|
|
|
|
+// Access: Private
|
|
|
|
|
+// Description: Removes a particular entry from the local cache; it
|
|
|
|
|
+// has already been removed from the cache manager.
|
|
|
|
|
+// This is only called from GeomVertexCacheManager.
|
|
|
|
|
+////////////////////////////////////////////////////////////////////
|
|
|
|
|
+void qpGeomVertexData::
|
|
|
|
|
+remove_cache_entry(const qpGeomVertexFormat *format) const {
|
|
|
|
|
+ // We have to operate on stage 0 of the pipeline, since that's where
|
|
|
|
|
+ // the cache really counts. Because of the multistage pipeline, we
|
|
|
|
|
+ // might not actually have a cache entry there (it might have been
|
|
|
|
|
+ // added to stage 1 instead). No big deal if we don't.
|
|
|
|
|
+ CData *cdata = ((qpGeomVertexData *)this)->_cycler.write_stage(0);
|
|
|
|
|
+ ConvertedCache::iterator ci = cdata->_converted_cache.find(format);
|
|
|
|
|
+ if (ci != cdata->_converted_cache.end()) {
|
|
|
|
|
+ cdata->_converted_cache.erase(ci);
|
|
|
|
|
+ }
|
|
|
|
|
+ ((qpGeomVertexData *)this)->_cycler.release_write_stage(0, cdata);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: qpGeomVertexData::register_with_read_factory
|
|
// Function: qpGeomVertexData::register_with_read_factory
|
|
|
// Access: Public, Static
|
|
// Access: Public, Static
|