src/video/SDL_egl.c
changeset 11676 591e138c5a04
parent 11553 b89649d1a7a5
child 11677 aed6a9ff3c99
equal deleted inserted replaced
11675:18e285e9e1be 11676:591e138c5a04
    42 #endif
    42 #endif
    43 #endif /* EGL_KHR_create_context */
    43 #endif /* EGL_KHR_create_context */
    44 
    44 
    45 #if SDL_VIDEO_DRIVER_RPI
    45 #if SDL_VIDEO_DRIVER_RPI
    46 /* Raspbian places the OpenGL ES/EGL binaries in a non standard path */
    46 /* Raspbian places the OpenGL ES/EGL binaries in a non standard path */
    47 #define DEFAULT_EGL "/opt/vc/lib/libbrcmEGL.so"
    47 #define DEFAULT_EGL ( vc4 ? "libEGL.so.1" : "/opt/vc/lib/libbrcmEGL.so" )
    48 #define DEFAULT_OGL_ES2 "/opt/vc/lib/libbrcmGLESv2.so"
    48 #define DEFAULT_OGL_ES2 ( vc4 ? "libGLESv2.so.2" : "/opt/vc/lib/libbrcmGLESv2.so" )
    49 #define ALT_EGL "/opt/vc/lib/libEGL.so"
    49 #define ALT_EGL "/opt/vc/lib/libEGL.so"
    50 #define ALT_OGL_ES2 "/opt/vc/lib/libGLESv2.so"
    50 #define ALT_OGL_ES2 "/opt/vc/lib/libGLESv2.so"
    51 #define DEFAULT_OGL_ES_PVR "/opt/vc/lib/libGLES_CM.so"
    51 #define DEFAULT_OGL_ES_PVR ( vc4 ? "libGLES_CM.so.1" : "/opt/vc/lib/libbrcmGLESv2.so" )
    52 #define DEFAULT_OGL_ES "/opt/vc/lib/libGLESv1_CM.so"
    52 #define DEFAULT_OGL_ES ( vc4 ? "libGLESv1_CM.so.1" : "/opt/vc/lib/libbrcmGLESv2.so" )
    53 
    53 
    54 #elif SDL_VIDEO_DRIVER_ANDROID || SDL_VIDEO_DRIVER_VIVANTE
    54 #elif SDL_VIDEO_DRIVER_ANDROID || SDL_VIDEO_DRIVER_VIVANTE
    55 /* Android */
    55 /* Android */
    56 #define DEFAULT_EGL "libEGL.so"
    56 #define DEFAULT_EGL "libEGL.so"
    57 #define DEFAULT_OGL_ES2 "libGLESv2.so"
    57 #define DEFAULT_OGL_ES2 "libGLESv2.so"
   254     const char *path = NULL;
   254     const char *path = NULL;
   255     int egl_version_major = 0, egl_version_minor = 0;
   255     int egl_version_major = 0, egl_version_minor = 0;
   256 #if SDL_VIDEO_DRIVER_WINDOWS || SDL_VIDEO_DRIVER_WINRT
   256 #if SDL_VIDEO_DRIVER_WINDOWS || SDL_VIDEO_DRIVER_WINRT
   257     const char *d3dcompiler;
   257     const char *d3dcompiler;
   258 #endif
   258 #endif
       
   259 #if SDL_VIDEO_DRIVER_RPI
       
   260     SDL_bool vc4 = (0 == access("/sys/module/vc4/", F_OK));
       
   261 #endif
   259 
   262 
   260     if (_this->egl_data) {
   263     if (_this->egl_data) {
   261         return SDL_SetError("OpenGL ES context already created");
   264         return SDL_SetError("OpenGL ES context already created");
   262     }
   265     }
   263 
   266 
   293         if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES) {
   296         if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES) {
   294             if (_this->gl_config.major_version > 1) {
   297             if (_this->gl_config.major_version > 1) {
   295                 path = DEFAULT_OGL_ES2;
   298                 path = DEFAULT_OGL_ES2;
   296                 egl_dll_handle = SDL_LoadObject(path);
   299                 egl_dll_handle = SDL_LoadObject(path);
   297 #ifdef ALT_OGL_ES2
   300 #ifdef ALT_OGL_ES2
   298                 if (egl_dll_handle == NULL) {
   301                 if (egl_dll_handle == NULL && !vc4) {
   299                     path = ALT_OGL_ES2;
   302                     path = ALT_OGL_ES2;
   300                     egl_dll_handle = SDL_LoadObject(path);
   303                     egl_dll_handle = SDL_LoadObject(path);
   301                 }
   304                 }
   302 #endif
   305 #endif
   303 
   306 
   306                 egl_dll_handle = SDL_LoadObject(path);
   309                 egl_dll_handle = SDL_LoadObject(path);
   307                 if (egl_dll_handle == NULL) {
   310                 if (egl_dll_handle == NULL) {
   308                     path = DEFAULT_OGL_ES_PVR;
   311                     path = DEFAULT_OGL_ES_PVR;
   309                     egl_dll_handle = SDL_LoadObject(path);
   312                     egl_dll_handle = SDL_LoadObject(path);
   310                 }
   313                 }
       
   314 #ifdef ALT_OGL_ES2
       
   315                 if (egl_dll_handle == NULL && !vc4) {
       
   316                     path = ALT_OGL_ES2;
       
   317                     egl_dll_handle = SDL_LoadObject(path);
       
   318                 }
       
   319 #endif
   311             }
   320             }
   312         }
   321         }
   313 #ifdef DEFAULT_OGL         
   322 #ifdef DEFAULT_OGL         
   314         else {
   323         else {
   315             path = DEFAULT_OGL;
   324             path = DEFAULT_OGL;
   337             path = DEFAULT_EGL;
   346             path = DEFAULT_EGL;
   338         }
   347         }
   339         dll_handle = SDL_LoadObject(path);
   348         dll_handle = SDL_LoadObject(path);
   340 
   349 
   341 #ifdef ALT_EGL
   350 #ifdef ALT_EGL
   342         if (dll_handle == NULL) {
   351         if (dll_handle == NULL && !vc4) {
   343             path = ALT_EGL;
   352             path = ALT_EGL;
   344             dll_handle = SDL_LoadObject(path);
   353             dll_handle = SDL_LoadObject(path);
   345         }
   354         }
   346 #endif
   355 #endif
   347 
   356