[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [58589] branches/soc-2013-viewport_fx: Need to call eglewInit before eglBindAPI.
Jason Wilkins
Jason.A.Wilkins at gmail.com
Thu Jul 25 06:58:32 CEST 2013
Revision: 58589
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=58589
Author: jwilkins
Date: 2013-07-25 04:58:31 +0000 (Thu, 25 Jul 2013)
Log Message:
-----------
Need to call eglewInit before eglBindAPI.
Also fixed other problems with previous commits that I couldn't detect because I couldn't build.
Also, renamed some glScissor and glViewport to gpu versions... not sure why, I'm planning on changing them back...
Modified Paths:
--------------
branches/soc-2013-viewport_fx/extern/glew-es/include/GL/eglew.h
branches/soc-2013-viewport_fx/extern/glew-es/src/glew.c
branches/soc-2013-viewport_fx/intern/ghost/intern/GHOST_WindowWin32.cpp
branches/soc-2013-viewport_fx/intern/ghost/intern/GHOST_WindowWin32.h
branches/soc-2013-viewport_fx/source/blender/editors/interface/interface_draw.c
branches/soc-2013-viewport_fx/source/blender/editors/screen/area.c
branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_extensions.c
branches/soc-2013-viewport_fx/source/blender/windowmanager/intern/wm_init_exit.c
branches/soc-2013-viewport_fx/source/blender/windowmanager/intern/wm_playanim.c
Modified: branches/soc-2013-viewport_fx/extern/glew-es/include/GL/eglew.h
===================================================================
--- branches/soc-2013-viewport_fx/extern/glew-es/include/GL/eglew.h 2013-07-25 01:37:40 UTC (rev 58588)
+++ branches/soc-2013-viewport_fx/extern/glew-es/include/GL/eglew.h 2013-07-25 04:58:31 UTC (rev 58589)
@@ -1366,6 +1366,9 @@
#define EGLEW_GET_VAR(x) (*(const GLboolean*)&x)
#define EGLEW_GET_FUN(x) x
+extern GLenum eglewContextInit (void); // XXX jwilkins: context handling not really written yet?
+#define eglewInit eglewContextInit // XXX jwilkins: context handling not really written yet?
+
extern GLboolean eglewIsSupported (const char* name);
#endif /* GLEW_MX */
Modified: branches/soc-2013-viewport_fx/extern/glew-es/src/glew.c
===================================================================
--- branches/soc-2013-viewport_fx/extern/glew-es/src/glew.c 2013-07-25 01:37:40 UTC (rev 58588)
+++ branches/soc-2013-viewport_fx/extern/glew-es/src/glew.c 2013-07-25 04:58:31 UTC (rev 58589)
@@ -246,22 +246,35 @@
# define glewGetProcAddress(name) esGetProcAddress(name)
#else
#if defined(_WIN32)
- static HMODULE hLibGLES = NULL;
+ static HMODULE hLibEGL = NULL;
+ static HMODULE hLibGLESv2 = NULL;
- void* weGetProcAddress(const GLubyte* name) // XXX jwilkins
+ void* weGetProcAddress(const char* name) // XXX jwilkins
{
void* proc = eglGetProcAddress(name);
- if(proc == NULL && hLibGLES == NULL) {
- hLibGLES = LoadLibrary("libGLESv2.dll");
- }
+ if (proc != NULL)
+ return proc;
- if(proc == NULL && hLibGLES != NULL) {
- return GetProcAddress(hLibGLES, name);
- }
- else {
+ if (hLibEGL == NULL)
+ hLibEGL = LoadLibrary("libEGL.dll");
+
+ if (hLibEGL != NULL)
+ proc = GetProcAddress(hLibEGL, name);
+
+ if (proc != NULL)
return proc;
- }
+
+ if (hLibGLESv2 == NULL)
+ hLibGLESv2 = LoadLibrary("libGLESv2.dll");
+
+ if (hLibGLESv2 != NULL)
+ proc = GetProcAddress(hLibGLESv2, name);
+
+ if (proc != NULL)
+ return proc;
+
+ return NULL;
}
# define glewGetProcAddress(name) weGetProcAddress(name)
@@ -272,15 +285,15 @@
#elif defined(_WIN32)
static HMODULE hOpenGL = NULL;
- void* wGetProcAddress(const GLubyte* name) // XXX jwilkins
+ void* wGetProcAddress(const char* name) // XXX jwilkins
{
void* proc = wglGetProcAddress(name);
- if(proc == NULL && hOpenGL == NULL) {
+ if (proc == NULL && hOpenGL == NULL) {
hOpenGL = LoadLibrary("opengl32.dll");
}
- if(proc == NULL && hOpenGL != NULL) {
+ if (proc == NULL && hOpenGL != NULL) {
return GetProcAddress(hOpenGL, name);
}
else {
Modified: branches/soc-2013-viewport_fx/intern/ghost/intern/GHOST_WindowWin32.cpp
===================================================================
--- branches/soc-2013-viewport_fx/intern/ghost/intern/GHOST_WindowWin32.cpp 2013-07-25 01:37:40 UTC (rev 58588)
+++ branches/soc-2013-viewport_fx/intern/ghost/intern/GHOST_WindowWin32.cpp 2013-07-25 04:58:31 UTC (rev 58589)
@@ -98,8 +98,9 @@
EGLContext GHOST_WindowWin32::s_egl_first_context = EGL_NO_CONTEXT;
-#if defined(ANGLE)
-EGLContext GHOST_WindowWin32::s_d3dcompiler = NULL;
+#if defined(WITH_ANGLE)
+HMODULE GHOST_WindowWin32::s_d3dcompiler = NULL;
+bool GHOST_WindowWin32::s_eglew_initialized = false;
#endif
#endif
@@ -142,6 +143,10 @@
m_hDC(0),
#if defined(WITH_GL_SYSTEM_DESKTOP) || defined(WITH_GL_SYSTEM_LEGACY)
m_hGlRc(0),
+#elif defined(WITH_GL_SYSTEM_EMBEDDED)
+ m_egl_display(EGL_NO_DISPLAY),
+ m_egl_context(EGL_NO_CONTEXT),
+ m_egl_surface(EGL_NO_SURFACE),
#endif
m_hasMouseCaptured(false),
m_hasGrabMouse(false),
@@ -1021,14 +1026,27 @@
if (!::eglInitialize(m_egl_display, &major, &minor))
break;
+ printf("EGL v%d.%d\n", major, minor);
+
+ if (!::eglMakeCurrent(m_egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT))
+ break;
+
+ if (!s_eglew_initialized) {
+ if (eglewInit() == GLEW_OK) {
+ s_eglew_initialized = true;
+ }
+ else {
+ break;
+ }
+ }
+
#if defined(WITH_GL_PROFILE_ES20)
eglBindAPI(EGL_OPENGL_ES_API);
#endif
- printf("EGL v%d.%d\n", major, minor);
+ std::vector<EGLint> attrib_list;
+ attrib_list.reserve(20);
- std::vector<EGLint> attrib_list(20);
-
attrib_list.push_back(EGL_RED_SIZE);
attrib_list.push_back(8);
@@ -1060,7 +1078,7 @@
attrib_list.push_back(EGL_NONE);
EGLConfig config;
- EGLint num_config;
+ EGLint num_config = 0;
if (!::eglChooseConfig(m_egl_display, &(attrib_list[0]), &config, 1, &num_config))
break;
@@ -1105,11 +1123,6 @@
success = GHOST_kFailure;
}
-#if defined(WITH_GL_SYSTEM_EMBEDDED)
- if (success = GHOST_kFailure) {
- }
-#endif
-
return success;
}
@@ -1146,6 +1159,9 @@
if (m_egl_surface != EGL_NO_SURFACE) {
surface_destroyed = ::eglDestroySurface(m_egl_display, m_egl_surface);
}
+ else {
+ surface_destroyed = EGL_FALSE;
+ }
m_egl_surface = EGL_NO_SURFACE;
Modified: branches/soc-2013-viewport_fx/intern/ghost/intern/GHOST_WindowWin32.h
===================================================================
--- branches/soc-2013-viewport_fx/intern/ghost/intern/GHOST_WindowWin32.h 2013-07-25 01:37:40 UTC (rev 58588)
+++ branches/soc-2013-viewport_fx/intern/ghost/intern/GHOST_WindowWin32.h 2013-07-25 04:58:31 UTC (rev 58589)
@@ -366,6 +366,8 @@
#endif
static EGLContext s_egl_first_context;
+
+ static bool s_eglew_initialized;
#endif
/** Flag for if window has captured the mouse */
bool m_hasMouseCaptured;
Modified: branches/soc-2013-viewport_fx/source/blender/editors/interface/interface_draw.c
===================================================================
--- branches/soc-2013-viewport_fx/source/blender/editors/interface/interface_draw.c 2013-07-25 01:37:40 UTC (rev 58588)
+++ branches/soc-2013-viewport_fx/source/blender/editors/interface/interface_draw.c 2013-07-25 04:58:31 UTC (rev 58589)
@@ -1589,7 +1589,7 @@
scissor_new.xmax = ar->winrct.xmin + recti->xmax;
scissor_new.ymax = ar->winrct.ymin + recti->ymax;
BLI_rcti_isect(&scissor_new, &ar->winrct, &scissor_new);
- glScissor(scissor_new.xmin,
+ gpuScissor(scissor_new.xmin,
scissor_new.ymin,
BLI_rcti_size_x(&scissor_new),
BLI_rcti_size_y(&scissor_new));
@@ -1618,7 +1618,7 @@
glLineWidth(1.0f);
/* restore scissortest */
- glScissor(scissor[0], scissor[1], scissor[2], scissor[3]);
+ gpuScissor(scissor[0], scissor[1], scissor[2], scissor[3]);
gpuImmediateUnformat();
}
Modified: branches/soc-2013-viewport_fx/source/blender/editors/screen/area.c
===================================================================
--- branches/soc-2013-viewport_fx/source/blender/editors/screen/area.c 2013-07-25 01:37:40 UTC (rev 58588)
+++ branches/soc-2013-viewport_fx/source/blender/editors/screen/area.c 2013-07-25 04:58:31 UTC (rev 58589)
@@ -1835,7 +1835,7 @@
/* setup scissor */
glGetIntegerv(GL_SCISSOR_BOX, scissor);
- glScissor(ar->winrct.xmin + rect.xmin, ar->winrct.ymin + rect.ymin,
+ gpuScissor(ar->winrct.xmin + rect.xmin, ar->winrct.ymin + rect.ymin,
BLI_rcti_size_x(&rect) + 1, BLI_rcti_size_y(&rect) + 1);
glEnable(GL_BLEND);
@@ -1854,7 +1854,7 @@
BLF_disable(fontid, BLF_CLIPPING);
/* restore scissor as it was before */
- glScissor(scissor[0], scissor[1], scissor[2], scissor[3]);
+ gpuScissor(scissor[0], scissor[1], scissor[2], scissor[3]);
}
void ED_region_grid_draw(ARegion *ar, float zoomx, float zoomy)
Modified: branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_extensions.c
===================================================================
--- branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_extensions.c 2013-07-25 01:37:40 UTC (rev 58588)
+++ branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_extensions.c 2013-07-25 04:58:31 UTC (rev 58589)
@@ -179,7 +179,6 @@
glewInit();
GPU_wrap_extensions(&(GG.glslsupport), &(GG.framebuffersupport));
- gpuInitializeViewFuncs();
GPU_codegen_init();
GG.maxtextures = get_max_textures();
@@ -1066,7 +1065,7 @@
/* push matrices and set default viewport and matrix */
glGetIntegerv(GL_VIEWPORT, save_viewport);
- glViewport(0, 0, w, h);
+ gpuViewport(0, 0, w, h);
GG.currentfb = tex->fb->object;
gpuMatrixMode(GL_PROJECTION);
@@ -1086,7 +1085,7 @@
gpuPopMatrix();
/* restore attributes */
- glViewport(save_viewport[0], save_viewport[1], save_viewport[2], save_viewport[3]);
+ gpuViewport(save_viewport[0], save_viewport[1], save_viewport[2], save_viewport[3]);
glEnable(GL_SCISSOR_TEST);
}
Modified: branches/soc-2013-viewport_fx/source/blender/windowmanager/intern/wm_init_exit.c
===================================================================
--- branches/soc-2013-viewport_fx/source/blender/windowmanager/intern/wm_init_exit.c 2013-07-25 01:37:40 UTC (rev 58588)
+++ branches/soc-2013-viewport_fx/source/blender/windowmanager/intern/wm_init_exit.c 2013-07-25 04:58:31 UTC (rev 58589)
@@ -144,6 +144,7 @@
gpuInitializeLighting(); // XXX jwilkins: sort out this initialization order
GPU_ms_init();
GPU_init_object_func();
+ gpuInitializeViewFuncs();
}
GHOST_CreateSystemPaths();
Modified: branches/soc-2013-viewport_fx/source/blender/windowmanager/intern/wm_playanim.c
===================================================================
--- branches/soc-2013-viewport_fx/source/blender/windowmanager/intern/wm_playanim.c 2013-07-25 01:37:40 UTC (rev 58588)
+++ branches/soc-2013-viewport_fx/source/blender/windowmanager/intern/wm_playanim.c 2013-07-25 04:58:31 UTC (rev 58589)
@@ -750,8 +750,8 @@
ps->zoom = floor(ps->zoom + 0.5f);
if (ps->zoom < 1.0f) ps->zoom = 1.0f;
- glViewport(0, 0, ps->win_x, ps->win_y);
- glScissor(0, 0, ps->win_x, ps->win_y);
+ gpuViewport(0, 0, ps->win_x, ps->win_y);
+ gpuScissor(0, 0, ps->win_x, ps->win_y);
/* unified matrix, note it affects offset for drawing */
gpuMatrixMode(GL_PROJECTION);
More information about the Bf-blender-cvs
mailing list