Changeset View
Standalone View
intern/ghost/intern/GHOST_ContextEGL.h
| Show All 20 Lines | |||||
| * \ingroup GHOST | * \ingroup GHOST | ||||
| */ | */ | ||||
| #ifndef __GHOST_CONTEXTEGL_H__ | #ifndef __GHOST_CONTEXTEGL_H__ | ||||
| #define __GHOST_CONTEXTEGL_H__ | #define __GHOST_CONTEXTEGL_H__ | ||||
| #include "GHOST_Context.h" | #include "GHOST_Context.h" | ||||
| #include <GL/eglew.h> | #include <GL/glew.h> | ||||
| #include <EGL/egl.h> | |||||
brecht: Is there a specific reason for using `EGL/egl.h` rather than `GL/eglew.h`?
We generally rely… | |||||
christian.rauchAuthorUnsubmitted Done Inline ActionsThis looks a bit out of context. What is really happening here is that eglew is replaced by glew+egl. This also has implications for the use of EGLEW_* macros. There are two reasons for using glew+egl in place of eglew. eglGetDisplay = (PFNEGLGETDISPLAYPROC)eglGetProcAddress("eglGetDisplay");
eglGetCurrentDisplay = (PFNEGLGETCURRENTDISPLAYPROC)eglGetProcAddress("eglGetCurrentDisplay");
eglGetCurrentSurface = (PFNEGLGETCURRENTSURFACEPROC)eglGetProcAddress("eglGetCurrentSurface");
eglGetCurrentContext = (PFNEGLGETCURRENTCONTEXTPROC)eglGetProcAddress("eglGetCurrentContext");
eglInitialize = (PFNEGLINITIALIZEPROC)eglGetProcAddress("eglInitialize");
eglMakeCurrent = (PFNEGLMAKECURRENTPROC)eglGetProcAddress("eglMakeCurrent");
eglChooseConfig = (PFNEGLCHOOSECONFIGPROC)eglGetProcAddress("eglChooseConfig");(source by Julian Eisel's wayland work) Secondly, glew can directly be used from the standard Ubuntu repo, which reduces compile times because the externally provided glew does not need to be compiled. In summary, I rather use glew from the standard Ubuntu repo than having to compile another dependency and manually maintain any PFNEGLCHOOSECONFIGPROC that arise now or later. christian.rauch: This looks a bit out of context. What is really happening here is that eglew is replaced by… | |||||
brechtUnsubmitted Not Done Inline Actions
I see that in the old code, it would first call eglInitialize and then initContextEGLEW containing eglewInit. Then I would indeed expect eglInitialize to be NULL still, but if you call them in the proper order it should work? I'm not sure why else those pointers would be NULL, unless the system actually does not support them or there is a bug in GLEW? Compile time should not affect our design decision here, it's not significant compared to the rest of Blender. By default we use the GLEW bundled in extern/glew, so it shouldn't cause extra manual work when compiling. brecht: > Firstly, with eglew some functions would not be defined (point to NULL) and the context… | |||||
christian.rauchAuthorUnsubmitted Done Inline Actions
Alright, I will give this a try. Out of curiosity, what is the advantage of eglew over plain glew? christian.rauch: > if you call them in the proper order it should work?
Alright, I will give this a try.
Out… | |||||
christian.rauchAuthorUnsubmitted Done Inline ActionsI don't get how this is supposed to work. christian.rauch: I don't get how this is supposed to work.
`eglewInit` needs a display, but a valid display is… | |||||
| #ifndef GHOST_OPENGL_EGL_CONTEXT_FLAGS | #ifndef GHOST_OPENGL_EGL_CONTEXT_FLAGS | ||||
| # define GHOST_OPENGL_EGL_CONTEXT_FLAGS 0 | # define GHOST_OPENGL_EGL_CONTEXT_FLAGS 0 | ||||
| #endif | #endif | ||||
| #ifndef GHOST_OPENGL_EGL_RESET_NOTIFICATION_STRATEGY | #ifndef GHOST_OPENGL_EGL_RESET_NOTIFICATION_STRATEGY | ||||
| # define GHOST_OPENGL_EGL_RESET_NOTIFICATION_STRATEGY 0 | # define GHOST_OPENGL_EGL_RESET_NOTIFICATION_STRATEGY 0 | ||||
| #endif | #endif | ||||
| ▲ Show 20 Lines • Show All 59 Lines • ▼ Show 20 Lines | public: | ||||
| /** | /** | ||||
| * Gets the current swap interval for swapBuffers. | * Gets the current swap interval for swapBuffers. | ||||
| * \param intervalOut Variable to store the swap interval if it can be read. | * \param intervalOut Variable to store the swap interval if it can be read. | ||||
| * \return Whether the swap interval can be read. | * \return Whether the swap interval can be read. | ||||
| */ | */ | ||||
| GHOST_TSuccess getSwapInterval(int &intervalOut); | GHOST_TSuccess getSwapInterval(int &intervalOut); | ||||
| private: | private: | ||||
| void initContextEGLEW(); | void initContextGLEW(); | ||||
| EGLNativeDisplayType m_nativeDisplay; | EGLNativeDisplayType m_nativeDisplay; | ||||
| EGLNativeWindowType m_nativeWindow; | EGLNativeWindowType m_nativeWindow; | ||||
| const EGLint m_contextProfileMask; | const EGLint m_contextProfileMask; | ||||
| const EGLint m_contextMajorVersion; | const EGLint m_contextMajorVersion; | ||||
| const EGLint m_contextMinorVersion; | const EGLint m_contextMinorVersion; | ||||
| const EGLint m_contextFlags; | const EGLint m_contextFlags; | ||||
| Show All 28 Lines | |||||
Is there a specific reason for using EGL/egl.h rather than GL/eglew.h?
We generally rely on GLEW rather than OpenGL system which can be too old, preferably we can do the same for EGL.