Log In
New Account
Home My Page Projects Blender 2.x BF release
Summary Activity Tracker SCM Files

Blender 2.6 Bug Tracker: Browse

[#24869] Freeing an image, problems with GPU_texture_vram function usage.

Date:
2010-11-23 08:29
Priority:
3
State:
Closed
Submitted by:
Campbell Barton (campbellbarton)
Assigned to:
Mitchell Stokes (moguri)
Category:
None
Status:
Fixed / Closed
Relates to:
Duplicates:
Patches:
 
Summary:
Freeing an image, problems with GPU_texture_vram function usage.
Detailed description
There are 2 bugs with GPU_free_image(), relating to commit 33120 to add memory monitoring for opengl memory.

1) return value from BKE_image_get_ibuf() has no NULL check, this crashes on failure.
2) BKE_image_get_ibuf() will allocate generated images if they are not yet used, this is bad for a freeing function.

Example as to how to redo these problems.
1) Assign a texface an image to a cube, display textured mode, change image type from Generated to File. (crash)
2) same as 1, but save the file and quit, on quitting there is a totblock error because GPU_free_image allocates a new buffer.

Followup

Message
  • Date: 2010-11-23 09:44
  • Sender: ronan ducluzeau
  • ubuntu 10.04 64bits rev33249

    reproduced
  • Date: 2010-11-23 13:51
  • Sender: Campbell Barton
  • This could be re-written to loop over all images and get the sizes from opengl.

    GLint x= 0, y= 0;
    glBindTexture(ima->bindcode);
    glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &x);
    glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, &y);
    ...add...
  • Date: 2010-11-24 08:40
  • Sender: Campbell Barton
  • To me this is too intrusive, Id rather have a function which uses an OpenGL extension to detect used textrue memory and falls back to a loop over images if the extension isnt available.

    setting the bind code works but could cause problems elsewhere - say if an image is freed while the bindcode is set elsewhere. - Ofcourse there could be some way to restore the original bindcode, would need to look into this.

    So my preference is to make this into a single function since its non trivial to maintain this while blender runs.

    closing since this code is removed from svn.
 

Attached Files:

No Files Currently Attached

Changes:

Field Old Value Date By
ResolutionInvestigate2010-11-24 08:40campbellbarton
close_date2010-11-24 08:402010-11-24 08:40campbellbarton
status_idOpen2010-11-24 08:40campbellbarton