Browse Source

GL: remove unneded ArrayView.h include from headers.

It was needed in the times before StringView, where the setLabel() APIs
had overloads taking a const char(&)[size] to avoid allocating a
std::string. But that got all removed and cleaned up in
bc884428f8 (two years ago!), yet somehow I
forgot to remove these includes as well.

In some cases the ArrayView was still used inside the header for
delegating from std::initializer_list overloads. Those are now
deinlined to not need the include anymore. The only remaining place that
*needs* an ArrayView include is Buffer.h, where it accepts an
initializer_list<T>. But there it's fine I think, the class is dealing
with memory as well.
pull/601/head
Vladimír Vondruš 3 years ago
parent
commit
b99e7dc50e
  1. 1
      src/Magnum/GL/AbstractQuery.h
  2. 16
      src/Magnum/GL/AbstractTexture.cpp
  3. 13
      src/Magnum/GL/AbstractTexture.h
  4. 2
      src/Magnum/GL/Framebuffer.h
  5. 1
      src/Magnum/GL/Mesh.h
  6. 1
      src/Magnum/GL/Renderbuffer.h
  7. 4
      src/Magnum/GL/TransformFeedback.cpp
  8. 5
      src/Magnum/GL/TransformFeedback.h

1
src/Magnum/GL/AbstractQuery.h

@ -30,7 +30,6 @@
*/
#include <utility> /* std::swap() */
#include <Corrade/Containers/ArrayView.h>
#include <Corrade/Utility/Assert.h>
#include "Magnum/Tags.h"

16
src/Magnum/GL/AbstractTexture.cpp

