VirtualBox

Changeset 76255 in vbox for trunk/src/VBox/Devices


Ignore:
Timestamp:
Dec 16, 2018 6:47:05 PM (6 years ago)
Author:
vboxsync
Message:

DevVGA-SVGA3d: Use PDMDevHlpVMSetError and VERR_VGA_GL_SYMBOL_NOT_FOUND to report errors loading open gl symbol resolving errors. Tested on windows. Left todo (mainly to myself) about better libGL.so/opengl32.dll/OpenGL.dylib loading error reporting, since that'll show up as failure to resolve 'glAlphaFunc' now.

Location:
trunk/src/VBox/Devices/Graphics
Files:
4 edited

Legend:

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

    r76254 r76255  
    1919#include "DevVGA-SVGA3d-glLdr.h"
    2020
     21#include <VBox/vmm/pdmdev.h>
     22#include <VBox/err.h>
    2123#include <iprt/assert.h>
    2224#include <iprt/cdefs.h>
    23 #include <iprt/err.h>
    2425#include <iprt/ldr.h>
    2526#include <iprt/log.h>
     
    126127
    127128#define GLGETPROC_(ProcName, NameSuffix) do { \
    128     *(PFNRT *)&pfn_##ProcName = OGLGETPROCADDRESS(#ProcName NameSuffix); \
    129     AssertLogRelMsgReturn(pfn_##ProcName, ("%s missing\n", #ProcName NameSuffix), VERR_NOT_IMPLEMENTED); \
     129    *(PFNRT *)&pfn_##ProcName = pfnRet = OGLGETPROCADDRESS(#ProcName NameSuffix); \
     130    if (pfnRet) { /* likely */ } \
     131    else \
     132    { \
     133        AssertLogRelMsg(pfnRet, ("%s missing\n", #ProcName NameSuffix)); \
     134        return PDMDevHlpVMSetError(pDevIns, VERR_VGA_GL_SYMBOL_NOT_FOUND, RT_SRC_POS, \
     135                                   "Missing OpenGL symbol '%s'\n", #ProcName NameSuffix); \
     136    } \
    130137} while(0)
    131138
    132 int glLdrInit(void)
    133 {
     139int glLdrInit(PPDMDEVINS pDevIns)
     140{
     141    /** @todo r=bird: Perhaps make this template include file driven? See
     142     * include/VBox/dbus.h, include/VBox/dbus-calls.h and iprt/runtime-loader.h for
     143     * instance.  Regardless, it would be would be nice if we could move up the
     144     * RTLdrLoadSystem/dlopen bits and have separate error reporting for those,
     145     * making use of VERR_VGA_GL_LOAD_FAILURE.  I can look into that, but
     146     * probably only after the release is out... */
     147
    134148    pfn_glAlphaFunc = 0;
    135149    pfn_glBindTexture = 0;
     
    211225#endif
    212226
     227    PFNRT pfnRet;
    213228    GLGETPROC_(glAlphaFunc, "");
    214229    GLGETPROC_(glBindTexture, "");
     
    294309}
    295310
    296 int glLdrGetExtFunctions(void)
    297 {
     311int glLdrGetExtFunctions(PPDMDEVINS pDevIns)
     312{
     313    PFNRT pfnRet;
    298314    GLGETPROC_(glBlendColor, "");
    299315    GLGETPROC_(glBlendEquation, "");
  • trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-glLdr.h

    r76253 r76255  
    2323#endif
    2424
    25 #include <iprt/types.h>
     25#include <VBox/types.h>
    2626
    2727/** @todo VBOX_VMSVGA3D_GL_HACK_LEVEL is not necessary when dynamic loading is used. */
     
    7878#endif
    7979
    80 /* Load OpenGL library and initialize function pointers. */
    81 int glLdrInit(void);
    82 /* Resolve an OpenGL function name. */
     80/** Load OpenGL library and initialize function pointers. */
     81int glLdrInit(PPDMDEVINS pDevIns);
     82/** Resolve an OpenGL function name. */
    8383PFNRT glLdrGetProcAddress(const char *pszSymbol);
    84 /* Get pointers to extension function. They are available on Windows only when OpenGL context is set. */
    85 int glLdrGetExtFunctions(void);
     84/** Get pointers to extension function. They are available on Windows only when OpenGL context is set. */
     85int glLdrGetExtFunctions(PPDMDEVINS pDevIns);
    8686
    8787/*
  • trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-internal.h

    r76246 r76255  
    4040
    4141#if defined(VMSVGA3D_DYNAMIC_LOAD) && defined(VMSVGA3D_OPENGL)
    42 #include "DevVGA-SVGA3d-glLdr.h"
     42# include "DevVGA-SVGA3d-glLdr.h"
    4343#endif
    4444
  • trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-ogl.cpp

    r76253 r76255  
    592592
    593593#ifdef VMSVGA3D_DYNAMIC_LOAD
    594     rc = glLdrInit();
     594    rc = glLdrInit(pThis->pDevInsR3);
    595595    if (RT_FAILURE(rc))
    596596    {
     
    812812#ifdef VMSVGA3D_DYNAMIC_LOAD
    813813    /* Context is set and it is possible now to resolve extension functions. */
    814     rc = glLdrGetExtFunctions();
     814    rc = glLdrGetExtFunctions(pThis->pDevInsR3);
    815815    if (RT_FAILURE(rc))
    816816    {
Note: See TracChangeset for help on using the changeset viewer.

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