This commit is contained in:
David Rose 2008-07-15 00:21:22 +00:00
parent ac3211ffc8
commit caae0af597
1 changed files with 4 additions and 2 deletions

View File

@ -1891,8 +1891,10 @@ setup_gltex(GLTexture *gltex, int x_size, int y_size, int num_levels) {
}
if (gltex->total_bytecount != total_bytecount) {
gl_free(gltex->allocated_buffer);
TinyTextureContext::get_class_type().dec_memory_usage(TypeHandle::MC_array, gltex->total_bytecount);
if (gltex->allocated_buffer != NULL) {
gl_free(gltex->allocated_buffer);
TinyTextureContext::get_class_type().dec_memory_usage(TypeHandle::MC_array, gltex->total_bytecount);
}
gltex->allocated_buffer = (void *)gl_malloc(total_bytecount);
gltex->total_bytecount = total_bytecount;
TinyTextureContext::get_class_type().inc_memory_usage(TypeHandle::MC_array, total_bytecount);