X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fbackends%2Fopengl%2Ftexture2dmultisample_backend.cpp;h=f0675044b23cdb6b8fcf72dacf86bdb7b79f885d;hb=HEAD;hp=71f9e138abddee50a7c157c0ef7e33b0dfda7a3a;hpb=57ca8f2bd18525d80ed6ad5d3f72e57901162d55;p=libs%2Fgl.git diff --git a/source/backends/opengl/texture2dmultisample_backend.cpp b/source/backends/opengl/texture2dmultisample_backend.cpp index 71f9e138..f0675044 100644 --- a/source/backends/opengl/texture2dmultisample_backend.cpp +++ b/source/backends/opengl/texture2dmultisample_backend.cpp @@ -15,31 +15,35 @@ OpenGLTexture2DMultisample::OpenGLTexture2DMultisample(): void OpenGLTexture2DMultisample::allocate() { - unsigned width = static_cast(this)->width; - unsigned height = static_cast(this)->height; - unsigned samples = static_cast(this)->samples; + const Texture2DMultisample &self = *static_cast(this); if(!id) - generate_id(); + create(); GLenum gl_fmt = get_gl_pixelformat(storage_fmt); if(ARB_texture_storage_multisample) { if(ARB_direct_state_access) - glTextureStorage2DMultisample(id, samples, gl_fmt, width, height, false); + glTextureStorage2DMultisample(id, self.samples, gl_fmt, self.width, self.height, false); else { bind_scratch(); - glTexStorage2DMultisample(target, samples, gl_fmt, width, height, false); + glTexStorage2DMultisample(target, self.samples, gl_fmt, self.width, self.height, false); } } else { bind_scratch(); - glTexImage2DMultisample(target, samples, gl_fmt, width, height, false); + glTexImage2DMultisample(target, self.samples, gl_fmt, self.width, self.height, false); } apply_swizzle(); } +size_t OpenGLTexture2DMultisample::get_data_size() const +{ + const Texture2DMultisample &self = *static_cast(this); + return self.width*self.height*get_pixel_size(format)*self.samples; +} + } // namespace GL } // namespace Msp