VirtualBox

Changeset 76248 in vbox for trunk


Ignore:
Timestamp:
Dec 16, 2018 2:12:32 AM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
127518
Message:

DevVGA-SVGA3d: update for dynamic loading of OpenGL

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-glLdr.cpp

    r76247 r76248  
    8181
    8282#else
    83 // # define OGLGETPROCADDRESS(x)   glXGetProcAddress((const GLubyte *)x)
    8483# define OGLGETPROCADDRESS MyGLXGetProcAddress
    8584static void *MyGLXGetProcAddress(const char *pszSymbol)
     
    9089    if (s_hGL == NULL)
    9190    {
    92         rc = RTLdrLoadSystem("libGL.so", /* fNoUnload = */ true, &s_hGL);
     91        static const char s_szLibGL[] = "libGL.so.1";
     92        rc = RTLdrLoadEx(s_szLibGL, &s_hGL, RTLDRLOAD_FLAGS_GLOBAL | RTLDRLOAD_FLAGS_NO_UNLOAD, NULL);
    9393        if (RT_FAILURE(rc))
    94            s_hGL = NULL;
    95     }
    96 
    97     typedef void(*)() (* PFNGLXGETPROCADDRESS)(const GLubyte * procName);
     94        {
     95            LogRel(("VMSVGA3d: failed to load %s: %Rrc\n", s_szLibGL, rc));
     96            s_hGL = NULL;
     97            return NULL;
     98        }
     99    }
     100
     101    typedef void * (* PFNGLXGETPROCADDRESS)(const GLubyte * procName);
    98102    static PFNGLXGETPROCADDRESS s_glXGetProcAddress = NULL;
    99103    if (s_glXGetProcAddress == NULL)
    100104    {
    101         if (s_hGL != NULL)
     105        rc = RTLdrGetSymbol(s_hGL, "glXGetProcAddress", (void **)&s_glXGetProcAddress);
     106        if (RT_FAILURE(rc))
    102107        {
    103             rc = RTLdrGetSymbol(s_hGL, "glXGetProcAddress", (void **)&s_glXGetProcAddress);
    104             if (RT_FAILURE(rc))
    105                s_glXGetProcAddress = NULL;
     108            LogRel(("VMSVGA3d: failed to get glXGetProcAddress: %Rrc\n", rc));
     109            s_glXGetProcAddress = NULL;
     110            return NULL;
    106111        }
    107112    }
    108113
    109     if (s_glXGetProcAddress)
    110     {
    111         void *p = glXGetProcAddress((const GLubyte *)pszSymbol);
    112         if (RT_VALID_PTR(p))
    113             return p;
    114 
    115         /* Might be an exported symbol. */
    116         rc = RTLdrGetSymbol(s_hGL, pszSymbol, (void **)&p);
    117         if (RT_SUCCESS(rc))
    118             return p;
    119     }
    120 
    121     return 0;
     114    void *p = s_glXGetProcAddress((const GLubyte *)pszSymbol);
     115    if (RT_VALID_PTR(p))
     116        return p;
     117
     118    /* Might be an exported symbol. */
     119    rc = RTLdrGetSymbol(s_hGL, pszSymbol, (void **)&p);
     120    if (RT_SUCCESS(rc))
     121        return p;
     122
     123    return NULL;
    122124}
    123125#endif
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette