fix thread deadlock problem

This commit is contained in:
David Rose 2008-10-09 20:48:13 +00:00
parent e9a1126423
commit bce545c958
4 changed files with 15 additions and 5 deletions

View File

@ -1558,7 +1558,7 @@ recompute_minmax(GeomPrimitive::CData *cdata) {
cdata->_min_vertex = min(cdata->_min_vertex, vertex);
cdata->_max_vertex = max(cdata->_max_vertex, vertex);
nassertv(pi < cdata->_ends.size());
nassertv(pi < (int)cdata->_ends.size());
if (vi == cdata->_ends[pi]) {
mins.add_data1i(min_prim);
maxs.add_data1i(max_prim);

View File

@ -1283,7 +1283,7 @@ get_ram_mipmap_page_size(int n) const {
INLINE size_t Texture::
get_expected_ram_mipmap_image_size(int n) const {
MutexHolder holder(_lock);
return do_get_expected_ram_mipmap_page_size(n) * (size_t)do_get_expected_mipmap_z_size(n);
return do_get_expected_ram_mipmap_image_size(n);
}
////////////////////////////////////////////////////////////////////
@ -1822,6 +1822,16 @@ do_get_expected_ram_page_size() const {
return (size_t)(_x_size * _y_size * _num_components * _component_width);
}
////////////////////////////////////////////////////////////////////
// Function: Texture::do_get_expected_ram_mipmap_image_size
// Access: Protected
// Description:
////////////////////////////////////////////////////////////////////
INLINE size_t Texture::
do_get_expected_ram_mipmap_image_size(int n) const {
return do_get_expected_ram_mipmap_page_size(n) * (size_t)do_get_expected_mipmap_z_size(n);
}
////////////////////////////////////////////////////////////////////
// Function: Texture::do_get_expected_ram_mipmap_page_size
// Access: Protected

View File

@ -920,7 +920,7 @@ get_ram_mipmap_image(int n) {
void Texture::
set_ram_mipmap_image(int n, PTA_uchar image, size_t page_size) {
MutexHolder holder(_lock);
nassertv(_ram_image_compression != CM_off || image.size() == get_expected_ram_mipmap_image_size(n));
nassertv(_ram_image_compression != CM_off || image.size() == do_get_expected_ram_mipmap_image_size(n));
while (n >= (int)_ram_images.size()) {
_ram_images.push_back(RamImage());
@ -3099,7 +3099,7 @@ do_make_ram_mipmap_image(int n) {
_ram_images.back()._page_size = 0;
}
_ram_images[n]._image = PTA_uchar::empty_array(get_expected_ram_mipmap_image_size(n), get_class_type());
_ram_images[n]._image = PTA_uchar::empty_array(do_get_expected_ram_mipmap_image_size(n), get_class_type());
_ram_images[n]._page_size = do_get_expected_ram_mipmap_page_size(n);
return _ram_images[n]._image;
}
@ -3271,7 +3271,6 @@ do_assign(const Texture &copy) {
_border_color = copy._border_color;
_compression = copy._compression;
_match_framebuffer_format = copy._match_framebuffer_format;
_post_load_store_cache = false;
_quality_level = copy._quality_level;
_ram_image_compression = copy._ram_image_compression;
_ram_images = copy._ram_images;

View File

@ -513,6 +513,7 @@ protected:
INLINE size_t do_get_expected_ram_image_size() const;
INLINE size_t do_get_expected_ram_page_size() const;
size_t do_get_ram_mipmap_page_size(int n) const;
INLINE size_t do_get_expected_ram_mipmap_image_size(int n) const;
INLINE size_t do_get_expected_ram_mipmap_page_size(int n) const;
int do_get_expected_mipmap_x_size(int n) const;
int do_get_expected_mipmap_y_size(int n) const;