Browse Source

external: pass GL::Context to flextGLInit().

To make it possible to put driver-specific workaround there.
simd
Vladimír Vondruš 7 years ago
parent
commit
5923efbdee
  1. 9
      src/Magnum/GL/Context.cpp
  2. 8
      src/Magnum/GL/Context.h
  3. 3
      src/MagnumExternal/OpenGL/GL/flextGL.h
  4. 3
      src/MagnumExternal/OpenGL/GL/flextGL.h.template
  5. 2
      src/MagnumExternal/OpenGL/GL/flextGLPlatform.cpp
  6. 2
      src/MagnumExternal/OpenGL/GL/flextGLPlatform.cpp.template
  7. 4
      src/MagnumExternal/OpenGL/GLES2/Emscripten/flextGLEmscripten.h.template
  8. 3
      src/MagnumExternal/OpenGL/GLES2/flextGL.h
  9. 3
      src/MagnumExternal/OpenGL/GLES2/flextGL.h.template
  10. 4
      src/MagnumExternal/OpenGL/GLES2/flextGLEmscripten.h
  11. 2
      src/MagnumExternal/OpenGL/GLES2/flextGLPlatform.cpp
  12. 2
      src/MagnumExternal/OpenGL/GLES2/flextGLPlatform.cpp.template
  13. 2
      src/MagnumExternal/OpenGL/GLES2/flextGLPlatformIOS.cpp
  14. 2
      src/MagnumExternal/OpenGL/GLES2/flextGLPlatformIOS.cpp.template
  15. 2
      src/MagnumExternal/OpenGL/GLES2/flextGLPlatformWindowsDesktop.cpp
  16. 2
      src/MagnumExternal/OpenGL/GLES2/flextGLPlatformWindowsDesktop.cpp.template
  17. 3
      src/MagnumExternal/OpenGL/GLES2/flextGLWindowsDesktop.h
  18. 3
      src/MagnumExternal/OpenGL/GLES2/flextGLWindowsDesktop.h.template
  19. 4
      src/MagnumExternal/OpenGL/GLES3/Emscripten/flextGLEmscripten.h.template
  20. 3
      src/MagnumExternal/OpenGL/GLES3/flextGL.h
  21. 3
      src/MagnumExternal/OpenGL/GLES3/flextGL.h.template
  22. 4
      src/MagnumExternal/OpenGL/GLES3/flextGLEmscripten.h
  23. 2
      src/MagnumExternal/OpenGL/GLES3/flextGLPlatform.cpp
  24. 2
      src/MagnumExternal/OpenGL/GLES3/flextGLPlatform.cpp.template
  25. 2
      src/MagnumExternal/OpenGL/GLES3/flextGLPlatformIOS.cpp
  26. 2
      src/MagnumExternal/OpenGL/GLES3/flextGLPlatformIOS.cpp.template
  27. 2
      src/MagnumExternal/OpenGL/GLES3/flextGLPlatformWindowsDesktop.cpp
  28. 2
      src/MagnumExternal/OpenGL/GLES3/flextGLPlatformWindowsDesktop.cpp.template
  29. 3
      src/MagnumExternal/OpenGL/GLES3/flextGLWindowsDesktop.h
  30. 3
      src/MagnumExternal/OpenGL/GLES3/flextGLWindowsDesktop.h.template

9
src/Magnum/GL/Context.cpp

