X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fbackends%2Fopengl%2Ftexture2d_backend.cpp;h=2f396df4180978ec52821ec59247ed5a76293be4;hb=e2a707feb62c5df69884cca34d099dd2f7b7e4e2;hp=72962117bc9967d98228735063b5189e10368dfd;hpb=2b930a353df652ade5baacae21d5d8a01f37c09d;p=libs%2Fgl.git diff --git a/source/backends/opengl/texture2d_backend.cpp b/source/backends/opengl/texture2d_backend.cpp index 72962117..2f396df4 100644 --- a/source/backends/opengl/texture2d_backend.cpp +++ b/source/backends/opengl/texture2d_backend.cpp @@ -102,9 +102,18 @@ Resource::AsyncLoader *OpenGLTexture2D::load(IO::Seekable &io, const Resources * uint64_t OpenGLTexture2D::get_data_size() const { + if(!id) + return 0; + unsigned width = static_cast(this)->width; unsigned height = static_cast(this)->height; - return id ? width*height*get_pixel_size(format) : 0; + unsigned levels = static_cast(this)->levels; + + size_t level_size = width*height*get_pixel_size(format); + size_t total_size = level_size; + for(unsigned i=0; i>=2) + total_size += level_size; + return total_size; } void OpenGLTexture2D::unload()