Skip to content

Commit

Permalink
[GL] Clear texture data from RAM after loading
Browse files Browse the repository at this point in the history
Keeping the data in RAM is not necessary after sending it to OpenGL, and
clearing it saves a significant amount of memory with several NIFs open.
  • Loading branch information
hexabits committed Nov 7, 2016
1 parent f32b9ad commit beb5870
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/gl/gltexloaders.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1240,6 +1240,7 @@ bool texLoad( const QString & filepath, QString & format, GLuint & width, GLuint
throw QString( "unknown texture format" );

f.close();
data.clear();

glGetTexLevelParameteriv( GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, (GLint *)&width );
glGetTexLevelParameteriv( GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, (GLint *)&height );
Expand Down Expand Up @@ -1299,6 +1300,7 @@ bool texLoadCube( const QString & filepath, QString & format, GLuint & width, GL


f.close();
data.clear();

glGetTexLevelParameteriv( GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_TEXTURE_WIDTH, (GLint *)&width );
glGetTexLevelParameteriv( GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_TEXTURE_HEIGHT, (GLint *)&height );
Expand Down

0 comments on commit beb5870

Please sign in to comment.