Browse Source

Moved OpenGL includes out from Magnum.h.

OpenGL includes are ~35k lines together and it is a waste of
compilation time to include them even if they are not needed at all
(e.g. whole SceneGraph and Physics libraries). Saves ~10s of compilation
time (6:46 before, now 6:35).
pull/278/head
Vladimír Vondruš 13 years ago
parent
commit
1693c772ad
  1. 2
      src/AbstractImage.h
  2. 14
      src/AbstractShaderProgram.cpp
  3. 2
      src/AbstractShaderProgram.h
  4. 2
      src/Buffer.h
  5. 2
      src/CMakeLists.txt
  6. 2
      src/Context.h
  7. 15
      src/Magnum.h
  8. 35
      src/OpenGL.cpp
  9. 36
      src/OpenGL.h
  10. 1
      src/Platform/ExtensionWrangler.cpp
  11. 1
      src/Platform/GlutApplication.h
  12. 2
      src/Platform/GlxContextHandler.h
  13. 5
      src/Platform/WindowlessGlxApplication.h
  14. 2
      src/Query.h
  15. 2
      src/Renderbuffer.h

2
src/AbstractImage.h

@ -22,7 +22,7 @@
#include <cstddef>
#include "Magnum.h"
#include "OpenGL.h"
#include "magnumVisibility.h"
namespace Magnum {

14
src/AbstractShaderProgram.cpp

@ -28,20 +28,6 @@
namespace Magnum {
#ifndef DOXYGEN_GENERATING_OUTPUT
static_assert(std::is_same<GLubyte, UnsignedByte>::value, "GLubyte is not the same as UnsignedByte");
static_assert(std::is_same<GLbyte, Byte>::value, "GLbyte is not the same as Byte");
static_assert(std::is_same<GLushort, UnsignedShort>::value, "GLushort is not the same as UnsignedShort");
static_assert(std::is_same<GLshort, Short>::value, "GLshort is not the same as Short");
static_assert(std::is_same<GLuint, UnsignedInt>::value, "GLuint is not the same as UnsignedInt");
static_assert(std::is_same<GLint, Int>::value, "GLint is not the same as Int");
static_assert(std::is_same<GLsizei, Int>::value, "GLsizei is not the same as Int");
static_assert(std::is_same<GLfloat, Float>::value, "GLfloat is not the same as Float");
#ifndef MAGNUM_TARGET_GLES
static_assert(std::is_same<GLdouble, Double>::value, "GLdouble is not the same as Double");
#endif
#endif
AbstractShaderProgram::Uniform1fImplementation AbstractShaderProgram::uniform1fImplementation = &AbstractShaderProgram::uniformImplementationDefault;
AbstractShaderProgram::Uniform2fvImplementation AbstractShaderProgram::uniform2fvImplementation = &AbstractShaderProgram::uniformImplementationDefault;
AbstractShaderProgram::Uniform3fvImplementation AbstractShaderProgram::uniform3fvImplementation = &AbstractShaderProgram::uniformImplementationDefault;

2
src/AbstractShaderProgram.h

@ -23,7 +23,7 @@
#include <Containers/EnumSet.h>
#include "Magnum.h"
#include "OpenGL.h"
#include "magnumVisibility.h"
/** @todo early asserts (no bool returns?) */

2
src/Buffer.h

@ -25,7 +25,7 @@
#include <Containers/EnumSet.h>
#include "Magnum.h"
#include "OpenGL.h"
#include "magnumVisibility.h"
namespace Magnum {

2
src/CMakeLists.txt

@ -22,6 +22,7 @@ set(Magnum_SRCS
Framebuffer.cpp
Image.cpp
Mesh.cpp
OpenGL.cpp
Query.cpp
Renderbuffer.cpp
Resource.cpp
@ -69,6 +70,7 @@ set(Magnum_HEADERS
ImageWrapper.h
Magnum.h
Mesh.h
OpenGL.h
Query.h
Renderbuffer.h
Renderer.h

2
src/Context.h

@ -23,7 +23,7 @@
#include <vector>
#include "Magnum.h"
#include "OpenGL.h"
#include "magnumVisibility.h"
namespace Magnum {

15
src/Magnum.h

@ -16,28 +16,15 @@
*/
/** @file
* @brief Basic definitions and forward declarations for Magnum namespace
* @brief Forward declarations for Magnum namespace
*/
#include <corradeConfigure.h>
#include "Math/Math.h"
#include "Types.h"
#include "magnumConfigure.h"
#ifndef MAGNUM_TARGET_GLES
#include <GL/glew.h>
#include <GL/glcorearb.h>
#else
#ifndef MAGNUM_TARGET_GLES2
#include <GLES3/gl3.h>
#else
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#endif
#endif
namespace Corrade {
namespace Utility {
class Debug;

35
src/OpenGL.cpp

@ -0,0 +1,35 @@
/*
Copyright © 2010, 2011, 2012 Vladimír Vondruš <mosra@centrum.cz>
This file is part of Magnum.
Magnum is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License version 3
only, as published by the Free Software Foundation.
Magnum is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License version 3 for more details.
*/
#include <type_traits>
#include "OpenGL.h"
#include "Types.h"
namespace Magnum {
static_assert(std::is_same<GLubyte, UnsignedByte>::value, "GLubyte is not the same as UnsignedByte");
static_assert(std::is_same<GLbyte, Byte>::value, "GLbyte is not the same as Byte");
static_assert(std::is_same<GLushort, UnsignedShort>::value, "GLushort is not the same as UnsignedShort");
static_assert(std::is_same<GLshort, Short>::value, "GLshort is not the same as Short");
static_assert(std::is_same<GLuint, UnsignedInt>::value, "GLuint is not the same as UnsignedInt");
static_assert(std::is_same<GLint, Int>::value, "GLint is not the same as Int");
static_assert(std::is_same<GLsizei, Int>::value, "GLsizei is not the same as Int");
static_assert(std::is_same<GLfloat, Float>::value, "GLfloat is not the same as Float");
#ifndef MAGNUM_TARGET_GLES
static_assert(std::is_same<GLdouble, Double>::value, "GLdouble is not the same as Double");
#endif
}

36
src/OpenGL.h

@ -0,0 +1,36 @@
#ifndef Magnum_OpenGL_h
#define Magnum_OpenGL_h
/*
Copyright © 2010, 2011, 2012 Vladimír Vondruš <mosra@centrum.cz>
This file is part of Magnum.
Magnum is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License version 3
only, as published by the Free Software Foundation.
Magnum is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License version 3 for more details.
*/
/** @file
* @brief OpenGL headers
*/
#include "magnumConfigure.h"
#ifndef MAGNUM_TARGET_GLES
#include <GL/glew.h>
#include <GL/glcorearb.h>
#else
#ifndef MAGNUM_TARGET_GLES2
#include <GLES3/gl3.h>
#else
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#endif
#endif
#endif

1
src/Platform/ExtensionWrangler.cpp

@ -19,6 +19,7 @@
#include <Utility/Debug.h>
#include "Magnum.h"
#include "OpenGL.h"
namespace Magnum { namespace Platform {

1
src/Platform/GlutApplication.h

@ -23,6 +23,7 @@
#include "Math/Vector2.h"
#include "Magnum.h"
#include "OpenGL.h"
#include <GL/freeglut.h>

2
src/Platform/GlxContextHandler.h

@ -19,7 +19,7 @@
* @brief Class Magnum::Platform::GlxContextHandler
*/
#include "Magnum.h"
#include "OpenGL.h"
#include <GL/glx.h>
/* undef Xlib nonsense to avoid conflicts */
#undef Complex

5
src/Platform/WindowlessGlxApplication.h

@ -19,7 +19,7 @@
* @brief Class Magnum::Platform::WindowlessGlxApplication
*/
#include "Magnum.h"
#include "OpenGL.h"
#include <GL/glx.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
@ -28,7 +28,8 @@
#undef None
#undef Always
#include "AbstractContextHandler.h"
#include "Magnum.h"
#include "Platform/AbstractContextHandler.h"
namespace Magnum { namespace Platform {

2
src/Query.h

@ -20,7 +20,7 @@
*/
#include "Magnum.h"
#include "OpenGL.h"
#include "magnumVisibility.h"
namespace Magnum {

2
src/Renderbuffer.h

@ -20,7 +20,7 @@
*/
#include "Magnum.h"
#include "OpenGL.h"
#include "magnumVisibility.h"
namespace Magnum {

Loading…
Cancel
Save