@ -154,12 +154,15 @@ void AbstractTexture::unbind(const Int firstTextureUnit, const std::size_t count
Context::current().state().texture.bindMultiImplementation(firstTextureUnit, {nullptr, count});
}
/** @todoc const std::initializer_list makes Doxygen grumpy */
void AbstractTexture::bind(const Int firstTextureUnit, Containers::ArrayView<AbstractTexture* const> textures) {
/* State tracker is updated in the implementations */
Context::current().state().texture.bindMultiImplementation(firstTextureUnit, {textures.begin(), textures.size()});
}
void AbstractTexture::bind(const Int firstTextureUnit, const std::initializer_list<AbstractTexture*> textures) {
bind(firstTextureUnit, Containers::arrayView(textures));
}
void AbstractTexture::bindImplementationFallback(const GLint firstTextureUnit, const Containers::ArrayView<AbstractTexture* const> textures) {
for(std::size_t i = 0; i != textures.size(); ++i)
textures && textures[i] ? textures[i]->bind(firstTextureUnit + i) : unbind(firstTextureUnit + i);
@ -284,8 +287,11 @@ void AbstractTexture::unbindImage(const Int imageUnit) {
}
#ifndef MAGNUM_TARGET_GLES
/** @todoc const Containers::ArrayView makes Doxygen grumpy */
void AbstractTexture::bindImages(const Int firstImageUnit, Containers::ArrayView<AbstractTexture* const> textures) {
void AbstractTexture::unbindImages(const Int firstImageUnit, const std::size_t count) {
bindImages(firstImageUnit, {nullptr, count});
}
void AbstractTexture::bindImages(const Int firstImageUnit, const Containers::ArrayView<AbstractTexture* const> textures) {
Implementation::TextureState& textureState = Context::current().state().texture;
/* Create array of IDs and also update bindings in state tracker */
@ -312,6 +318,10 @@ void AbstractTexture::bindImages(const Int firstImageUnit, Containers::ArrayView
/* Avoid doing the binding if there is nothing different */
if(different) glBindImageTextures(firstImageUnit, textures.size(), ids);
}
void AbstractTexture::bindImages(const Int firstImageUnit, const std::initializer_list<AbstractTexture*> textures) {
bindImages(firstImageUnit, Containers::arrayView(textures));
}
#endif
void AbstractTexture::bindImageInternal(const Int imageUnit, const Int level, const bool layered, const Int layer, const ImageAccess access, const ImageFormat format) {

13
src/Magnum/GL/AbstractTexture.h

@ -30,7 +30,6 @@
*/
#include <utility> /* std::swap() */
#include <Corrade/Containers/ArrayView.h>
#include "Magnum/DimensionTraits.h"
#include "Magnum/ImageFlags.h"
@ -252,9 +251,7 @@ class MAGNUM_GL_EXPORT AbstractTexture: public AbstractObject {
static void bind(Int firstTextureUnit, Containers::ArrayView<AbstractTexture* const> textures);
/** @overload */
static void bind(Int firstTextureUnit, std::initializer_list<AbstractTexture*> textures) {
AbstractTexture::bind(firstTextureUnit, Containers::arrayView(textures.begin(), textures.size()));
}
static void bind(Int firstTextureUnit, std::initializer_list<AbstractTexture*> textures);
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
/**
@ -293,9 +290,7 @@ class MAGNUM_GL_EXPORT AbstractTexture: public AbstractObject {
* @requires_gl44 Extension @gl_extension{ARB,multi_bind}
* @requires_gl Multi bind is not available in OpenGL ES and WebGL.
*/
static void unbindImages(Int firstImageUnit, std::size_t count) {
bindImages(firstImageUnit, {nullptr, count});
}
static void unbindImages(Int firstImageUnit, std::size_t count);
/**
* @brief Bind textures to given range of texture units
@ -320,9 +315,7 @@ class MAGNUM_GL_EXPORT AbstractTexture: public AbstractObject {
static void bindImages(Int firstImageUnit, Containers::ArrayView<AbstractTexture* const> textures);
/** @overload */
static void bindImages(Int firstImageUnit, std::initializer_list<AbstractTexture*> textures) {
bindImages(firstImageUnit, Containers::arrayView(textures.begin(), textures.size()));
}
static void bindImages(Int firstImageUnit, std::initializer_list<AbstractTexture*> textures);
#endif
/** @brief Copying is not allowed */

2
src/Magnum/GL/Framebuffer.h

@ -30,8 +30,6 @@
* @brief Class @ref Magnum::GL::Framebuffer
*/
#include <Corrade/Containers/ArrayView.h>
#include "Magnum/Tags.h"
#include "Magnum/GL/AbstractFramebuffer.h"

1
src/Magnum/GL/Mesh.h

@ -29,7 +29,6 @@
* @brief Class @ref Magnum::GL::Mesh, enum @ref Magnum::GL::MeshPrimitive, @ref Magnum::GL::MeshIndexType, function @ref Magnum::GL::meshPrimitive(), @ref Magnum::GL::meshIndexType()
*/
#include <Corrade/Containers/ArrayView.h>
#include <Corrade/Utility/ConfigurationValue.h>
#include "Magnum/Tags.h"

1
src/Magnum/GL/Renderbuffer.h

@ -30,7 +30,6 @@
*/
#include <utility> /* std::swap() */
#include <Corrade/Containers/ArrayView.h>
#include "Magnum/Tags.h"
#include "Magnum/GL/AbstractObject.h"

4
src/Magnum/GL/TransformFeedback.cpp

@ -223,6 +223,10 @@ TransformFeedback& TransformFeedback::attachBuffers(const UnsignedInt firstIndex
return *this;
}
TransformFeedback& TransformFeedback::attachBuffers(const UnsignedInt firstIndex, const std::initializer_list<Buffer*> buffers) {
return attachBuffers(firstIndex, Containers::arrayView(buffers));
}
void TransformFeedback::attachImplementationFallback(const GLuint firstIndex, Containers::ArrayView<const Containers::Triple<Buffer*, GLintptr, GLsizeiptr>> buffers) {
bindInternal();
Buffer::bind(Buffer::Target(GL_TRANSFORM_FEEDBACK_BUFFER), firstIndex, buffers);

5
src/Magnum/GL/TransformFeedback.h

@ -33,7 +33,6 @@
#endif
#include <utility>
#include <Corrade/Containers/ArrayView.h>
#include "Magnum/Tags.h"
#include "Magnum/GL/AbstractObject.h"
@ -375,9 +374,7 @@ class MAGNUM_GL_EXPORT TransformFeedback: public AbstractObject {
TransformFeedback& attachBuffers(UnsignedInt firstIndex, Containers::ArrayView<Buffer* const> buffers);
/** @overload */
TransformFeedback& attachBuffers(UnsignedInt firstIndex, std::initializer_list<Buffer*> buffers) {
return attachBuffers(firstIndex, Containers::arrayView(buffers));
}
TransformFeedback& attachBuffers(UnsignedInt firstIndex, std::initializer_list<Buffer*> buffers);
/**
* @brief Begin transform feedback

Loading…
Cancel
Save