@ -449,9 +449,9 @@ Context& Context::current() {
return *currentContext;
}
Context::Context(NoCreateT, Int argc, const char** argv, void functionLoader()): Context{NoCreate, Utility::Arguments{"magnum"}, argc, argv, functionLoader} {}
Context::Context(NoCreateT, Int argc, const char** argv, void functionLoader(Context&)): Context{NoCreate, Utility::Arguments{"magnum"}, argc, argv, functionLoader} {}
Context::Context(NoCreateT, Utility::Arguments& args, Int argc, const char** argv, void functionLoader()): _functionLoader{functionLoader}, _version{Version::None} {
Context::Context(NoCreateT, Utility::Arguments& args, Int argc, const char** argv, void functionLoader(Context&)): _functionLoader{functionLoader}, _version{Version::None} {
/* Parse arguments */
CORRADE_INTERNAL_ASSERT(args.prefix() == "magnum");
args.addOption("disable-workarounds")
@ -504,8 +504,9 @@ bool Context::tryCreate() {
CORRADE_ASSERT(_version == Version::None,
"Platform::Context::tryCreate(): context already created", false);
/* Load GL function pointers */
if(_functionLoader) _functionLoader();
/* Load GL function pointers. Pass this instance to it so it can use it for
potential driver-specific workarounds. */
if(_functionLoader) _functionLoader(*this);
/* Initialize to something predictable to avoid crashes on improperly
created contexts */

8
src/Magnum/GL/Context.h

@ -667,9 +667,9 @@ class MAGNUM_GL_EXPORT Context {
friend Platform::GLContext;
#endif
explicit Context(NoCreateT, Int argc, const char** argv, void functionLoader());
explicit Context(NoCreateT, Utility::Arguments&& args, Int argc, const char** argv, void functionLoader()): Context{NoCreate, args, argc, argv, functionLoader} {}
explicit Context(NoCreateT, Utility::Arguments& args, Int argc, const char** argv, void functionLoader());
explicit Context(NoCreateT, Int argc, const char** argv, void functionLoader(Context&));
explicit Context(NoCreateT, Utility::Arguments&& args, Int argc, const char** argv, void functionLoader(Context&)): Context{NoCreate, args, argc, argv, functionLoader} {}
explicit Context(NoCreateT, Utility::Arguments& args, Int argc, const char** argv, void functionLoader(Context&));
bool tryCreate();
void create();
@ -683,7 +683,7 @@ class MAGNUM_GL_EXPORT Context {
MAGNUM_GL_LOCAL bool isCoreProfileImplementationNV();
#endif
void(*_functionLoader)(){};
void(*_functionLoader)(Context&){};
Version _version;
#ifndef MAGNUM_TARGET_WEBGL
Flags _flags;

3
src/MagnumExternal/OpenGL/GL/flextGL.h vendored

@ -28,6 +28,7 @@
#include <Corrade/Utility/VisibilityMacros.h>
#include "Magnum/configure.h"
#include "Magnum/GL/GL.h"
/* Defensive include guards */
@ -63,7 +64,7 @@ extern "C" {
#ifndef DOXYGEN_GENERATING_OUTPUT /* So the macro names are preserved in the docs */
void flextGLInit();
void flextGLInit(Magnum::GL::Context& context);
/* Function declaration macros */

3
src/MagnumExternal/OpenGL/GL/flextGL.h.template vendored

@ -29,6 +29,7 @@
#include <Corrade/Utility/VisibilityMacros.h>
#include "Magnum/configure.h"
#include "Magnum/GL/GL.h"
/* Defensive include guards */
@ -64,7 +65,7 @@ extern "C" {
#ifndef DOXYGEN_GENERATING_OUTPUT /* So the macro names are preserved in the docs */
void flextGLInit();
void flextGLInit(Magnum::GL::Context& context);
/* Function declaration macros */

2
src/MagnumExternal/OpenGL/GL/flextGLPlatform.cpp vendored

@ -30,7 +30,7 @@
#include "Magnum/Platform/Implementation/OpenGLFunctionLoader.h"
void flextGLInit() {
void flextGLInit(Magnum::GL::Context& context) {
Magnum::Platform::Implementation::OpenGLFunctionLoader loader;
/* GL_ARB_ES3_2_compatibility */

2
src/MagnumExternal/OpenGL/GL/flextGLPlatform.cpp.template vendored

@ -31,7 +31,7 @@
#include "Magnum/Platform/Implementation/OpenGLFunctionLoader.h"
void flextGLInit() {
void flextGLInit(Magnum::GL::Context& context) {
Magnum::Platform::Implementation::OpenGLFunctionLoader loader;
@for category,funcs in functions:
@if funcs and category not in ['VERSION_1_0', 'VERSION_1_1']:

4
src/MagnumExternal/OpenGL/GLES2/Emscripten/flextGLEmscripten.h.template vendored

@ -26,6 +26,8 @@
DEALINGS IN THE SOFTWARE.
*/
#include "Magnum/GL/GL.h"
/* Defensive include guards */
#if defined(__gl2_h_)
@ -46,7 +48,7 @@
extern "C" {
#endif
void flextGLInit();
void flextGLInit(Magnum::GL::Context& context);
/* Function declaration macros */
#define APIENTRY

3
src/MagnumExternal/OpenGL/GLES2/flextGL.h vendored

@ -28,6 +28,7 @@
#include <Corrade/Utility/VisibilityMacros.h>
#include "Magnum/configure.h"
#include "Magnum/GL/GL.h"
/* Defensive include guards */
@ -50,7 +51,7 @@
extern "C" {
#endif
void flextGLInit();
void flextGLInit(Magnum::GL::Context& context);
/* Function declaration macros */

3
src/MagnumExternal/OpenGL/GLES2/flextGL.h.template vendored

@ -29,6 +29,7 @@
#include <Corrade/Utility/VisibilityMacros.h>
#include "Magnum/configure.h"
#include "Magnum/GL/GL.h"
/* Defensive include guards */
@ -51,7 +52,7 @@
extern "C" {
#endif
void flextGLInit();
void flextGLInit(Magnum::GL::Context& context);
/* Function declaration macros */

4
src/MagnumExternal/OpenGL/GLES2/flextGLEmscripten.h vendored

@ -25,6 +25,8 @@
DEALINGS IN THE SOFTWARE.
*/
#include "Magnum/GL/GL.h"
/* Defensive include guards */
#if defined(__gl2_h_)
@ -45,7 +47,7 @@
extern "C" {
#endif
void flextGLInit();
void flextGLInit(Magnum::GL::Context& context);
/* Function declaration macros */
#define APIENTRY

2
src/MagnumExternal/OpenGL/GLES2/flextGLPlatform.cpp vendored

@ -30,7 +30,7 @@
#include "Magnum/Platform/Implementation/OpenGLFunctionLoader.h"
void flextGLInit() {
void flextGLInit(Magnum::GL::Context&) {
Magnum::Platform::Implementation::OpenGLFunctionLoader loader;
/* GL_ANGLE_framebuffer_blit */

2
src/MagnumExternal/OpenGL/GLES2/flextGLPlatform.cpp.template vendored

@ -31,7 +31,7 @@
#include "Magnum/Platform/Implementation/OpenGLFunctionLoader.h"
void flextGLInit() {
void flextGLInit(Magnum::GL::Context&) {
Magnum::Platform::Implementation::OpenGLFunctionLoader loader;
@for category,funcs in functions:
@if funcs and category not in ['ES_VERSION_2_0']:

2
src/MagnumExternal/OpenGL/GLES2/flextGLPlatformIOS.cpp vendored

@ -152,7 +152,7 @@
#include <OpenGLES/ES2/glext.h>
void flextGLInit() {
void flextGLInit(Magnum::GL::Context&) {
/* Work around missing glTexStorage3D (can't be used anyway because GLES2
on iOS doesn't support OES_texture_3D) */
constexpr void(*glTexStorage3DEXT)() = nullptr;

2
src/MagnumExternal/OpenGL/GLES2/flextGLPlatformIOS.cpp.template vendored

@ -36,7 +36,7 @@
#include <OpenGLES/ES2/glext.h>
void flextGLInit() {
void flextGLInit(Magnum::GL::Context&) {
/* Work around missing glTexStorage3D (can't be used anyway because GLES2
on iOS doesn't support OES_texture_3D) */
constexpr void(*glTexStorage3DEXT)() = nullptr;

2
src/MagnumExternal/OpenGL/GLES2/flextGLPlatformWindowsDesktop.cpp vendored

@ -30,7 +30,7 @@
#include "Magnum/Platform/Implementation/OpenGLFunctionLoader.h"
void flextGLInit() {
void flextGLInit(Magnum::GL::Context&) {
Magnum::Platform::Implementation::OpenGLFunctionLoader loader;
/* GL_ANGLE_framebuffer_blit */

2
src/MagnumExternal/OpenGL/GLES2/flextGLPlatformWindowsDesktop.cpp.template vendored

@ -31,7 +31,7 @@
#include "Magnum/Platform/Implementation/OpenGLFunctionLoader.h"
void flextGLInit() {
void flextGLInit(Magnum::GL::Context&) {
Magnum::Platform::Implementation::OpenGLFunctionLoader loader;
@for category,funcs in functions:
@if funcs:

3
src/MagnumExternal/OpenGL/GLES2/flextGLWindowsDesktop.h vendored

@ -28,6 +28,7 @@
#include <Corrade/Utility/VisibilityMacros.h>
#include "Magnum/configure.h"
#include "Magnum/GL/GL.h"
/* Defensive include guards */
@ -50,7 +51,7 @@
extern "C" {
#endif
void flextGLInit();
void flextGLInit(Magnum::GL::Context& context);
/* Function declaration macros */

3
src/MagnumExternal/OpenGL/GLES2/flextGLWindowsDesktop.h.template vendored

@ -29,6 +29,7 @@
#include <Corrade/Utility/VisibilityMacros.h>
#include "Magnum/configure.h"
#include "Magnum/GL/GL.h"
/* Defensive include guards */
@ -51,7 +52,7 @@
extern "C" {
#endif
void flextGLInit();
void flextGLInit(Magnum::GL::Context& context);
/* Function declaration macros */

4
src/MagnumExternal/OpenGL/GLES3/Emscripten/flextGLEmscripten.h.template vendored

@ -26,6 +26,8 @@
DEALINGS IN THE SOFTWARE.
*/
#include "Magnum/GL/GL.h"
/* Defensive include guards */
#if defined(__gl_h_) || defined(__gl2_h_) || defined(__gl3_h_) || defined(__gl31_h_)
@ -51,7 +53,7 @@
extern "C" {
#endif
void flextGLInit();
void flextGLInit(Magnum::GL::Context& context);
/* Function declaration macros */
#define APIENTRY

3
src/MagnumExternal/OpenGL/GLES3/flextGL.h vendored

@ -28,6 +28,7 @@
#include <Corrade/Utility/VisibilityMacros.h>
#include "Magnum/configure.h"
#include "Magnum/GL/GL.h"
/* Defensive include guards */
@ -54,7 +55,7 @@
extern "C" {
#endif
void flextGLInit();
void flextGLInit(Magnum::GL::Context& context);
/* Function declaration macros */

3
src/MagnumExternal/OpenGL/GLES3/flextGL.h.template vendored

@ -29,6 +29,7 @@
#include <Corrade/Utility/VisibilityMacros.h>
#include "Magnum/configure.h"
#include "Magnum/GL/GL.h"
/* Defensive include guards */
@ -55,7 +56,7 @@
extern "C" {
#endif
void flextGLInit();
void flextGLInit(Magnum::GL::Context& context);
/* Function declaration macros */

4
src/MagnumExternal/OpenGL/GLES3/flextGLEmscripten.h vendored

@ -25,6 +25,8 @@
DEALINGS IN THE SOFTWARE.
*/
#include "Magnum/GL/GL.h"
/* Defensive include guards */
#if defined(__gl_h_) || defined(__gl2_h_) || defined(__gl3_h_) || defined(__gl31_h_)
@ -50,7 +52,7 @@
extern "C" {
#endif
void flextGLInit();
void flextGLInit(Magnum::GL::Context& context);
/* Function declaration macros */
#define APIENTRY

2
src/MagnumExternal/OpenGL/GLES3/flextGLPlatform.cpp vendored

@ -30,7 +30,7 @@
#include "Magnum/Platform/Implementation/OpenGLFunctionLoader.h"
void flextGLInit() {
void flextGLInit(Magnum::GL::Context&) {
Magnum::Platform::Implementation::OpenGLFunctionLoader loader;
/* GL_ES_VERSION_3_1 */

2
src/MagnumExternal/OpenGL/GLES3/flextGLPlatform.cpp.template vendored

@ -31,7 +31,7 @@
#include "Magnum/Platform/Implementation/OpenGLFunctionLoader.h"
void flextGLInit() {
void flextGLInit(Magnum::GL::Context&) {
Magnum::Platform::Implementation::OpenGLFunctionLoader loader;
@for category,funcs in functions:
@if funcs and category not in ['ES_VERSION_2_0', 'ES_VERSION_3_0']:

2
src/MagnumExternal/OpenGL/GLES3/flextGLPlatformIOS.cpp vendored

@ -253,7 +253,7 @@
#include <OpenGLES/ES3/glext.h>
void flextGLInit() {
void flextGLInit(Magnum::GL::Context&) {
/* GL_ES_VERSION_3_1 */
#if GL_ES_VERSION_3_1

2
src/MagnumExternal/OpenGL/GLES3/flextGLPlatformIOS.cpp.template vendored

@ -36,7 +36,7 @@
#include <OpenGLES/ES3/glext.h>
void flextGLInit() {
void flextGLInit(Magnum::GL::Context&) {
@for category,funcs in functions:
@if funcs and category not in ['ES_VERSION_2_0', 'ES_VERSION_3_0']:

2
src/MagnumExternal/OpenGL/GLES3/flextGLPlatformWindowsDesktop.cpp vendored

@ -30,7 +30,7 @@
#include "Magnum/Platform/Implementation/OpenGLFunctionLoader.h"
void flextGLInit() {
void flextGLInit(Magnum::GL::Context&) {
Magnum::Platform::Implementation::OpenGLFunctionLoader loader;
/* GL_ES_VERSION_2_0 */

2
src/MagnumExternal/OpenGL/GLES3/flextGLPlatformWindowsDesktop.cpp.template vendored

@ -31,7 +31,7 @@
#include "Magnum/Platform/Implementation/OpenGLFunctionLoader.h"
void flextGLInit() {
void flextGLInit(Magnum::GL::Context&) {
Magnum::Platform::Implementation::OpenGLFunctionLoader loader;
@for category,funcs in functions:
@if funcs:

3
src/MagnumExternal/OpenGL/GLES3/flextGLWindowsDesktop.h vendored

@ -28,6 +28,7 @@
#include <Corrade/Utility/VisibilityMacros.h>
#include "Magnum/configure.h"
#include "Magnum/GL/GL.h"
/* Defensive include guards */
@ -54,7 +55,7 @@
extern "C" {
#endif
void flextGLInit();
void flextGLInit(Magnum::GL::Context& context);
/* Function declaration macros */

3
src/MagnumExternal/OpenGL/GLES3/flextGLWindowsDesktop.h.template vendored

@ -29,6 +29,7 @@
#include <Corrade/Utility/VisibilityMacros.h>
#include "Magnum/configure.h"
#include "Magnum/GL/GL.h"
/* Defensive include guards */
@ -55,7 +56,7 @@
extern "C" {
#endif
void flextGLInit();
void flextGLInit(Magnum::GL::Context& context);
/* Function declaration macros */

Loading…
Cancel
Save