Revision: 58732
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=58732
Author:   jwilkins
Date:     2013-07-29 23:31:46 +0000 (Mon, 29 Jul 2013)
Log Message:
-----------
workaround to get mali es emulator working properly, also, fixed a missing 
texture data format in my revised glaDrawPixelsSafe

Modified Paths:
--------------
    branches/soc-2013-viewport_fx/intern/ghost/intern/GHOST_ContextEGL.cpp
    branches/soc-2013-viewport_fx/source/blender/editors/screen/glutil.c

Modified: branches/soc-2013-viewport_fx/intern/ghost/intern/GHOST_ContextEGL.cpp
===================================================================
--- branches/soc-2013-viewport_fx/intern/ghost/intern/GHOST_ContextEGL.cpp      
2013-07-29 23:27:10 UTC (rev 58731)
+++ branches/soc-2013-viewport_fx/intern/ghost/intern/GHOST_ContextEGL.cpp      
2013-07-29 23:31:46 UTC (rev 58732)
@@ -364,8 +364,18 @@
 
        attrib_list.reserve(20);
 
-       attrib_list.push_back(EGL_RENDERABLE_TYPE);
-       attrib_list.push_back(EGL_OPENGL_ES2_BIT);
+       // The ARM mali ES emulator seems to need this to find a pixel fromat
+       // XXX jwilkins: mali also fails to initialize EGLEW because of a bug 
in eglGetCurrentDisplay(), so using major/minor instead of EGLEW_VERSION
+       if ((major == 1 && minor >= 2 || major > 1) && m_api == 
EGL_OPENGL_ES_API) {
+               if (m_contextClientVersion == 1) {
+                       attrib_list.push_back(EGL_RENDERABLE_TYPE);
+                       attrib_list.push_back(EGL_OPENGL_ES_BIT);
+               }
+               else if ((major == 1 && minor >= 3 || major > 1) && 
m_contextClientVersion == 2) {
+                       attrib_list.push_back(EGL_RENDERABLE_TYPE);
+                       attrib_list.push_back(EGL_OPENGL_ES2_BIT);
+               }
+       }
 
        attrib_list.push_back(EGL_RED_SIZE);
        attrib_list.push_back(8);
@@ -436,6 +446,9 @@
        if (!EGL_CHK(::eglMakeCurrent(m_display, m_surface, m_surface, 
m_context)))
                goto error;
 
+       // XXX jwilkins: do this again here for mali, since 
eglGetCurrentDisplay will now work
+       initContextEGLEW();
+
        initContextGLEW();
 
        return GHOST_kSuccess;

Modified: branches/soc-2013-viewport_fx/source/blender/editors/screen/glutil.c
===================================================================
--- branches/soc-2013-viewport_fx/source/blender/editors/screen/glutil.c        
2013-07-29 23:27:10 UTC (rev 58731)
+++ branches/soc-2013-viewport_fx/source/blender/editors/screen/glutil.c        
2013-07-29 23:31:46 UTC (rev 58732)
@@ -608,12 +608,24 @@
                                                                         // but 
if it still somehow gets passed in here, it should work fine.
                index = (off_y * row_w + off_x) * components;
 
-               if (type == GL_FLOAT) {
-                       data = (GLfloat*)rect + index;
+               switch (type) {
+                       case GL_FLOAT:
+                               data = (GLfloat*)rect + index;
+                               break;
+
+                       case GL_INT: case GL_UNSIGNED_INT:
+                               data = (GLint*)rect + index;
+                               break;
+
+                       case GL_UNSIGNED_BYTE:
+                               data = (GLubyte*)rect + index;
+                               break;
+
+                       default:
+                               GPU_ABORT();
+                               gpuPixelFormat(GL_UNPACK_ROW_LENGTH, 0);
+                               return;
                }
-               else if (type == GL_INT || type == GL_UNSIGNED_INT) {
-                       data = (GLint*)rect + index;
-               }
 
                {
                        GPUpixels pixels = { draw_w, draw_h, format, type, data 
};

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to