Browse Source

GL: make AbstractTexture destructor protected.

Right now there isn't any work done in subclass destructors, but that
may change in the future due to driver workarounds being added. So
better be prepared.
findsdl-include-root
Vladimír Vondruš 7 years ago
parent
commit
06aac867ae
  1. 5
      doc/changelog.dox
  2. 31
      src/Magnum/GL/AbstractTexture.h

5
doc/changelog.dox

@ -659,6 +659,11 @@ See also:
forward compatible.
- @cpp GL::TextureFormat::R3B3G2 @ce had a misleading typo in the name, use
@ref GL::TextureFormat::R3G3B2 instead.
- @ref GL::AbstractTexture destructor is now @cpp protected @ce on builds
with @ref MAGNUM_BUILD_DEPRECATED disabled in order to avoid accidents with
subclass destructors not being called. Right now all subclasses themselves
have trivial destruction, but that may change in the future due to driver
workarounds being added.
- @cpp Magnum/MeshTools/GenerateFlatNormals.h @ce is deprecated, use
@cpp Magnum/MeshTools/GenerateNormals.h @ce instead
- @cpp MeshTools::generateFlatNormals(const std::vector<UnsignedInt>&, const std::vector<Vector3>&) @ce

31
src/Magnum/GL/AbstractTexture.h

@ -317,18 +317,6 @@ class MAGNUM_GL_EXPORT AbstractTexture: public AbstractObject {
/** @brief Move constructor */
AbstractTexture(AbstractTexture&& other) noexcept;
/**
* @brief Destructor
*
* Deletes associated OpenGL texture.
* @see @ref BufferTexture::wrap(), @ref CubeMapTexture::wrap(),
* @ref CubeMapTextureArray::wrap(),
* @ref MultisampleTexture::wrap(), @ref RectangleTexture::wrap(),
* @ref Texture::wrap(), @ref TextureArray::wrap(),
* @ref release(), @fn_gl_keyword{DeleteTextures}
*/
~AbstractTexture();
/** @brief Copying is not allowed */
AbstractTexture& operator=(const AbstractTexture&) = delete;
@ -409,6 +397,25 @@ class MAGNUM_GL_EXPORT AbstractTexture: public AbstractObject {
*/
void bind(Int textureUnit);
#if !defined(MAGNUM_BUILD_DEPRECATED) || defined(DOXYGEN_GENERATING_OUTPUT)
protected: /* Destructor was public before */
#endif
/**
* @brief Destructor
*
* Deletes associated OpenGL texture.
* @see @ref BufferTexture::wrap(), @ref CubeMapTexture::wrap(),
* @ref CubeMapTextureArray::wrap(),
* @ref MultisampleTexture::wrap(), @ref RectangleTexture::wrap(),
* @ref Texture::wrap(), @ref TextureArray::wrap(),
* @ref release(), @fn_gl_keyword{DeleteTextures}
*/
/* Not virtual to avoid vtable overhead, however while subclasses are
all the same size (and thus no risk of memory leaks from additional
members) these might perform cleanup steps on destruction (driver
workarouds...), so we have to disallow deletion from base pointer */
~AbstractTexture();
#ifdef DOXYGEN_GENERATING_OUTPUT
private:
#else

Loading…
Cancel
Save