VirtualBox

Changeset 53755 in vbox for trunk/src/VBox/Devices/Graphics


Ignore:
Timestamp:
Jan 6, 2015 9:06:53 PM (10 years ago)
Author:
vboxsync
Message:

VMSVGA3d: Cleaning up some of the dual-profile mess, switched back to using the 2.1 profile by default.

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

Legend:

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

    r53751 r53755  
    25792579                        SVGA3dCmdDefineContext *pCmd = (SVGA3dCmdDefineContext *)(pHdr + 1);
    25802580
    2581                         rc = vmsvga3dContextDefine(pThis, pCmd->cid, false /*fLegacy*/);
     2581                        rc = vmsvga3dContextDefine(pThis, pCmd->cid, false /*fOtherProfile*/);
    25822582                        break;
    25832583                    }
  • trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-cocoa.h

    r53749 r53755  
    3535#endif
    3636
    37 VMSVGA3D_DECL(void) vmsvga3dCocoaCreateContext(NativeNSOpenGLContextRef *ppCtx, NativeNSOpenGLContextRef pSharedCtx, bool fLegacy);
     37VMSVGA3D_DECL(void) vmsvga3dCocoaCreateContext(NativeNSOpenGLContextRef *ppCtx, NativeNSOpenGLContextRef pSharedCtx,
     38                                               bool fOtherProfile);
    3839VMSVGA3D_DECL(void) vmsvga3dCocoaDestroyContext(NativeNSOpenGLContextRef pCtx);
    3940VMSVGA3D_DECL(void) vmsvga3dCocoaCreateView(NativeNSViewRef *ppView, NativeNSViewRef pParentView);
  • trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-cocoa.m

    r53749 r53755  
    623623
    624624
    625 void vmsvga3dCocoaCreateContext(NativeNSOpenGLContextRef *ppCtx, NativeNSOpenGLContextRef pShareCtx, bool fLegacy)
     625void vmsvga3dCocoaCreateContext(NativeNSOpenGLContextRef *ppCtx, NativeNSOpenGLContextRef pShareCtx, bool fOtherProfile)
    626626{
    627627    DEBUG_FUNC_ENTER();
  • trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-ogl.cpp

    r53750 r53755  
    8888#include <float.h>
    8989
    90 #ifdef VBOX_VMSVGA3D_USE_OPENGL_CORE
    91 # define VBOX_D3D9CAPS_ONLY_DEFINES
    92 # include "shaderlib/wine/include/d3d9caps.h" /* For some capability constants. */
    93 #endif
    94 
    9590
    9691/* Generated by VBoxDef2LazyLoad from the VBoxSVGA3D.def and VBoxSVGA3DObjC.def files. */
     
    10499*   Defined Constants And Macros                                               *
    105100*******************************************************************************/
     101#ifndef VBOX_VMSVGA3D_DEFAULT_OGL_PROFILE
     102# define VBOX_VMSVGA3D_DEFAULT_OGL_PROFILE 1.0
     103#endif
     104
    106105#ifdef RT_OS_WINDOWS
    107106# define OGLGETPROCADDRESS      wglGetProcAddress
     
    215214
    216215/**
    217  * Macro wrapping glGetIntegerv for use during initialization.
    218  * Uses AssertLogRelMsg.
    219  */
    220 #define VMSVGA3D_INIT_CHECKED_GL_GET_INTEGER_VALUE(a_enmGlValue, a_pDest) \
    221     do \
    222     { \
    223         glGetIntegerv(a_enmGlValue, a_pDest); \
    224         GLenum iGlError = glGetError(); \
    225         AssertLogRelMsg(iGlError == GL_NO_ERROR, \
    226                         ("VMSVGA3d: glGetIntegerv(" #a_enmGlValue " (%#x),) -> %#x\n", (int)a_enmGlValue, iGlError)); \
    227     } while (0)
    228 
    229 /**
    230216 * Macro for doing something and then checking for errors during initialization.
    231217 * Uses AssertLogRelMsg.
     
    238224        AssertLogRelMsg(iGlError == GL_NO_ERROR, ("VMSVGA3d: %s -> %#x\n", #a_Expr, iGlError)); \
    239225    } while (0)
     226
     227/**
     228 * Macro for doing something and then checking for errors during initialization,
     229 * doing the same in the other context when enabled.
     230 *
     231 * This will try both profiles in dual profile builds.  Caller must be in the
     232 * default context.
     233 *
     234 * Uses AssertLogRelMsg to indicate trouble.
     235 */
     236#ifdef VBOX_VMSVGA3D_DUAL_OPENGL_PROFILE
     237# define VMSVGA3D_INIT_CHECKED_BOTH(a_pState, a_pContext, a_pOtherCtx, a_Expr) \
     238    do \
     239    { \
     240        for (uint32_t i = 0; i < 64; i++) if (glGetError() == GL_NO_ERROR) break; Assert(glGetError() == GL_NO_ERROR); \
     241        a_Expr; \
     242        GLenum iGlError = glGetError(); \
     243        if (iGlError != GL_NO_ERROR) \
     244        { \
     245            VMSVGA3D_SET_CURRENT_CONTEXT(a_pState, a_pOtherCtx); \
     246            for (uint32_t i = 0; i < 64; i++) if (glGetError() == GL_NO_ERROR) break; Assert(glGetError() == GL_NO_ERROR); \
     247            a_Expr; \
     248            GLenum iGlError2 = glGetError(); \
     249            AssertLogRelMsg(iGlError2 == GL_NO_ERROR, ("VMSVGA3d: %s -> %#x / %#x\n", #a_Expr, iGlError, iGlError2)); \
     250            VMSVGA3D_SET_CURRENT_CONTEXT(a_pState, a_pContext); \
     251        } \
     252    } while (0)
     253#else
     254# define VMSVGA3D_INIT_CHECKED_BOTH(a_pState, a_pContext, a_pOtherCtx, a_Expr) VMSVGA3D_INIT_CHECKED(a_Expr)
     255#endif
    240256
    241257
     
    406422    NativeNSOpenGLContextRef cocoaContext;
    407423    NativeNSViewRef          cocoaView;
    408     bool                    fLegacy;
     424    bool                    fOtherProfile;
    409425#else
    410426    /** XGL rendering context handle */
     
    604620    uint32_t                idTestContext;
    605621#endif
    606     /** Legacy OpenGL profile GL_EXTENSIONS result (RTStrDup).
     622    /** The GL_EXTENSIONS value (space padded) for the default OpenGL profile.
     623     * Free with RTStrFree. */
     624    R3PTRTYPE(char *)       pszExtensions;
     625
     626    /** The GL_EXTENSIONS value (space padded) for the other OpenGL profile.
     627     * Free with RTStrFree.
     628     *
    607629     * This is used to detect shader model version since some implementations
    608630     * (darwin) hides extensions that have made it into core and probably a
    609631     * bunch of others when using a OpenGL core profile instead of a legacy one */
    610     R3PTRTYPE(char *)       pszLegacyExtensions;
     632    R3PTRTYPE(char *)       pszOtherExtensions;
     633    /** The version of the other GL profile. */
     634    float                   fOtherGLVersion;
     635
     636    /** Shader talk back interface. */
     637    VBOXVMSVGASHADERIF      ShaderIf;
    611638} VMSVGA3DSTATE;
    612639/** Pointer to the VMSVGA3d state. */
     
    670697 *
    671698 * @returns true if supported, false if not.
     699 * @param   pState              The VMSVGA3d state.
    672700 * @param   fActualGLVersion    The actual OpenGL version we're working against.
    673701 * @param   fMinGLVersion       The OpenGL version that introduced this feature
    674702 *                              into the core.
    675  * @param   pszWantedExtension  The name of the OpenGL extension we want.
     703 * @param   pszWantedExtension  The name of the OpenGL extension we want padded
     704 *                              with one space at each end.
    676705 * @remarks Init time only.
    677706 */
    678 static bool vmsvga3dCheckGLExtension(float fActualGLVersion, float fMinGLVersion, const char *pszWantedExtension)
    679 {
     707static bool vmsvga3dCheckGLExtension(PVMSVGA3DSTATE pState, float fMinGLVersion, const char *pszWantedExtension)
     708{
     709    /* check padding. */
     710    Assert(pszWantedExtension[0] == ' ');
     711    Assert(pszWantedExtension[1] != ' ');
     712    Assert(strchr(&pszWantedExtension[1], ' ') + 1 == strchr(pszWantedExtension, '\0'));
     713
     714    /* Look it up. */
    680715    bool fRet = false;
    681 
    682 #ifdef VBOX_VMSVGA3D_USE_OPENGL_CORE
    683     /*
    684      * OpenGL 3.2+ core profile (glGetString(GL_EXTENSIONS) returns NULL).
    685      * It also avoids listing extensions that have been promoted into the core.
    686      */
    687 
    688     /* Seems like extensions are assimilated into the OpenGL core, so we do
    689        hardcoded checks for these as per gl3.h. */
    690     if (0) { /*nothing*/ }
    691     else if (   fActualGLVersion >= 2.0
    692              && (   strcmp(pszWantedExtension, "GL_ARB_draw_buffers") == 0
    693                  || strcmp(pszWantedExtension, "GL_ARB_shader_objects") == 0 /*??*/
    694                  || strcmp(pszWantedExtension, "GL_ARB_vertex_shader") == 0 /*??*/
    695                  || strcmp(pszWantedExtension, "GL_ARB_fragment_shader") == 0 /*??*/
    696                  || strcmp(pszWantedExtension, "GL_ARB_shading_language_100") == 0 /*??*/
    697                  || strcmp(pszWantedExtension, "GL_ARB_texture_non_power_of_two") == 0
    698                  || strcmp(pszWantedExtension, "GL_ARB_point_sprite") == 0
    699                  || strcmp(pszWantedExtension, "GL_ATI_separate_stencil") == 0
    700                  || strcmp(pszWantedExtension, "GL_EXT_stencil_two_side") == 0) )
     716    if (strstr(pState->pszExtensions, pszWantedExtension))
    701717        fRet = true;
    702     else if (   fActualGLVersion >= 2.1
    703              && (   strcmp(pszWantedExtension, "GL_EXT_texture_sRGB") == 0
    704                  || strcmp(pszWantedExtension, "GL_ARB_pixel_buffer_object") == 0) )
    705         fRet = true;
    706     else if (   fActualGLVersion >= 3.0
    707              && (   strcmp(pszWantedExtension, "GL_ARB_framebuffer_object") == 0
    708                  || strcmp(pszWantedExtension, "GL_ARB_map_buffer_range") == 0
    709                  || strcmp(pszWantedExtension, "GL_ARB_vertex_array_object") == 0) )
    710         fRet = true;
    711     else if (   fActualGLVersion >= 3.1
    712              && (   strcmp(pszWantedExtension, "GL_ARB_copy_buffer") == 0
    713                  || strcmp(pszWantedExtension, "GL_ARB_uniform_buffer_object") == 0
    714                  || strcmp(pszWantedExtension, "GL_ARB_vertex_array_object") == 0) )
    715         fRet = true;
    716     else if (   fActualGLVersion >= 3.2
    717              && (   strcmp(pszWantedExtension, "GL_ARB_draw_elements_base_vertex") == 0
    718                  || strcmp(pszWantedExtension, "GL_ARB_vertex_array_bgra") == 0
    719                  || strcmp(pszWantedExtension, "GL_ARB_provoking_vertex") == 0
    720                  || strcmp(pszWantedExtension, "GL_ARB_seamless_cube_map") == 0
    721                  || strcmp(pszWantedExtension, "GL_ARB_fragment_coord_conventions") == 0
    722                  || strcmp(pszWantedExtension, "GL_ARB_depth_clamp") == 0
    723                  || strcmp(pszWantedExtension, "GL_ARB_sync") == 0
    724                  || strcmp(pszWantedExtension, "GL_ARB_texture_multisample") == 0) )
    725         fRet = true;
    726     else if (   fActualGLVersion >= 3.3
    727              && (   strcmp(pszWantedExtension, "GL_ARB_blend_func_extended") == 0
    728                  || strcmp(pszWantedExtension, "GL_ARB_sampler_objects") == 0
    729                  || strcmp(pszWantedExtension, "GL_ARB_explicit_attrib_location") == 0
    730                  || strcmp(pszWantedExtension, "GL_ARB_occlusion_query2") == 0
    731                  || strcmp(pszWantedExtension, "GL_ARB_shader_bit_encoding") == 0
    732                  || strcmp(pszWantedExtension, "GL_ARB_texture_rgb10_a2ui") == 0
    733                  || strcmp(pszWantedExtension, "GL_ARB_texture_swizzle") == 0
    734                  || strcmp(pszWantedExtension, "GL_ARB_timer_query") == 0
    735                  || strcmp(pszWantedExtension, "GL_ARB_vertex_type_2_10_10_10_rev") == 0) )
    736         fRet = true;
    737     else if (   fActualGLVersion >= 4.0
    738              && (   strcmp(pszWantedExtension, "GL_ARB_texture_query_lod") == 0
    739                  || strcmp(pszWantedExtension, "GL_ARB_draw_indirect") == 0
    740                  || strcmp(pszWantedExtension, "GL_ARB_gpu_shader5") == 0
    741                  || strcmp(pszWantedExtension, "GL_ARB_gpu_shader_fp64") == 0
    742                  || strcmp(pszWantedExtension, "GL_ARB_shader_subroutine") == 0
    743                  || strcmp(pszWantedExtension, "GL_ARB_tessellation_shader") == 0
    744                  || strcmp(pszWantedExtension, "GL_ARB_texture_buffer_object_rgb32") == 0
    745                  || strcmp(pszWantedExtension, "GL_ARB_texture_cube_map_array") == 0
    746                  || strcmp(pszWantedExtension, "GL_ARB_texture_gather") == 0
    747                  || strcmp(pszWantedExtension, "GL_ARB_transform_feedback2") == 0
    748                  || strcmp(pszWantedExtension, "GL_ARB_transform_feedback3") == 0) )
    749         fRet = true;
    750     else if (   fActualGLVersion >= 4.1
    751              && (   strcmp(pszWantedExtension, "GL_ARB_ES2_compatibility") == 0
    752                  || strcmp(pszWantedExtension, "GL_ARB_get_program_binary") == 0
    753                  || strcmp(pszWantedExtension, "GL_ARB_separate_shader_objects") == 0
    754                  || strcmp(pszWantedExtension, "GL_ARB_shader_precision") == 0
    755                  || strcmp(pszWantedExtension, "GL_ARB_vertex_attrib_64bit") == 0
    756                  || strcmp(pszWantedExtension, "GL_ARB_viewport_array") == 0) )
    757         fRet = true;
    758     else
    759     {
    760         /* Search the GL_EXTENSIONS array. */
    761         static PFNGLGETSTRINGIPROC s_pfnGlGetStringi = NULL;
    762         if (!s_pfnGlGetStringi)
    763         {
    764              s_pfnGlGetStringi = (PFNGLGETSTRINGIPROC)OGLGETPROCADDRESS("glGetStringi");
    765              AssertLogRelReturn(s_pfnGlGetStringi, false);
    766         }
    767 
    768         GLint cExtensions = 1024;
    769         VMSVGA3D_INIT_CHECKED_GL_GET_INTEGER_VALUE(GL_NUM_EXTENSIONS, &cExtensions);
    770 
    771         for (GLint idxCur = 0; idxCur < cExtensions; idxCur++)
    772         {
    773             const char *pszCur = (const char *)s_pfnGlGetStringi(GL_EXTENSIONS, idxCur);
    774             if (pszCur && !strcmp(pszCur, pszWantedExtension))
    775             {
    776                 fRet = true;
    777                 break;
    778             }
    779         }
    780     }
    781 #else
    782     /*
    783      * Old interface.
    784      */
    785     char *pSupportedExtensions = (char *)glGetString(GL_EXTENSIONS);
    786     char *pExtensionSupported  = pSupportedExtensions;
    787     size_t cchWantedExtension  = strlen(pszWantedExtension);
    788 
    789     while (true)
    790     {
    791         pExtensionSupported = strstr(pExtensionSupported, pszWantedExtension);
    792         if (pExtensionSupported == NULL)
    793             break;
    794 
    795         if (    (    pExtensionSupported == pSupportedExtensions
    796                  ||  pExtensionSupported[-1] == ' ')
    797             &&  (    pExtensionSupported[cchWantedExtension] == ' '
    798                  ||  pExtensionSupported[cchWantedExtension] == '\0')
    799            )
    800         {
    801             fRet = true;
    802             break;
    803         }
    804 
    805         pExtensionSupported += cchWantedExtension;
    806     }
     718
     719    /* Temporarily.  Later start if (fMinGLVersion != 0.0 && fActualGLVersion >= fMinGLVersion) return true; */
     720    AssertMsg(   fMinGLVersion == 0.0
     721              || fRet == (pState->fGLVersion >= fMinGLVersion)
     722#ifdef RT_OS_DARWIN
     723              || VBOX_VMSVGA3D_DEFAULT_OGL_PROFILE == 2.1
    807724#endif
    808 
    809     /* Temporarily.  Later start if (fMinGLVersion != 0.0 && fActualGLVersion >= fMinGLVersion) return true; */
    810 #if defined(VBOX_VMSVGA3D_USE_OPENGL_CORE) || !defined(RT_OS_DARWIN)
    811     AssertMsg(fMinGLVersion == 0.0 || fRet == (fActualGLVersion >= fMinGLVersion),
    812               ("%s actual:%d min:%d\n", pszWantedExtension, (int)(fActualGLVersion * 10), (int)(fMinGLVersion * 10) ));
    813 #endif
     725              , ("%s actual:%d min:%d fRet=%d\n",
     726                 pszWantedExtension, (int)(pState->fGLVersion * 10), (int)(fMinGLVersion * 10), fRet));
    814727    return fRet;
    815728}
     
    819732 * Outputs GL_EXTENSIONS list to the release log.
    820733 */
    821 static void vmsvga3dLogRelExtensions(void)
    822 {
    823 #ifdef VBOX_VMSVGA3D_USE_OPENGL_CORE
     734static void vmsvga3dLogRelExtensions(const char *pszPrefix, const char *pszExtensions)
     735{
    824736    /* OpenGL 3.0 interface (glGetString(GL_EXTENSIONS) return NULL). */
    825     PFNGLGETSTRINGIPROC pfnGlGetStringi = (PFNGLGETSTRINGIPROC)OGLGETPROCADDRESS("glGetStringi");
    826     AssertLogRelReturnVoid(pfnGlGetStringi);
    827 
    828737    bool fBuffered = RTLogRelSetBuffering(true);
    829738
    830     GLint cExtensions = 1024;
    831     VMSVGA3D_INIT_CHECKED_GL_GET_INTEGER_VALUE(GL_NUM_EXTENSIONS, &cExtensions);
    832     LogRel(("VMSVGA3d: OpenGL extensions (GL_NUM_EXTENSIONS=%d)", cExtensions));
    833 
    834     for (GLint idxCur = 0; idxCur < cExtensions; idxCur++)
    835     {
    836         const char *pszExt = (const char *)pfnGlGetStringi(GL_EXTENSIONS, idxCur);
    837         const char *pszFmt = idxCur % 3 ? " %-26s" : "\nVMSVGA3d:  %-26s";
    838         LogRel((pszFmt, pszExt));
     739    /*
     740     * Determin the column widths first.
     741     */
     742    size_t   acchWidths[4] = { 1, 1, 1, 1 };
     743    uint32_t i;
     744    const char *psz = pszExtensions;
     745    for (i = 0; ; i++)
     746    {
     747        while (*psz == ' ')
     748            psz++;
     749        if (!*psz)
     750            break;
     751
     752        const char *pszEnd = strchr(psz, ' ');
     753        AssertBreak(pszEnd);
     754        size_t cch = pszEnd - psz;
     755
     756        uint32_t iColumn = i % RT_ELEMENTS(acchWidths);
     757        if (acchWidths[iColumn] < cch)
     758            acchWidths[iColumn] = cch;
     759
     760        psz = pszEnd;
     761    }
     762
     763    /*
     764     * Output it.
     765     */
     766    LogRel(("VMSVGA3d: %sOpenGL extensions (%d):", pszPrefix, i));
     767    psz = pszExtensions;
     768    for (i = 0; ; i++)
     769    {
     770        while (*psz == ' ')
     771            psz++;
     772        if (!*psz)
     773            break;
     774
     775        const char *pszEnd = strchr(psz, ' ');
     776        AssertBreak(pszEnd);
     777        size_t cch = pszEnd - psz;
     778
     779        uint32_t iColumn = i % RT_ELEMENTS(acchWidths);
     780        if (iColumn == 0)
     781            LogRel(("\nVMSVGA3d:  %-*.*s", acchWidths[iColumn], cch, psz));
     782        else if (iColumn != RT_ELEMENTS(acchWidths) - 1)
     783            LogRel((" %-*.*s", acchWidths[iColumn], cch, psz));
     784        else
     785            LogRel((" %.*s", cch, psz));
     786
     787        psz = pszEnd;
    839788    }
    840789
    841790    RTLogRelSetBuffering(fBuffered);
    842791    LogRel(("\n"));
     792}
     793
     794/**
     795 * Gathers the GL_EXTENSIONS list, storing it as a space padded list at
     796 * @a ppszExtensions.
     797 *
     798 * @returns VINF_SUCCESS or VERR_NO_STR_MEMORY
     799 * @param   ppszExtensions      Pointer to the string pointer. Free with RTStrFree.
     800 * @param   fGLProfileVersion   The OpenGL profile version.
     801 */
     802static int vmsvga3dGatherExtensions(char **ppszExtensions, float fGLProfileVersion)
     803{
     804    int rc;
     805    *ppszExtensions = NULL;
     806
     807    /*
     808     * Try the old glGetString interface first.
     809     */
     810    const char *pszExtensions = (const char *)glGetString(GL_EXTENSIONS);
     811    if (pszExtensions)
     812    {
     813        rc = RTStrAAppendExN(ppszExtensions, 3, " ", (size_t)1, pszExtensions, RTSTR_MAX, " ", (size_t)1);
     814        AssertLogRelRCReturn(rc, rc);
     815    }
     816    else
     817    {
     818        /*
     819         * The new interface where each extension string is retrieved separately.
     820         * Note! Cannot use VMSVGA3D_INIT_CHECKED_GL_GET_INTEGER_VALUE here because
     821         *       the above GL_EXTENSIONS error lingers on darwin. sucks.
     822         */
     823#ifndef GL_NUM_EXTENSIONS
     824# define GL_NUM_EXTENSIONS 0x821D
     825#endif
     826        GLint cExtensions = 1024;
     827        glGetIntegerv(GL_NUM_EXTENSIONS, &cExtensions);
     828        Assert(cExtensions != 1024);
     829
     830        PFNGLGETSTRINGIPROC pfnGlGetStringi = (PFNGLGETSTRINGIPROC)OGLGETPROCADDRESS("glGetStringi");
     831        AssertLogRelReturn(pfnGlGetStringi, VERR_NOT_SUPPORTED);
     832
     833        rc = RTStrAAppend(ppszExtensions, " ");
     834        for (GLint i = 0; RT_SUCCESS(rc) && i < cExtensions; i++)
     835        {
     836            const char *pszExt = (const char *)pfnGlGetStringi(GL_EXTENSIONS, i);
     837            if (pszExt)
     838                rc = RTStrAAppendExN(ppszExtensions, 2, pfnGlGetStringi(GL_EXTENSIONS, i), RTSTR_MAX, " ", (size_t)1);
     839        }
     840        AssertRCReturn(rc, rc);
     841    }
     842
     843#if 1
     844    /*
     845     * Add extensions promoted into the core OpenGL profile.
     846     */
     847    static const struct
     848    {
     849        float fGLVersion;
     850        const char *pszzExtensions;
     851    } s_aPromotedExtensions[] =
     852    {
     853        {
     854            1.1,
     855            " GL_EXT_vertex_array \0"
     856            " GL_EXT_polygon_offset \0"
     857            " GL_EXT_blend_logic_op \0"
     858            " GL_EXT_texture \0"
     859            " GL_EXT_copy_texture \0"
     860            " GL_EXT_subtexture \0"
     861            " GL_EXT_texture_object \0"
     862            " GL_ARB_framebuffer_object \0"
     863            " GL_ARB_map_buffer_range \0"
     864            " GL_ARB_vertex_array_object \0"
     865            "\0"
     866        },
     867        {
     868            1.2,
     869            " EXT_texture3D \0"
     870            " EXT_bgra \0"
     871            " EXT_packed_pixels \0"
     872            " EXT_rescale_normal \0"
     873            " EXT_separate_specular_color \0"
     874            " SGIS_texture_edge_clamp \0"
     875            " SGIS_texture_lod \0"
     876            " EXT_draw_range_elements \0"
     877            "\0"
     878        },
     879        {
     880            1.3,
     881            " GL_ARB_texture_compression \0"
     882            " GL_ARB_texture_cube_map \0"
     883            " GL_ARB_multisample \0"
     884            " GL_ARB_multitexture \0"
     885            " GL_ARB_texture_env_add \0"
     886            " GL_ARB_texture_env_combine \0"
     887            " GL_ARB_texture_env_dot3 \0"
     888            " GL_ARB_texture_border_clamp \0"
     889            " GL_ARB_transpose_matrix \0"
     890            "\0"
     891        },
     892        {
     893            1.5,
     894            " GL_SGIS_generate_mipmap \0"
     895            /*" GL_NV_blend_equare \0"*/
     896            " GL_ARB_depth_texture \0"
     897            " GL_ARB_shadow \0"
     898            " GL_EXT_fog_coord \0"
     899            " GL_EXT_multi_draw_arrays \0"
     900            " GL_ARB_point_parameters \0"
     901            " GL_EXT_secondary_color \0"
     902            " GL_EXT_blend_func_separate \0"
     903            " GL_EXT_stencil_wrap \0"
     904            " GL_ARB_texture_env_crossbar \0"
     905            " GL_EXT_texture_lod_bias \0"
     906            " GL_ARB_texture_mirrored_repeat \0"
     907            " GL_ARB_window_pos \0"
     908            "\0"
     909        },
     910        {
     911            1.6,
     912            " GL_ARB_vertex_buffer_object \0"
     913            " GL_ARB_occlusion_query \0"
     914            " GL_EXT_shadow_funcs \0"
     915        },
     916        {
     917            2.0,
     918            " GL_ARB_shader_objects \0" /*??*/
     919            " GL_ARB_vertex_shader \0" /*??*/
     920            " GL_ARB_fragment_shader \0" /*??*/
     921            " GL_ARB_shading_language_100 \0" /*??*/
     922            " GL_ARB_draw_buffers \0"
     923            " GL_ARB_texture_non_power_of_two \0"
     924            " GL_ARB_point_sprite \0"
     925            " GL_ATI_separate_stencil \0"
     926            " GL_EXT_stencil_two_side \0"
     927            "\0"
     928        },
     929        {
     930            2.1,
     931            " GL_ARB_pixel_buffer_object \0"
     932            " GL_EXT_texture_sRGB \0"
     933            "\0"
     934        },
     935        {
     936            3.0,
     937            " GL_ARB_framebuffer_object \0"
     938            " GL_ARB_map_buffer_range \0"
     939            " GL_ARB_vertex_array_object \0"
     940            "\0"
     941        },
     942        {
     943            3.1,
     944            " GL_ARB_copy_buffer \0"
     945            " GL_ARB_uniform_buffer_object \0"
     946            "\0"
     947        },
     948        {
     949            3.2,
     950            " GL_ARB_vertex_array_bgra \0"
     951            " GL_ARB_draw_elements_base_vertex \0"
     952            " GL_ARB_fragment_coord_conventions \0"
     953            " GL_ARB_provoking_vertex \0"
     954            " GL_ARB_seamless_cube_map \0"
     955            " GL_ARB_texture_multisample \0"
     956            " GL_ARB_depth_clamp \0"
     957            " GL_ARB_sync \0"
     958            " GL_ARB_geometry_shader4 \0" /*??*/
     959            "\0"
     960        },
     961        {
     962            3.3,
     963            " GL_ARB_blend_func_extended \0"
     964            " GL_ARB_sampler_objects \0"
     965            " GL_ARB_explicit_attrib_location \0"
     966            " GL_ARB_occlusion_query2 \0"
     967            " GL_ARB_shader_bit_encoding \0"
     968            " GL_ARB_texture_rgb10_a2ui \0"
     969            " GL_ARB_texture_swizzle \0"
     970            " GL_ARB_timer_query \0"
     971            " GL_ARB_vertex_type_2_10_10_10_rev \0"
     972            "\0"
     973        },
     974        {
     975            4.0,
     976            " GL_ARB_texture_query_lod \0"
     977            " GL_ARB_draw_indirect \0"
     978            " GL_ARB_gpu_shader5 \0"
     979            " GL_ARB_gpu_shader_fp64 \0"
     980            " GL_ARB_shader_subroutine \0"
     981            " GL_ARB_tessellation_shader \0"
     982            " GL_ARB_texture_buffer_object_rgb32 \0"
     983            " GL_ARB_texture_cube_map_array \0"
     984            " GL_ARB_texture_gather \0"
     985            " GL_ARB_transform_feedback2 \0"
     986            " GL_ARB_transform_feedback3 \0"
     987            "\0"
     988        },
     989        {
     990            4.1,
     991            " GL_ARB_ES2_compatibility \0"
     992            " GL_ARB_get_program_binary \0"
     993            " GL_ARB_separate_shader_objects \0"
     994            " GL_ARB_shader_precision \0"
     995            " GL_ARB_vertex_attrib_64bit \0"
     996            " GL_ARB_viewport_array \0"
     997            "\0"
     998        }
     999    };
     1000
     1001    uint32_t cPromoted = 0;
     1002    for (uint32_t i = 0; i < RT_ELEMENTS(s_aPromotedExtensions) && s_aPromotedExtensions[i].fGLVersion <= fGLProfileVersion; i++)
     1003    {
     1004        const char *pszExt = s_aPromotedExtensions[i].pszzExtensions;
     1005        while (*pszExt)
     1006        {
     1007            size_t cchExt = strlen(pszExt);
     1008            Assert(cchExt > 3);
     1009            Assert(pszExt[0] == ' ');
     1010            Assert(pszExt[1] != ' ');
     1011            Assert(pszExt[cchExt - 2] != ' ');
     1012            Assert(pszExt[cchExt - 1] == ' ');
     1013
     1014            if (strstr(*ppszExtensions, pszExt) == NULL)
     1015            {
     1016                if (cPromoted++ == 0)
     1017                {
     1018                    rc = RTStrAAppend(ppszExtensions, " <promoted-extensions:> <promoted-extensions:> <promoted-extensions:> ");
     1019                    AssertRCReturn(rc, rc);
     1020                }
     1021
     1022                rc = RTStrAAppend(ppszExtensions, pszExt);
     1023                AssertRCReturn(rc, rc);
     1024            }
     1025
     1026            pszExt = strchr(pszExt, '\0') + 1;
     1027        }
     1028    }
     1029#endif
     1030
     1031    return VINF_SUCCESS;
     1032}
     1033
     1034/**
     1035 * @interface_method_impl{VBOXVMSVGASHADERIF, pfnSwitchInitProfile}
     1036 */
     1037static DECLCALLBACK(void) vmsvga3dShaderIfSwitchInitProfile(PVBOXVMSVGASHADERIF pThis, bool fOtherProfile)
     1038{
     1039#ifdef VBOX_VMSVGA3D_DUAL_OPENGL_PROFILE
     1040    PVMSVGA3DSTATE pState = RT_FROM_MEMBER(pThis, VMSVGA3DSTATE, ShaderIf);
     1041    VMSVGA3D_SET_CURRENT_CONTEXT(pState, &pState->paContext[fOtherProfile ? 2 : 1]);
    8431042#else
    844     /* Old interface. */
    845     LogRel(("VMSVGA3d: OpenGL extensions: %s\n\n", glGetString(GL_EXTENSIONS)));
     1043    NOREF(pThis);
     1044    NOREF(fOtherProfile);
    8461045#endif
     1046}
     1047
     1048
     1049/**
     1050 * @interface_method_impl{VBOXVMSVGASHADERIF, pfnGetNextExtension}
     1051 */
     1052static DECLCALLBACK(bool) vmsvga3dShaderIfGetNextExtension(PVBOXVMSVGASHADERIF pThis, void **ppvEnumCtx,
     1053                                                           char *pszBuf, size_t cbBuf, bool fOtherProfile)
     1054{
     1055    PVMSVGA3DSTATE pState = RT_FROM_MEMBER(pThis, VMSVGA3DSTATE, ShaderIf);
     1056    const char    *pszCur = *ppvEnumCtx ? (const char *)*ppvEnumCtx
     1057                          : fOtherProfile ? pState->pszOtherExtensions : pState->pszExtensions;
     1058    while (*pszCur == ' ')
     1059        pszCur++;
     1060    if (!*pszCur)
     1061        return false;
     1062
     1063    const char *pszEnd = strchr(pszCur, ' ');
     1064    AssertReturn(pszEnd, false);
     1065    size_t cch = pszEnd - pszCur;
     1066    if (cch < cbBuf)
     1067    {
     1068        memcpy(pszBuf, pszCur, cch);
     1069        pszBuf[cch] = '\0';
     1070    }
     1071    else if (cbBuf > 0)
     1072    {
     1073        memcpy(pszBuf, "<overflow>", RT_MIN(sizeof("<overflow>"), cbBuf));
     1074        pszBuf[cbBuf - 1] = '\0';
     1075    }
     1076
     1077    *ppvEnumCtx = (void *)pszEnd;
     1078    return true;
    8471079}
    8481080
     
    9171149    AssertReturn(pThis->svga.p3dState, VERR_NO_MEMORY);
    9181150    PVMSVGA3DCONTEXT pContext;
    919 #ifdef VBOX_VMSVGA3D_USE_OPENGL_CORE
    920     PVMSVGA3DCONTEXT pLegacyContext;
     1151#ifdef VBOX_VMSVGA3D_DUAL_OPENGL_PROFILE
     1152    PVMSVGA3DCONTEXT pOtherCtx;
    9211153#endif
    9221154    int              rc;
     
    9241156    if (pState->fGLVersion != 0.0)
    9251157        return VINF_SUCCESS;    /* already initialized (load state) */
    926 
    927     /*
    928      * Initialize the capabilities with sensible defaults.
    929      */
    930     pState->caps.maxActiveLights               = 1;
    931     pState->caps.maxTextureBufferSize          = 65536;
    932     pState->caps.maxTextures                   = 1;
    933     pState->caps.maxClipDistances              = 4;
    934     pState->caps.maxColorAttachments           = 1;
    935     pState->caps.maxRectangleTextureSize       = 2048;
    936     pState->caps.maxTextureAnisotropy          = 2;
    937     pState->caps.maxVertexShaderInstructions   = 1024;
    938     pState->caps.maxFragmentShaderInstructions = 1024;
    939     pState->caps.vertexShaderVersion           = SVGA3DVSVERSION_NONE;
    940     pState->caps.fragmentShaderVersion         = SVGA3DPSVERSION_NONE;
    9411158
    9421159    /*
    9431160     * OpenGL function calls aren't possible without a valid current context, so create a fake one here.
    9441161     */
    945     rc = vmsvga3dContextDefine(pThis, 1, false /*fLegacy*/);
     1162    rc = vmsvga3dContextDefine(pThis, 1, false /*fOtherProfile*/);
    9461163    AssertRCReturn(rc, rc);
    9471164
     
    9491166    VMSVGA3D_SET_CURRENT_CONTEXT(pState, pContext);
    9501167
    951     LogRel(("VMSVGA3d: OpenGL version: %s\nOpenGL Vendor: %s\nOpenGL Renderer: %s\n", glGetString(GL_VERSION), glGetString(GL_VENDOR), glGetString(GL_RENDERER)));
    952     LogRel(("VMSVGA3d: OpenGL shader language version: %s\n", glGetString(GL_SHADING_LANGUAGE_VERSION)));
    953     vmsvga3dLogRelExtensions();
     1168    LogRel(("VMSVGA3d: OpenGL version: %s\n"
     1169            "VMSVGA3d: OpenGL Vendor: %s\n"
     1170            "VMSVGA3d: OpenGL Renderer: %s\n"
     1171            "VMSVGA3d: OpenGL shader language version: %s\n",
     1172            glGetString(GL_VERSION), glGetString(GL_VENDOR), glGetString(GL_RENDERER),
     1173            glGetString(GL_SHADING_LANGUAGE_VERSION)));
     1174
     1175    rc = vmsvga3dGatherExtensions(&pState->pszExtensions, VBOX_VMSVGA3D_DEFAULT_OGL_PROFILE);
     1176    AssertRCReturn(rc, rc);
     1177    vmsvga3dLogRelExtensions("", pState->pszExtensions);
    9541178
    9551179    pState->fGLVersion = atof((const char *)glGetString(GL_VERSION));
    9561180
    9571181
    958 #ifdef VBOX_VMSVGA3D_USE_OPENGL_CORE
     1182#ifdef VBOX_VMSVGA3D_DUAL_OPENGL_PROFILE
    9591183    /*
    960      * Get the legacy extension list so we can better figure out the shader model.
    961      * We add space before and after the list, so we can use strstr for locating extensions.
     1184     * Get the extension list for the alternative profile so we can better
     1185     * figure out the shader model and stuff.
    9621186     */
    963     rc = vmsvga3dContextDefine(pThis, 2, true /*fLegacy*/);
     1187    rc = vmsvga3dContextDefine(pThis, 2, true /*fOtherProfile*/);
    9641188    AssertLogRelRCReturn(rc, rc);
    9651189    pContext = &pState->paContext[1]; /* Array may have been reallocated. */
    9661190
    967     pLegacyContext = &pState->paContext[2];
    968     VMSVGA3D_SET_CURRENT_CONTEXT(pState, pLegacyContext);
    969 
    970     pState->pszLegacyExtensions = NULL;
    971     rc = RTStrAAppendExN(&pState->pszLegacyExtensions, 3,
    972                          " ", (size_t)1, (const char *)glGetString(GL_EXTENSIONS), RTSTR_MAX, " ", (size_t)1);
    973     AssertLogRelRCReturn(rc, rc);
    974 
    975     LogRel(("VMSVGA3d: Legacy OpenGL version: %s\nOpenGL Vendor: %s\nOpenGL Renderer: %s\n", glGetString(GL_VERSION), glGetString(GL_VENDOR), glGetString(GL_RENDERER)));
    976     LogRel(("VMSVGA3d: Legacy OpenGL shader language version: %s\n", glGetString(GL_SHADING_LANGUAGE_VERSION)));
    977     LogRel(("VMSVGA3d: Legacy OpenGL extenions: %s\n", glGetString(GL_EXTENSIONS)));
     1191    pOtherCtx = &pState->paContext[2];
     1192    VMSVGA3D_SET_CURRENT_CONTEXT(pState, pOtherCtx);
     1193
     1194    LogRel(("VMSVGA3d: Alternative OpenGL version: %s\n"
     1195            "VMSVGA3d: Alternative OpenGL Vendor: %s\n"
     1196            "VMSVGA3d: Alternative OpenGL Renderer: %s\n"
     1197            "VMSVGA3d: Alternative OpenGL shader language version: %s\n",
     1198            glGetString(GL_VERSION), glGetString(GL_VENDOR), glGetString(GL_RENDERER),
     1199            glGetString(GL_SHADING_LANGUAGE_VERSION)));
     1200
     1201    rc = vmsvga3dGatherExtensions(&pState->pszOtherExtensions, VBOX_VMSVGA3D_OTHER_OGL_PROFILE);
     1202    AssertRCReturn(rc, rc);
     1203    vmsvga3dLogRelExtensions("Alternative ", pState->pszOtherExtensions);
     1204
     1205    pState->fOtherGLVersion = atof((const char *)glGetString(GL_VERSION));
    9781206
    9791207    VMSVGA3D_SET_CURRENT_CONTEXT(pState, pContext);
    9801208#else
    981     pState->pszLegacyExtensions = (char *)"";
     1209    pState->pszOtherExtensions = (char *)"";
     1210    pState->fOtherGLVersion = pState->fGLVersion;
    9821211#endif
    9831212
    9841213
    985     if (vmsvga3dCheckGLExtension(pState->fGLVersion, 3.0, "GL_ARB_framebuffer_object"))
     1214    if (vmsvga3dCheckGLExtension(pState, 3.0, " GL_ARB_framebuffer_object "))
    9861215    {
    9871216        pState->ext.glIsRenderbuffer = (PFNGLISRENDERBUFFERPROC)OGLGETPROCADDRESS("glIsRenderbuffer");
     
    10481277
    10491278    /* OpenGL 3.2 core */
    1050     if (vmsvga3dCheckGLExtension(pState->fGLVersion, 3.2, "GL_ARB_draw_elements_base_vertex"))
     1279    if (vmsvga3dCheckGLExtension(pState, 3.2, " GL_ARB_draw_elements_base_vertex "))
    10511280    {
    10521281        pState->ext.glDrawElementsBaseVertex          = (PFNGLDRAWELEMENTSBASEVERTEXPROC)OGLGETPROCADDRESS("glDrawElementsBaseVertex");
     
    10571286
    10581287    /* OpenGL 3.2 core */
    1059     if (vmsvga3dCheckGLExtension(pState->fGLVersion, 3.2, "GL_ARB_provoking_vertex"))
     1288    if (vmsvga3dCheckGLExtension(pState, 3.2, " GL_ARB_provoking_vertex "))
    10601289    {
    10611290        pState->ext.glProvokingVertex                 = (PFNGLPROVOKINGVERTEXPROC)OGLGETPROCADDRESS("glProvokingVertex");
     
    10651294
    10661295    /* Extension support */
    1067 #ifdef VBOX_VMSVGA3D_USE_OPENGL_CORE
     1296#if defined(RT_OS_DARWIN)
    10681297    /** @todo OpenGL version history suggest this, verify...  */
    1069     pState->ext.fEXT_stencil_two_side = vmsvga3dCheckGLExtension(pState->fGLVersion, 2.0, "GL_EXT_stencil_two_side");
     1298    pState->ext.fEXT_stencil_two_side = vmsvga3dCheckGLExtension(pState, 2.0, " GL_EXT_stencil_two_side ");
    10701299#else
    1071     pState->ext.fEXT_stencil_two_side = vmsvga3dCheckGLExtension(pState->fGLVersion, 0.0, "GL_EXT_stencil_two_side");
     1300    pState->ext.fEXT_stencil_two_side = vmsvga3dCheckGLExtension(pState, 0.0, " GL_EXT_stencil_two_side ");
    10721301#endif
    10731302
    1074     /* Query capabilities */
    1075 #ifdef VBOX_VMSVGA3D_USE_OPENGL_CORE
    1076     glGetIntegerv(GL_MAX_LIGHTS, &pState->caps.maxActiveLights);
    1077     if (glGetError() != GL_NO_ERROR)
    1078     {
    1079         VMSVGA3D_SET_CURRENT_CONTEXT(pState, pLegacyContext);
    1080         VMSVGA3D_INIT_CHECKED_GL_GET_INTEGER_VALUE(GL_MAX_LIGHTS, &pState->caps.maxActiveLights);
    1081         if (glGetError() != GL_NO_ERROR)
    1082             pState->caps.maxActiveLights = 1;
    1083         VMSVGA3D_SET_CURRENT_CONTEXT(pState, pContext);
    1084     }
    1085 #else
    1086     VMSVGA3D_INIT_CHECKED_GL_GET_INTEGER_VALUE(GL_MAX_LIGHTS, &pState->caps.maxActiveLights);
    1087 #endif
    1088     VMSVGA3D_INIT_CHECKED_GL_GET_INTEGER_VALUE(GL_MAX_TEXTURE_BUFFER_SIZE, &pState->caps.maxTextureBufferSize);
    1089 #ifdef VBOX_VMSVGA3D_USE_OPENGL_CORE
    1090     glGetIntegerv(GL_MAX_LIGHTS, &pState->caps.maxActiveLights);
    1091     if (glGetError() != GL_NO_ERROR)
    1092         VMSVGA3D_INIT_CHECKED_GL_GET_INTEGER_VALUE(GL_MAX_TEXTURE_IMAGE_UNITS, &pState->caps.maxTextures);
    1093 #else
    1094     VMSVGA3D_INIT_CHECKED_GL_GET_INTEGER_VALUE(GL_MAX_TEXTURE_UNITS_ARB, &pState->caps.maxTextures);
    1095 #endif
    1096     VMSVGA3D_INIT_CHECKED_GL_GET_INTEGER_VALUE(GL_MAX_CLIP_DISTANCES, &pState->caps.maxClipDistances);
    1097     VMSVGA3D_INIT_CHECKED_GL_GET_INTEGER_VALUE(GL_MAX_COLOR_ATTACHMENTS, &pState->caps.maxColorAttachments);
    1098     VMSVGA3D_INIT_CHECKED_GL_GET_INTEGER_VALUE(GL_MAX_RECTANGLE_TEXTURE_SIZE, &pState->caps.maxRectangleTextureSize);
    1099     VMSVGA3D_INIT_CHECKED_GL_GET_INTEGER_VALUE(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &pState->caps.maxTextureAnisotropy);
    1100 #ifdef VBOX_VMSVGA3D_USE_OPENGL_CORE
    1101     glGetFloatv(GL_ALIASED_POINT_SIZE_RANGE, pState->caps.flPointSize);
    1102     if (glGetError() != GL_NO_ERROR)
    1103     {
    1104         VMSVGA3D_SET_CURRENT_CONTEXT(pState, pLegacyContext);
    1105         VMSVGA3D_INIT_CHECKED(glGetFloatv(GL_ALIASED_POINT_SIZE_RANGE, pState->caps.flPointSize));
    1106         if (glGetError() != GL_NO_ERROR)
    1107         {
    1108             pState->caps.flPointSize[0] = 1;
    1109             pState->caps.flPointSize[1] = 1;
    1110         }
    1111         VMSVGA3D_SET_CURRENT_CONTEXT(pState, pContext);
    1112     }
    1113 #else
    1114     VMSVGA3D_INIT_CHECKED(glGetFloatv(GL_ALIASED_POINT_SIZE_RANGE, pState->caps.flPointSize));
    1115 #endif
     1303    /*
     1304     * Initialize the capabilities with sensible defaults.
     1305     */
     1306    pState->caps.maxActiveLights               = 1;
     1307    pState->caps.maxTextureBufferSize          = 65536;
     1308    pState->caps.maxTextures                   = 1;
     1309    pState->caps.maxClipDistances              = 4;
     1310    pState->caps.maxColorAttachments           = 1;
     1311    pState->caps.maxRectangleTextureSize       = 2048;
     1312    pState->caps.maxTextureAnisotropy          = 2;
     1313    pState->caps.maxVertexShaderInstructions   = 1024;
     1314    pState->caps.maxFragmentShaderInstructions = 1024;
     1315    pState->caps.vertexShaderVersion           = SVGA3DVSVERSION_NONE;
     1316    pState->caps.fragmentShaderVersion         = SVGA3DPSVERSION_NONE;
     1317    pState->caps.flPointSize[0]                = 1;
     1318    pState->caps.flPointSize[1]                = 1;
     1319
     1320    /*
     1321     * Query capabilities
     1322     */
     1323    VMSVGA3D_INIT_CHECKED_BOTH(pState, pContext, pOtherCtx, glGetIntegerv(GL_MAX_LIGHTS, &pState->caps.maxActiveLights));
     1324    VMSVGA3D_INIT_CHECKED_BOTH(pState, pContext, pOtherCtx, glGetIntegerv(GL_MAX_TEXTURE_BUFFER_SIZE, &pState->caps.maxTextureBufferSize));
     1325    VMSVGA3D_INIT_CHECKED_BOTH(pState, pContext, pOtherCtx, glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, &pState->caps.maxTextures));
     1326    VMSVGA3D_INIT_CHECKED(glGetIntegerv(GL_MAX_CLIP_DISTANCES, &pState->caps.maxClipDistances));
     1327    VMSVGA3D_INIT_CHECKED(glGetIntegerv(GL_MAX_COLOR_ATTACHMENTS, &pState->caps.maxColorAttachments));
     1328    VMSVGA3D_INIT_CHECKED(glGetIntegerv(GL_MAX_RECTANGLE_TEXTURE_SIZE, &pState->caps.maxRectangleTextureSize));
     1329    VMSVGA3D_INIT_CHECKED(glGetIntegerv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &pState->caps.maxTextureAnisotropy));
     1330    VMSVGA3D_INIT_CHECKED_BOTH(pState, pContext, pOtherCtx, glGetFloatv(GL_ALIASED_POINT_SIZE_RANGE, pState->caps.flPointSize));
    11161331
    11171332    if (pState->ext.glGetProgramivARB)
    11181333    {
    1119 #ifdef VBOX_VMSVGA3D_USE_OPENGL_CORE /* None of these queries works with the OpenGL 3.2 Core context on darwin. */
    1120         VMSVGA3D_SET_CURRENT_CONTEXT(pState, pLegacyContext);
    1121 #endif
    1122         VMSVGA3D_INIT_CHECKED(pState->ext.glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB,
    1123                                                             &pState->caps.maxFragmentShaderTemps));
    1124         VMSVGA3D_INIT_CHECKED(pState->ext.glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB,
    1125                                                             &pState->caps.maxFragmentShaderInstructions));
    1126         VMSVGA3D_INIT_CHECKED(pState->ext.glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB,
    1127                                                             &pState->caps.maxVertexShaderTemps));
    1128         VMSVGA3D_INIT_CHECKED(pState->ext.glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB,
    1129                                                             &pState->caps.maxVertexShaderInstructions));
    1130 #ifdef VBOX_VMSVGA3D_USE_OPENGL_CORE
    1131         VMSVGA3D_SET_CURRENT_CONTEXT(pState, pContext);
    1132 #endif
    1133     }
    1134     pState->caps.fS3TCSupported = vmsvga3dCheckGLExtension(pState->fGLVersion, 0.0, "GL_EXT_texture_compression_s3tc");
     1334        VMSVGA3D_INIT_CHECKED_BOTH(pState, pContext, pOtherCtx,
     1335                                   pState->ext.glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB,
     1336                                                                 &pState->caps.maxFragmentShaderTemps));
     1337        VMSVGA3D_INIT_CHECKED_BOTH(pState, pContext, pOtherCtx,
     1338                                   pState->ext.glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB,
     1339                                                                 &pState->caps.maxFragmentShaderInstructions));
     1340        VMSVGA3D_INIT_CHECKED_BOTH(pState, pContext, pOtherCtx,
     1341                                   pState->ext.glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB,
     1342                                                                 &pState->caps.maxVertexShaderTemps));
     1343        VMSVGA3D_INIT_CHECKED_BOTH(pState, pContext, pOtherCtx,
     1344                                   pState->ext.glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB,
     1345                                                                 &pState->caps.maxVertexShaderInstructions));
     1346    }
     1347    pState->caps.fS3TCSupported = vmsvga3dCheckGLExtension(pState, 0.0, " GL_EXT_texture_compression_s3tc ");
    11351348
    11361349    /* http://http://www.opengl.org/wiki/Detecting_the_Shader_Model
     
    11441357     */
    11451358    /** @todo: distinguish between vertex and pixel shaders??? */
    1146     if (   vmsvga3dCheckGLExtension(pState->fGLVersion, 0.0, "GL_NV_gpu_program4")
    1147         || strstr(pState->pszLegacyExtensions, " GL_NV_gpu_program4 "))
     1359    if (   vmsvga3dCheckGLExtension(pState, 0.0, " GL_NV_gpu_program4 ")
     1360        || strstr(pState->pszOtherExtensions, " GL_NV_gpu_program4 "))
    11481361    {
    11491362        pState->caps.vertexShaderVersion   = SVGA3DVSVERSION_40;
     
    11511364    }
    11521365    else
    1153     if (    vmsvga3dCheckGLExtension(pState->fGLVersion, 0.0, "GL_NV_vertex_program3")
    1154         || strstr(pState->pszLegacyExtensions, " GL_NV_vertex_program3 ")
    1155 #if 0 /** @todo this is contrary to the ATI <= SM2.0. */
    1156         ||  vmsvga3dCheckGLExtension(pState->fGLVersion, 0.0, "GL_ARB_shader_texture_lod")  /* Wine claims this suggests SM 3.0 support */
    1157         || strstr(pState->pszLegacyExtensions, " GL_ARB_shader_texture_lod ")
    1158 #endif
     1366    if (   vmsvga3dCheckGLExtension(pState, 0.0, " GL_NV_vertex_program3 ")
     1367        || strstr(pState->pszOtherExtensions, " GL_NV_vertex_program3 ")
     1368        || vmsvga3dCheckGLExtension(pState, 0.0, " GL_ARB_shader_texture_lod ")  /* Wine claims this suggests SM 3.0 support */
     1369        || strstr(pState->pszOtherExtensions, " GL_ARB_shader_texture_lod ")
    11591370        )
    11601371    {
     
    11631374    }
    11641375    else
    1165     if (   vmsvga3dCheckGLExtension(pState->fGLVersion, 0.0, "GL_ARB_fragment_program")
    1166         || strstr(pState->pszLegacyExtensions, " GL_ARB_fragment_program "))
     1376    if (   vmsvga3dCheckGLExtension(pState, 0.0, " GL_ARB_fragment_program ")
     1377        || strstr(pState->pszOtherExtensions, " GL_ARB_fragment_program "))
    11671378    {
    11681379        pState->caps.vertexShaderVersion   = SVGA3DVSVERSION_20;
     
    11761387    }
    11771388
    1178     if (!vmsvga3dCheckGLExtension(pState->fGLVersion, 3.2, "GL_ARB_vertex_array_bgra"))
     1389    if (!vmsvga3dCheckGLExtension(pState, 3.2, " GL_ARB_vertex_array_bgra "))
    11791390    {
    11801391        /** @todo Intel drivers don't support this extension! */
     
    12651476
    12661477    /* Initialize the shader library. */
    1267     rc = ShaderInitLib();
     1478    pState->ShaderIf.pfnSwitchInitProfile = vmsvga3dShaderIfSwitchInitProfile;
     1479    pState->ShaderIf.pfnGetNextExtension  = vmsvga3dShaderIfGetNextExtension;
     1480    rc = ShaderInitLib(&pState->ShaderIf);
    12681481    AssertRC(rc);
    12691482
     
    12711484    rc = vmsvga3dContextDestroy(pThis, 1);
    12721485    AssertRC(rc);
    1273 #ifdef VBOX_VMSVGA3D_USE_OPENGL_CORE
     1486#ifdef VBOX_VMSVGA3D_DUAL_OPENGL_PROFILE
    12741487    rc = vmsvga3dContextDestroy(pThis, 2);
    12751488    AssertRC(rc);
    12761489#endif
    12771490
    1278 #if !defined(RT_OS_DARWIN) || defined(VBOX_VMSVGA3D_USE_OPENGL_CORE)
    1279     /* on the Mac, OpenGL 3 came very late so we have a capable 2.1 implementation */
    1280     if (pState->fGLVersion < 3.0)
     1491    if (   pState->fGLVersion < 3.0
     1492        && pState->fOtherGLVersion < 3.0 /* darwin: legacy profile hack */)
    12811493    {
    12821494        LogRel(("VMSVGA3d: unsupported OpenGL version; minimum is 3.0\n"));
    12831495        return VERR_NOT_IMPLEMENTED;
    12841496    }
    1285 #endif
    12861497    if (    !pState->ext.glIsRenderbuffer
    12871498        ||  !pState->ext.glBindRenderbuffer
     
    13661577#endif
    13671578
    1368 #ifdef VBOX_VMSVGA3D_USE_OPENGL_CORE
    1369     RTStrFree(pState->pszLegacyExtensions);
     1579    RTStrFree(pState->pszExtensions);
     1580    pState->pszExtensions = NULL;
     1581#ifdef VBOX_VMSVGA3D_DUAL_OPENGL_PROFILE
     1582    RTStrFree(pState->pszOtherExtensions);
    13701583#endif
    1371     pState->pszLegacyExtensions = NULL;
     1584    pState->pszOtherExtensions = NULL;
    13721585
    13731586    return VINF_SUCCESS;
     
    32463459 * @param   pThis           VGA device instance data.
    32473460 * @param   cid             Context id
    3248  * @param   fLegacy         Whether to create a legacy context instead of
    3249  *                          whatever is default.  Only used at init time.
     3461 * @param   fOtherProfile   When clear, the context is created using the default
     3462 *                          OpenGL profile.  When set, it's created using the
     3463 *                          alternative profile.  The latter is only allowed if
     3464 *                          the VBOX_VMSVGA3D_DUAL_OPENGL_PROFILE is set.
    32503465 */
    3251 int vmsvga3dContextDefine(PVGASTATE pThis, uint32_t cid, bool fLegacy)
     3466int vmsvga3dContextDefine(PVGASTATE pThis, uint32_t cid, bool fOtherProfile)
    32523467{
    32533468    int                     rc;
     
    32573472    AssertReturn(pState, VERR_NO_MEMORY);
    32583473    AssertReturn(cid < SVGA3D_MAX_CONTEXT_IDS, VERR_INVALID_PARAMETER);
    3259 #if !defined(VBOX_VMSVGA3D_USE_OPENGL_CORE) || !(defined(RT_OS_DARWIN))
    3260     AssertReturn(!fLegacy, VERR_INTERNAL_ERROR_3);
     3474#if !defined(VBOX_VMSVGA3D_DUAL_OPENGL_PROFILE) || !(defined(RT_OS_DARWIN))
     3475    AssertReturn(!fOtherProfile, VERR_INTERNAL_ERROR_3);
    32613476#endif
    32623477
     
    32663481    {
    32673482        pState->idTestContext = 207;
    3268         rc = vmsvga3dContextDefine(pThis, pState->idTestContext, false /*fLegacy*/);
     3483        rc = vmsvga3dContextDefine(pThis, pState->idTestContext, false /*fOtherProfile*/);
    32693484        AssertRCReturn(rc, rc);
    32703485    }
     
    33863601
    33873602#elif defined(RT_OS_DARWIN)
    3388     pContext->fLegacy = fLegacy;
     3603    pContext->fOtherProfile = fOtherProfile;
    33893604
    33903605    /* Find the first active context to share the display list with (necessary for sharing e.g. textures between contexts). */
     
    33943609        if (    pState->paContext[i].id != SVGA3D_INVALID_ID
    33953610            &&  i != pContext->id
    3396             &&  pState->paContext[i].fLegacy == fLegacy)
     3611            &&  pState->paContext[i].fOtherProfile == fOtherProfile)
    33973612        {
    33983613            Log(("Sharing display lists between cid=%d and cid=%d\n", pContext->id, i));
     
    34013616        }
    34023617    }
    3403     vmsvga3dCocoaCreateContext(&pContext->cocoaContext, shareContext, fLegacy);
     3618    vmsvga3dCocoaCreateContext(&pContext->cocoaContext, shareContext, fOtherProfile);
    34043619    NativeNSViewRef pHostView = (NativeNSViewRef)pThis->svga.u64HostWindowId;
    34053620    vmsvga3dCocoaCreateView(&pContext->cocoaView, pHostView);
  • trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-shared.h

    r53749 r53755  
    4949            uint32_t cPixelShaderConst, cVertexShaderConst, cPixelShaders, cVertexShaders;
    5050
    51             rc = vmsvga3dContextDefine(pThis, cid, false /*fLegacy*/);
     51            rc = vmsvga3dContextDefine(pThis, cid, false /*fOtherProfile*/);
    5252            AssertRCReturn(rc, rc);
    5353
  • trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-win.cpp

    r53749 r53755  
    29022902 * @param   pThis           VGA device instance data.
    29032903 * @param   cid             Context id
    2904  * @param   fLegacy         OpenGL(+darwin) specific argument, ignored.
     2904 * @param   fOtherProfile   OpenGL(+darwin) specific argument, ignored.
    29052905 */
    2906 int vmsvga3dContextDefine(PVGASTATE pThis, uint32_t cid, bool fLegacy)
     2906int vmsvga3dContextDefine(PVGASTATE pThis, uint32_t cid, bool fOtherProfile)
    29072907{
    29082908    int                     rc;
     
    29142914    AssertReturn(pState, VERR_NO_MEMORY);
    29152915    AssertReturn(cid < SVGA3D_MAX_CONTEXT_IDS, VERR_INVALID_PARAMETER);
     2916    NOREF(fOtherProfile);
    29162917
    29172918    Log(("vmsvga3dContextDefine id %x\n", cid));
     
    53555356}
    53565357
    5357 int vmsvga3dDrawPrimitives(PVGASTATE pThis, uint32_t cid, uint32_t numVertexDecls, SVGA3dVertexDecl *pVertexDecl, uint32_t numRanges, SVGA3dPrimitiveRange *pRange, uint32_t cVertexDivisor, SVGA3dVertexDivisor *pVertexDivisor)
     5358int vmsvga3dDrawPrimitives(PVGASTATE pThis, uint32_t cid, uint32_t numVertexDecls, SVGA3dVertexDecl *pVertexDecl,
     5359                           uint32_t numRanges, SVGA3dPrimitiveRange *pRange,
     5360                           uint32_t cVertexDivisor, SVGA3dVertexDivisor *pVertexDivisor)
    53585361{
    53595362    PVMSVGA3DCONTEXT             pContext;
  • trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d.h

    r53750 r53755  
    6262int vmsvga3dSurfaceBlitToScreen(PVGASTATE pThis, uint32_t dest, SVGASignedRect destRect, SVGA3dSurfaceImageId src, SVGASignedRect srcRect, uint32_t cRects, SVGASignedRect *pRect);
    6363
    64 int vmsvga3dContextDefine(PVGASTATE pThis, uint32_t cid, bool fLegacy);
     64int vmsvga3dContextDefine(PVGASTATE pThis, uint32_t cid, bool fOtherProfile);
    6565int vmsvga3dContextDestroy(PVGASTATE pThis, uint32_t cid);
    6666
  • trunk/src/VBox/Devices/Graphics/shaderlib/directx.c

    r53741 r53755  
    19081908#endif
    19091909
    1910 #ifdef VBOX_VMSVGA3D_USE_OPENGL_CORE
     1910#ifdef VBOX_WITH_VMSVGA
    19111911/** Checks if @a pszExtension is one of the extensions we're looking for and
    19121912 *  updates @a pGlInfo->supported accordingly. */
     
    19261926
    19271927/* Context activation is done by the caller. */
    1928 BOOL IWineD3DImpl_FillGLCaps(struct wined3d_adapter *adapter)
     1928BOOL IWineD3DImpl_FillGLCaps(struct wined3d_adapter *adapter, struct VBOXVMSVGASHADERIF *pVBoxShaderIf)
    19291929{
    19301930    struct wined3d_driver_info *driver_info = &adapter->driver_info;
    19311931    struct wined3d_gl_info *gl_info = &adapter->gl_info;
    1932 #ifndef VBOX_VMSVGA3D_USE_OPENGL_CORE
     1932#ifndef VBOX_WITH_VMSVGA
    19331933    const char *GL_Extensions    = NULL;
    19341934    const char *WGL_Extensions   = NULL;
     
    20082008    TRACE_(d3d_caps)("ClipPlanes support - num Planes=%d\n", gl_max);
    20092009
    2010 #ifdef VBOX_VMSVGA3D_USE_OPENGL_CORE
     2010#ifdef VBOX_VMSVGA3D_DUAL_OPENGL_PROFILE
    20112011    glGetIntegerv(GL_MAX_LIGHTS, &gl_max);
    20122012    if (glGetError() != GL_NO_ERROR)
    2013         gl_max = 0;
     2013    {
     2014        pVBoxShaderIf->pfnSwitchInitProfile(pVBoxShaderIf, true /*fOtherProfile*/);
     2015        VBOX_CHECK_GL_CALL(glGetIntegerv(GL_MAX_LIGHTS, &gl_max));
     2016        pVBoxShaderIf->pfnSwitchInitProfile(pVBoxShaderIf, false /*fOtherProfile*/);
     2017    }
    20142018#else
    20152019    VBOX_CHECK_GL_CALL(glGetIntegerv(GL_MAX_LIGHTS, &gl_max));
     
    20222026    TRACE_(d3d_caps)("Maximum texture size support - max texture size=%d\n", gl_max);
    20232027
    2024 #ifdef VBOX_VMSVGA3D_USE_OPENGL_CORE
     2028#ifdef VBOX_VMSVGA3D_DUAL_OPENGL_PROFILE
    20252029    glGetFloatv(GL_ALIASED_POINT_SIZE_RANGE, gl_floatv);
    20262030    if (glGetError() != GL_NO_ERROR)
    20272031    {
    2028         gl_floatv[0] = 1;
    2029         gl_floatv[1] = 1;
     2032        pVBoxShaderIf->pfnSwitchInitProfile(pVBoxShaderIf, true /*fOtherProfile*/);
     2033        VBOX_CHECK_GL_CALL(glGetFloatv(GL_ALIASED_POINT_SIZE_RANGE, gl_floatv));
     2034        if (glGetError() != GL_NO_ERROR)
     2035            gl_floatv[0] = gl_floatv[1] = 1;
     2036        pVBoxShaderIf->pfnSwitchInitProfile(pVBoxShaderIf, false /*fOtherProfile*/);
    20302037    }
    20312038#else
     
    20372044
    20382045    /* Parse the gl supported features, in theory enabling parts of our code appropriately. */
    2039 #ifndef VBOX_VMSVGA3D_USE_OPENGL_CORE
    2040     VBOX_CHECK_GL_CALL(GL_Extensions = (const char *)glGetString(GL_EXTENSIONS));
     2046#ifndef VBOX_WITH_VMSVGA
     2047    GL_Extensions = (const char *)glGetString(GL_EXTENSIONS);
    20412048    if (!GL_Extensions)
    20422049    {
     
    20552062    gl_info->supported[VBOX_SHARED_CONTEXTS] = TRUE;
    20562063
    2057 #ifdef VBOX_VMSVGA3D_USE_OPENGL_CORE
    2058     {
    2059         /* We work with OpenGL 3.2+ on darwin, so we need to handle extensions differently. */
    2060         GLint idxExt;
    2061         GLint cExtensions = 1024;
    2062         float fGLVersion;
    2063         VBOX_CHECK_GL_CALL(fGLVersion = atof((const char *)glGetString(GL_VERSION)));
    2064 
    2065 # define GL_NUM_EXTENSIONS 0x821D /// FIXME
    2066         extern const GLubyte * glGetStringi(GLenum name, GLuint index); /// FIXME
    2067 
    2068         VBOX_CHECK_GL_CALL(glGetIntegerv(GL_NUM_EXTENSIONS, &cExtensions));
    2069         for (idxExt = 0; idxExt < cExtensions; idxExt++)
    2070         {
    2071             const char *pszExt;
    2072             VBOX_CHECK_GL_CALL((const char *)glGetStringi(GL_EXTENSIONS, idxExt));
    2073             check_gl_extension(gl_info, pszExt);
    2074         }
    2075 
    2076         if (fGLVersion >= 1.1)
    2077         {
    2078             check_gl_extension(gl_info, "GL_EXT_vertex_array");
    2079             check_gl_extension(gl_info, "GL_EXT_polygon_offset");
    2080             check_gl_extension(gl_info, "GL_EXT_blend_logic_op");
    2081             check_gl_extension(gl_info, "GL_EXT_texture");
    2082             check_gl_extension(gl_info, "GL_EXT_copy_texture");
    2083             check_gl_extension(gl_info, "GL_EXT_subtexture");
    2084             check_gl_extension(gl_info, "GL_EXT_texture_object");
    2085             check_gl_extension(gl_info, "GL_ARB_framebuffer_object");
    2086             check_gl_extension(gl_info, "GL_ARB_map_buffer_range");
    2087             check_gl_extension(gl_info, "GL_ARB_vertex_array_object");
    2088         }
    2089         if (fGLVersion >= 1.2)
    2090         {
    2091             check_gl_extension(gl_info, "EXT_texture3D");
    2092             check_gl_extension(gl_info, "EXT_bgra");
    2093             check_gl_extension(gl_info, "EXT_packed_pixels");
    2094             check_gl_extension(gl_info, "EXT_rescale_normal");
    2095             check_gl_extension(gl_info, "EXT_separate_specular_color");
    2096             check_gl_extension(gl_info, "SGIS_texture_edge_clamp");
    2097             check_gl_extension(gl_info, "SGIS_texture_lod");
    2098             check_gl_extension(gl_info, "EXT_draw_range_elements");
    2099         }
    2100         if (fGLVersion >= 1.3)
    2101         {
    2102             check_gl_extension(gl_info, "GL_ARB_texture_compression");
    2103             check_gl_extension(gl_info, "GL_ARB_texture_cube_map");
    2104             check_gl_extension(gl_info, "GL_ARB_multisample");
    2105             check_gl_extension(gl_info, "GL_ARB_multitexture");
    2106             check_gl_extension(gl_info, "GL_ARB_texture_env_add");
    2107             check_gl_extension(gl_info, "GL_ARB_texture_env_combine");
    2108             check_gl_extension(gl_info, "GL_ARB_texture_env_dot3");
    2109             check_gl_extension(gl_info, "GL_ARB_texture_border_clamp");
    2110             check_gl_extension(gl_info, "GL_ARB_transpose_matrix");
    2111         }
    2112         if (fGLVersion >= 1.5)
    2113         {
    2114             check_gl_extension(gl_info, "GL_SGIS_generate_mipmap");
    2115             /*check_gl_extension(gl_info, "GL_NV_blend_equare");*/
    2116             check_gl_extension(gl_info, "GL_ARB_depth_texture");
    2117             check_gl_extension(gl_info, "GL_ARB_shadow");
    2118             check_gl_extension(gl_info, "GL_EXT_fog_coord");
    2119             check_gl_extension(gl_info, "GL_EXT_multi_draw_arrays");
    2120             check_gl_extension(gl_info, "GL_ARB_point_parameters");
    2121             check_gl_extension(gl_info, "GL_EXT_secondary_color");
    2122             check_gl_extension(gl_info, "GL_EXT_blend_func_separate");
    2123             check_gl_extension(gl_info, "GL_EXT_stencil_wrap");
    2124             check_gl_extension(gl_info, "GL_ARB_texture_env_crossbar");
    2125             check_gl_extension(gl_info, "GL_EXT_texture_lod_bias");
    2126             check_gl_extension(gl_info, "GL_ARB_texture_mirrored_repeat");
    2127             check_gl_extension(gl_info, "GL_ARB_window_pos");
    2128         }
    2129         if (fGLVersion >= 1.6)
    2130         {
    2131             check_gl_extension(gl_info, "GL_ARB_vertex_buffer_object");
    2132             check_gl_extension(gl_info, "GL_ARB_occlusion_query");
    2133             check_gl_extension(gl_info, "GL_EXT_shadow_funcs");
    2134         }
    2135         if (fGLVersion >= 2.0)
    2136         {
    2137             check_gl_extension(gl_info, "GL_ARB_shader_objects"); /*??*/
    2138             check_gl_extension(gl_info, "GL_ARB_vertex_shader"); /*??*/
    2139             check_gl_extension(gl_info, "GL_ARB_fragment_shader"); /*??*/
    2140             check_gl_extension(gl_info, "GL_ARB_shading_language_100"); /*??*/
    2141             check_gl_extension(gl_info, "GL_ARB_draw_buffers");
    2142             check_gl_extension(gl_info, "GL_ARB_texture_non_power_of_two");
    2143             check_gl_extension(gl_info, "GL_ARB_point_sprite");
    2144             check_gl_extension(gl_info, "GL_ATI_separate_stencil");
    2145             check_gl_extension(gl_info, "GL_EXT_stencil_two_side");
    2146         }
    2147         if (fGLVersion >= 2.1)
    2148         {
    2149             check_gl_extension(gl_info, "GL_ARB_pixel_buffer_object");
    2150             check_gl_extension(gl_info, "GL_EXT_texture_sRGB");
    2151         }
    2152         if (fGLVersion >= 3.0)
    2153         {
    2154             check_gl_extension(gl_info, "GL_ARB_framebuffer_object");
    2155             check_gl_extension(gl_info, "GL_ARB_map_buffer_range");
    2156             check_gl_extension(gl_info, "GL_ARB_vertex_array_object");
    2157         }
    2158         if (fGLVersion >= 3.0)
    2159         {
    2160             check_gl_extension(gl_info, "GL_ARB_framebuffer_object");
    2161             check_gl_extension(gl_info, "GL_ARB_map_buffer_range");
    2162             check_gl_extension(gl_info, "GL_ARB_vertex_array_object");
    2163         }
    2164         if (fGLVersion >= 3.1)
    2165         {
    2166             check_gl_extension(gl_info, "GL_ARB_copy_buffer");
    2167             check_gl_extension(gl_info, "GL_ARB_uniform_buffer_object");
    2168         }
    2169         if (fGLVersion >= 3.2)
    2170         {
    2171             check_gl_extension(gl_info, "GL_ARB_draw_elements_base_vertex");
    2172             check_gl_extension(gl_info, "GL_ARB_provoking_vertex");
    2173             check_gl_extension(gl_info, "GL_ARB_sync");
    2174             check_gl_extension(gl_info, "GL_ARB_texture_multisample");
    2175         }
    2176         if (fGLVersion >= 3.3)
    2177         {
    2178             check_gl_extension(gl_info, "GL_ARB_blend_func_extended");
    2179             check_gl_extension(gl_info, "GL_ARB_sampler_objects");
    2180             check_gl_extension(gl_info, "GL_ARB_explicit_attrib_location");
    2181             check_gl_extension(gl_info, "GL_ARB_occlusion_query2");
    2182             check_gl_extension(gl_info, "GL_ARB_shader_bit_encoding");
    2183             check_gl_extension(gl_info, "GL_ARB_texture_rgb10_a2ui");
    2184             check_gl_extension(gl_info, "GL_ARB_texture_swizzle");
    2185             check_gl_extension(gl_info, "GL_ARB_timer_query");
    2186             check_gl_extension(gl_info, "GL_ARB_vertex_type_2_10_10_10_rev");
    2187         }
    2188         if (fGLVersion >=4.0)
    2189         {
    2190             check_gl_extension(gl_info, "GL_ARB_texture_query_lod");
    2191             check_gl_extension(gl_info, "GL_ARB_draw_indirect");
    2192             check_gl_extension(gl_info, "GL_ARB_gpu_shader5");
    2193             check_gl_extension(gl_info, "GL_ARB_gpu_shader_fp64");
    2194             check_gl_extension(gl_info, "GL_ARB_shader_subroutine");
    2195             check_gl_extension(gl_info, "GL_ARB_tessellation_shader");
    2196             check_gl_extension(gl_info, "GL_ARB_texture_buffer_object_rgb32");
    2197             check_gl_extension(gl_info, "GL_ARB_texture_cube_map_array");
    2198             check_gl_extension(gl_info, "GL_ARB_texture_gather");
    2199             check_gl_extension(gl_info, "GL_ARB_transform_feedback2");
    2200             check_gl_extension(gl_info, "GL_ARB_transform_feedback3");
    2201         }
    2202         if (fGLVersion >=4.1)
    2203         {
    2204             check_gl_extension(gl_info, "GL_ARB_ES2_compatibility");
    2205             check_gl_extension(gl_info, "GL_ARB_get_program_binary");
    2206             check_gl_extension(gl_info, "GL_ARB_separate_shader_objects");
    2207             check_gl_extension(gl_info, "GL_ARB_shader_precision");
    2208             check_gl_extension(gl_info, "GL_ARB_vertex_attrib_64bit");
    2209             check_gl_extension(gl_info, "GL_ARB_viewport_array");
    2210         }
    2211     }
    2212 
    2213     LEAVE_GL();
    2214 
    2215 #else
     2064#ifdef VBOX_WITH_VMSVGA
     2065    {
     2066        void *pvEnumCtx = NULL;
     2067        char  szCurExt[256];
     2068        while (pVBoxShaderIf->pfnGetNextExtension(pVBoxShaderIf, &pvEnumCtx, szCurExt, sizeof(szCurExt), false /*fOtherProfile*/))
     2069            check_gl_extension(gl_info, szCurExt);
     2070
     2071        /* The cheap way out. */
     2072        pvEnumCtx = NULL;
     2073        while (pVBoxShaderIf->pfnGetNextExtension(pVBoxShaderIf, &pvEnumCtx, szCurExt, sizeof(szCurExt), true /*fOtherProfile*/))
     2074            check_gl_extension(gl_info, szCurExt);
     2075    }
     2076#else /* VBOX_WITH_VMSVGA */
    22162077    while (*GL_Extensions)
    22172078    {
     
    23612222    if (gl_info->supported[ARB_MULTITEXTURE])
    23622223    {
    2363 #ifdef VBOX_VMSVGA3D_USE_OPENGL_CORE
     2224#ifdef VBOX_VMSVGA3D_DUAL_OPENGL_PROFILE
    23642225        glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, &gl_max);
    23652226        if (glGetError() != GL_NO_ERROR)
     
    24262287    if (gl_info->supported[ARB_VERTEX_BLEND])
    24272288    {
     2289#ifdef VBOX_VMSVGA3D_DUAL_OPENGL_PROFILE
     2290        glGetIntegerv(GL_MAX_VERTEX_UNITS_ARB, &gl_max);
     2291        if (glGetError() != GL_NO_ERROR)
     2292        {
     2293            pVBoxShaderIf->pfnSwitchInitProfile(pVBoxShaderIf, true /*fOtherProfile*/);
     2294            VBOX_CHECK_GL_CALL(glGetIntegerv(GL_MAX_VERTEX_UNITS_ARB, &gl_max));
     2295            pVBoxShaderIf->pfnSwitchInitProfile(pVBoxShaderIf, false /*fOtherProfile*/);
     2296        }
     2297#else
    24282298        VBOX_CHECK_GL_CALL(glGetIntegerv(GL_MAX_VERTEX_UNITS_ARB, &gl_max));
     2299#endif
    24292300        gl_info->limits.blends = gl_max;
    24302301        TRACE_(d3d_caps)("Max blends: %u.\n", gl_info->limits.blends);
     
    24442315    if (gl_info->supported[ARB_FRAGMENT_PROGRAM])
    24452316    {
     2317#ifdef VBOX_VMSVGA3D_DUAL_OPENGL_PROFILE
     2318        GL_EXTCALL(glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_ENV_PARAMETERS_ARB, &gl_max));
     2319        if (glGetError() != GL_NO_ERROR)
     2320            pVBoxShaderIf->pfnSwitchInitProfile(pVBoxShaderIf, true /*fOtherProfile*/);
     2321#endif
    24462322        VBOX_CHECK_GL_CALL(GL_EXTCALL(glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_ENV_PARAMETERS_ARB, &gl_max)));
    24472323        gl_info->limits.arb_ps_float_constants = gl_max;
     
    24602336        gl_info->limits.arb_ps_local_constants = gl_max;
    24612337        TRACE_(d3d_caps)("Max ARB_FRAGMENT_PROGRAM local parameters: %d.\n", gl_info->limits.arb_ps_instructions);
     2338#ifdef VBOX_VMSVGA3D_DUAL_OPENGL_PROFILE
     2339        pVBoxShaderIf->pfnSwitchInitProfile(pVBoxShaderIf, false /*fOtherProfile*/);
     2340#endif
    24622341    }
    24632342    if (gl_info->supported[ARB_VERTEX_PROGRAM])
    24642343    {
     2344#ifdef VBOX_VMSVGA3D_DUAL_OPENGL_PROFILE
     2345        GL_EXTCALL(glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_MAX_PROGRAM_ENV_PARAMETERS_ARB, &gl_max));
     2346        if (glGetError() != GL_NO_ERROR)
     2347            pVBoxShaderIf->pfnSwitchInitProfile(pVBoxShaderIf, true /*fOtherProfile*/);
     2348#endif
    24652349        VBOX_CHECK_GL_CALL(GL_EXTCALL(glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_MAX_PROGRAM_ENV_PARAMETERS_ARB, &gl_max)));
    24662350        gl_info->limits.arb_vs_float_constants = gl_max;
     
    24762360        gl_info->limits.arb_vs_instructions = gl_max;
    24772361        TRACE_(d3d_caps)("Max ARB_VERTEX_PROGRAM native instructions: %d.\n", gl_info->limits.arb_vs_instructions);
     2362#ifdef VBOX_VMSVGA3D_DUAL_OPENGL_PROFILE
     2363        pVBoxShaderIf->pfnSwitchInitProfile(pVBoxShaderIf, false /*fOtherProfile*/);
     2364#endif
    24782365#ifndef VBOX_WITH_VMSVGA
    24792366        if (test_arb_vs_offset_limit(gl_info)) gl_info->quirks |= WINED3D_QUIRK_ARB_VS_OFFSET_LIMIT;
     
    25332420#endif
    25342421        TRACE_(d3d_caps)("Max ARB_FRAGMENT_SHADER float constants: %u.\n", gl_info->limits.glsl_ps_float_constants);
    2535 #ifdef VBOX_VMSVGA3D_USE_OPENGL_CORE
     2422#ifdef VBOX_VMSVGA3D_DUAL_OPENGL_PROFILE
    25362423        glGetIntegerv(GL_MAX_VARYING_FLOATS_ARB, &gl_max);
    25372424        if (glGetError() != GL_NO_ERROR)
    2538             gl_max = 60;
     2425        {
     2426            pVBoxShaderIf->pfnSwitchInitProfile(pVBoxShaderIf, true /*fOtherProfile*/);
     2427            VBOX_CHECK_GL_CALL(glGetIntegerv(GL_MAX_VARYING_FLOATS_ARB, &gl_max));
     2428            pVBoxShaderIf->pfnSwitchInitProfile(pVBoxShaderIf, false /*fOtherProfile*/);
     2429        }
    25392430#else
    25402431        VBOX_CHECK_GL_CALL(glGetIntegerv(GL_MAX_VARYING_FLOATS_ARB, &gl_max));
     
    25562447    if (gl_info->supported[NV_LIGHT_MAX_EXPONENT])
    25572448    {
     2449#ifdef VBOX_VMSVGA3D_DUAL_OPENGL_PROFILE
     2450        glGetFloatv(GL_MAX_SHININESS_NV, &gl_info->limits.shininess);
     2451        if (glGetError() != GL_NO_ERROR)
     2452        {
     2453            pVBoxShaderIf->pfnSwitchInitProfile(pVBoxShaderIf, true /*fOtherProfile*/);
     2454            VBOX_CHECK_GL_CALL(glGetFloatv(GL_MAX_SHININESS_NV, &gl_info->limits.shininess));
     2455            pVBoxShaderIf->pfnSwitchInitProfile(pVBoxShaderIf, false /*fOtherProfile*/);
     2456        }
     2457#else
    25582458        VBOX_CHECK_GL_CALL(glGetFloatv(GL_MAX_SHININESS_NV, &gl_info->limits.shininess));
     2459#endif
    25592460    }
    25602461    else
  • trunk/src/VBox/Devices/Graphics/shaderlib/shaderapi.c

    r53732 r53755  
    132132            glGetAttribLocationARB,                     ARB_SHADER_OBJECTS,             NULL) \
    133133
    134 static struct wined3d_context *pCurrentContext = NULL;
    135 static struct wined3d_adapter adapter = {0};
    136 static bool fInitializedLibrary = false;
     134static struct wined3d_context *g_pCurrentContext = NULL;
     135static struct wined3d_adapter g_adapter = {0};
     136static bool g_fInitializedLibrary = false;
    137137
    138138#define SHADER_SET_CURRENT_CONTEXT(ctx) \
    139     pCurrentContext = (struct wined3d_context *)ctx;
    140 
    141 SHADERDECL(int) ShaderInitLib(void)
    142 {
    143     struct wined3d_gl_info *gl_info = &adapter.gl_info;
    144 
     139    g_pCurrentContext = (struct wined3d_context *)ctx;
     140
     141SHADERDECL(int) ShaderInitLib(PVBOXVMSVGASHADERIF pVBoxShaderIf)
     142{
     143    struct wined3d_gl_info *gl_info = &g_adapter.gl_info;
     144
     145    /* Dynamically load all GL core functions. */
    145146#ifdef RT_OS_WINDOWS
    146 #define USE_GL_FUNC(pfn) pfn = (void*)GetProcAddress(GetModuleHandle("opengl32.dll"), #pfn);
     147# define USE_GL_FUNC(pfn) pfn = (void*)GetProcAddress(GetModuleHandle("opengl32.dll"), #pfn);
    147148#else
    148 #define USE_GL_FUNC(pfn) pfn = (void*)OGLGETPROCADDRESS(#pfn);
     149# define USE_GL_FUNC(pfn) pfn = (void*)OGLGETPROCADDRESS(#pfn);
    149150#endif
    150 
    151     /* Dynamically load all GL core functions */
    152151    GL_FUNCS_GEN;
    153152#undef USE_GL_FUNC
    154153
     154    /* Dynamically load all GL extension functions. */
    155155#define USE_GL_FUNC(type, pfn, ext, replace) \
    156156{ \
     
    159159    GL_EXT_FUNCS_GEN;
    160160
    161     IWineD3DImpl_FillGLCaps(&adapter);
    162     fInitializedLibrary = true;
     161    /* Fill in GL capabilities. */
     162    IWineD3DImpl_FillGLCaps(&g_adapter, pVBoxShaderIf);
     163
     164    LogRel(("shaderlib: GL Limits:\n"));
     165    LogRel(("shaderlib:   buffers=%-2u                lights=%-2u                    textures=%-2u            texture_stages=%u\n",
     166            gl_info->limits.buffers, gl_info->limits.lights, gl_info->limits.textures, gl_info->limits.texture_stages));
     167    LogRel(("shaderlib:   fragment_samplers=%-2u      vertex_samplers=%-2u           combined_samplers=%-3u  general_combiners=%u\n",
     168            gl_info->limits.fragment_samplers, gl_info->limits.vertex_samplers, gl_info->limits.combined_samplers, gl_info->limits.general_combiners));
     169    LogRel(("shaderlib:   sampler_stages=%-2u         clipplanes=%-2u                texture_size=%-5u     texture3d_size=%u\n",
     170            gl_info->limits.sampler_stages, gl_info->limits.clipplanes, gl_info->limits.texture_size, gl_info->limits.texture3d_size));
     171    LogRel(("shaderlib:   pointsize_max=%d.%d      pointsize_min=%d.%d            point_sprite_units=%-2u  blends=%u\n",
     172            (int)gl_info->limits.pointsize_max, (int)(gl_info->limits.pointsize_max * 10) % 10,
     173            (int)gl_info->limits.pointsize_min, (int)(gl_info->limits.pointsize_min * 10) % 10,
     174            gl_info->limits.point_sprite_units, gl_info->limits.blends));
     175    LogRel(("shaderlib:   anisotropy=%-2u             shininess=%d.%02d\n",
     176            gl_info->limits.anisotropy, (int)gl_info->limits.shininess, (int)(gl_info->limits.shininess * 100) % 100));
     177    LogRel(("shaderlib:   glsl_varyings=%-3u         glsl_vs_float_constants=%-4u glsl_ps_float_constants=%u\n",
     178            gl_info->limits.glsl_varyings, gl_info->limits.glsl_vs_float_constants, gl_info->limits.glsl_ps_float_constants));
     179    LogRel(("shaderlib:   arb_vs_instructions=%-4u  arb_vs_native_constants=%-4u qarb_vs_float_constants=%u\n",
     180            gl_info->limits.arb_vs_instructions, gl_info->limits.arb_vs_native_constants, gl_info->limits.arb_vs_float_constants));
     181    LogRel(("shaderlib:   arb_vs_temps=%-2u           arb_ps_float_constants=%-4u  arb_ps_local_constants=%u\n",
     182            gl_info->limits.arb_vs_temps, gl_info->limits.arb_ps_float_constants, gl_info->limits.arb_ps_local_constants));
     183    LogRel(("shaderlib:   arb_ps_instructions=%-4u  arb_ps_temps=%-2u              arb_ps_native_constants=%u\n",
     184            gl_info->limits.arb_ps_instructions, gl_info->limits.arb_ps_temps, gl_info->limits.arb_ps_native_constants));
     185
     186    g_fInitializedLibrary = true;
    163187    return VINF_SUCCESS;
    164188}
     
    176200struct wined3d_context *context_get_current(void)
    177201{
    178     return pCurrentContext;
     202    return g_pCurrentContext;
    179203}
    180204
    181205struct wined3d_context *context_acquire(IWineD3DDeviceImpl *This, IWineD3DSurface *target, enum ContextUsage usage)
    182206{
    183     return pCurrentContext;
     207    return g_pCurrentContext;
    184208}
    185209
     
    194218    AssertReturn(pContext->pDeviceContext, VERR_NO_MEMORY);
    195219
    196     pContext->gl_info = &adapter.gl_info;
    197 
    198     pContext->pDeviceContext->adapter = &adapter;
     220    pContext->gl_info = &g_adapter.gl_info;
     221
     222    pContext->pDeviceContext->adapter = &g_adapter;
    199223    pContext->pDeviceContext->shader_backend = &glsl_shader_backend;
    200224    pContext->pDeviceContext->ps_selected_mode = SHADER_GLSL;
     
    204228    list_init(&pContext->pDeviceContext->shaders);
    205229
    206     if (fInitializedLibrary)
     230    if (g_fInitializedLibrary)
    207231    {
    208232        struct shader_caps shader_caps;
     
    214238
    215239        memset(&shader_caps, 0, sizeof(shader_caps));
    216         pContext->pDeviceContext->shader_backend->shader_get_caps(&adapter.gl_info, &shader_caps);
     240        pContext->pDeviceContext->shader_backend->shader_get_caps(&g_adapter.gl_info, &shader_caps);
    217241        pContext->pDeviceContext->d3d_vshader_constantF = shader_caps.MaxVertexShaderConst;
    218242        pContext->pDeviceContext->d3d_pshader_constantF = shader_caps.MaxPixelShaderConst;
     
    290314
    291315    SHADER_SET_CURRENT_CONTEXT(pShaderContext);
    292     This = pCurrentContext->pDeviceContext;
     316    This = g_pCurrentContext->pDeviceContext;
    293317
    294318    object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
     
    324348
    325349    SHADER_SET_CURRENT_CONTEXT(pShaderContext);
    326     This = pCurrentContext->pDeviceContext;
     350    This = g_pCurrentContext->pDeviceContext;
    327351
    328352    object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
     
    379403
    380404    SHADER_SET_CURRENT_CONTEXT(pShaderContext);
    381     This = pCurrentContext->pDeviceContext;
     405    This = g_pCurrentContext->pDeviceContext;
    382406    pShader   = (IWineD3DVertexShader* )pShaderObj;
    383407    oldShader = This->updateStateBlock->vertexShader;
     
    396420    if(oldShader) IWineD3DVertexShader_Release(oldShader);
    397421
    398     pCurrentContext->fChangedVertexShader = true;
    399     pCurrentContext->fChangedVertexShaderConstant = true;    /* force constant reload. */
     422    g_pCurrentContext->fChangedVertexShader = true;
     423    g_pCurrentContext->fChangedVertexShaderConstant = true;    /* force constant reload. */
    400424
    401425    return VINF_SUCCESS;
     
    409433
    410434    SHADER_SET_CURRENT_CONTEXT(pShaderContext);
    411     This = pCurrentContext->pDeviceContext;
     435    This = g_pCurrentContext->pDeviceContext;
    412436    pShader   = (IWineD3DPixelShader* )pShaderObj;
    413437    oldShader = This->updateStateBlock->pixelShader;
     
    426450    if(oldShader) IWineD3DPixelShader_Release(oldShader);
    427451
    428     pCurrentContext->fChangedPixelShader = true;
    429     pCurrentContext->fChangedPixelShaderConstant = true;    /* force constant reload. */
     452    g_pCurrentContext->fChangedPixelShader = true;
     453    g_pCurrentContext->fChangedPixelShaderConstant = true;    /* force constant reload. */
    430454    return VINF_SUCCESS;
    431455}
     
    437461
    438462    SHADER_SET_CURRENT_CONTEXT(pShaderContext);
    439     This = pCurrentContext->pDeviceContext;
     463    This = g_pCurrentContext->pDeviceContext;
    440464
    441465    Log(("(ShaderSetVertexShaderConstantB %p, srcData %p, start %d, count %d)\n",
     
    456480    }
    457481
    458     pCurrentContext->fChangedVertexShaderConstant = true;
     482    g_pCurrentContext->fChangedVertexShaderConstant = true;
    459483
    460484    return VINF_SUCCESS;
     
    467491
    468492    SHADER_SET_CURRENT_CONTEXT(pShaderContext);
    469     This = pCurrentContext->pDeviceContext;
     493    This = g_pCurrentContext->pDeviceContext;
    470494
    471495    Log(("(ShaderSetVertexShaderConstantI %p, srcData %p, start %d, count %d)\n",
     
    484508    }
    485509
    486     pCurrentContext->fChangedVertexShaderConstant = true;
     510    g_pCurrentContext->fChangedVertexShaderConstant = true;
    487511
    488512    return VINF_SUCCESS;
     
    494518
    495519    SHADER_SET_CURRENT_CONTEXT(pShaderContext);
    496     This = pCurrentContext->pDeviceContext;
     520    This = g_pCurrentContext->pDeviceContext;
    497521
    498522    Log(("(ShaderSetVertexShaderConstantF %p, srcData %p, start %d, count %d)\n",
     
    511535           sizeof(*This->updateStateBlock->changed.vertexShaderConstantsF) * count);
    512536
    513     pCurrentContext->fChangedVertexShaderConstant = true;
     537    g_pCurrentContext->fChangedVertexShaderConstant = true;
    514538
    515539    return VINF_SUCCESS;
     
    522546
    523547    SHADER_SET_CURRENT_CONTEXT(pShaderContext);
    524     This = pCurrentContext->pDeviceContext;
     548    This = g_pCurrentContext->pDeviceContext;
    525549
    526550    Log(("(ShaderSetPixelShaderConstantB %p, srcData %p, start %d, count %d)\n",
     
    541565    }
    542566
    543     pCurrentContext->fChangedPixelShaderConstant = true;
     567    g_pCurrentContext->fChangedPixelShaderConstant = true;
    544568
    545569    return VINF_SUCCESS;
     
    552576
    553577    SHADER_SET_CURRENT_CONTEXT(pShaderContext);
    554     This = pCurrentContext->pDeviceContext;
     578    This = g_pCurrentContext->pDeviceContext;
    555579
    556580    Log(("(ShaderSetPixelShaderConstantI %p, srcData %p, start %d, count %d)\n",
     
    569593    }
    570594
    571     pCurrentContext->fChangedPixelShaderConstant = true;
     595    g_pCurrentContext->fChangedPixelShaderConstant = true;
    572596
    573597    return VINF_SUCCESS;
     
    579603
    580604    SHADER_SET_CURRENT_CONTEXT(pShaderContext);
    581     This = pCurrentContext->pDeviceContext;
     605    This = g_pCurrentContext->pDeviceContext;
    582606
    583607    Log(("(ShaderSetPixelShaderConstantF %p, srcData %p, start %d, count %d)\n",
     
    597621            sizeof(*This->updateStateBlock->changed.pixelShaderConstantsF) * count);
    598622
    599     pCurrentContext->fChangedPixelShaderConstant = true;
     623    g_pCurrentContext->fChangedPixelShaderConstant = true;
    600624
    601625    return VINF_SUCCESS;
     
    609633
    610634    SHADER_SET_CURRENT_CONTEXT(pShaderContext);
    611     pThis = pCurrentContext->pDeviceContext;
     635    pThis = g_pCurrentContext->pDeviceContext;
    612636
    613637    glGetIntegerv(GL_VIEWPORT, viewport);
     
    630654     */
    631655
    632     if (    pCurrentContext->fChangedPixelShader
    633         ||  pCurrentContext->fChangedVertexShader)
    634         pThis->shader_backend->shader_select(pCurrentContext, !!pThis->updateStateBlock->pixelShader, !!pThis->updateStateBlock->vertexShader);
    635     pCurrentContext->fChangedPixelShader = pCurrentContext->fChangedVertexShader = false;
    636 
    637     if (    pCurrentContext->fChangedPixelShaderConstant
    638         ||  pCurrentContext->fChangedVertexShaderConstant)
    639         pThis->shader_backend->shader_load_constants(pCurrentContext, !!pThis->updateStateBlock->pixelShader, !!pThis->updateStateBlock->vertexShader);
    640     pCurrentContext->fChangedPixelShaderConstant  = false;
    641     pCurrentContext->fChangedVertexShaderConstant = false;
     656    if (    g_pCurrentContext->fChangedPixelShader
     657        ||  g_pCurrentContext->fChangedVertexShader)
     658        pThis->shader_backend->shader_select(g_pCurrentContext, !!pThis->updateStateBlock->pixelShader, !!pThis->updateStateBlock->vertexShader);
     659    g_pCurrentContext->fChangedPixelShader = g_pCurrentContext->fChangedVertexShader = false;
     660
     661    if (    g_pCurrentContext->fChangedPixelShaderConstant
     662        ||  g_pCurrentContext->fChangedVertexShaderConstant)
     663        pThis->shader_backend->shader_load_constants(g_pCurrentContext, !!pThis->updateStateBlock->pixelShader, !!pThis->updateStateBlock->vertexShader);
     664    g_pCurrentContext->fChangedPixelShaderConstant  = false;
     665    g_pCurrentContext->fChangedVertexShaderConstant = false;
    642666
    643667    return VINF_SUCCESS;
  • trunk/src/VBox/Devices/Graphics/shaderlib/shaderlib.h

    r53725 r53755  
    3030#endif
    3131
     32/** Pointer to shaderlib callback interface. */
     33typedef struct VBOXVMSVGASHADERIF *PVBOXVMSVGASHADERIF;
     34/**
     35 * Interface the shader lib can use to talk back to the VBox VMSVGA OGL 3D code.
     36 */
     37typedef struct VBOXVMSVGASHADERIF
     38{
     39    /**
     40     * Switches the initialization profile in builds where we have to juggle two
     41     * OpenGL profiles to gather all the data (i.e. mac os x).
     42     *
     43     * @param   pThis           Pointer to this structure.
     44     * @param   fOtherProfile   If set, switch to the non-default profile.  If
     45     *                          clear, switch back to the default profile.
     46     */
     47    DECLCALLBACKMEMBER(void, pfnSwitchInitProfile)(PVBOXVMSVGASHADERIF pThis, bool fOtherProfile);
    3248
    33 SHADERDECL(int) ShaderInitLib(void);
     49    /**
     50     * Extension enumeration function.
     51     *
     52     * @param   pThis           Pointer to this structure.
     53     * @param   ppvEnumCtx      Pointer to a void point that's initialized to NULL
     54     *                          before the first call.
     55     * @param   pszBuf          Where to store the extension name. Garbled on
     56     *                          overflow (we assume no overflow).
     57     * @param   cbBuf           The size of the buffer @a pszBuf points to.
     58     * @param   fOtherProfile   Indicates which profile to get extensions from,
     59     *                          we'll use the default profile if CLEAR and the
     60     *                          non-default if SET.
     61     */
     62    DECLCALLBACKMEMBER(bool, pfnGetNextExtension)(PVBOXVMSVGASHADERIF pThis, void **ppvEnumCtx, char *pszBuf, size_t cbBuf,
     63                                                  bool fOtherProfile);
     64} VBOXVMSVGASHADERIF;
     65
     66SHADERDECL(int) ShaderInitLib(PVBOXVMSVGASHADERIF pVBoxShaderIf);
    3467SHADERDECL(int) ShaderDestroyLib(void);
    3568
  • trunk/src/VBox/Devices/Graphics/shaderlib/wine/include/d3d9caps.h

    r53741 r53755  
    292292#define D3DMAX30SHADERINSTRUCTIONS          32768
    293293
    294 #ifndef VBOX_D3D9CAPS_ONLY_DEFINES
    295294
    296295typedef struct _D3DVSHADERCAPS2_0 {
     
    403402} D3DCAPS9;
    404403
    405 #endif /* !VBOX_D3D9CAPS_ONLY_DEFINES */
    406 
    407404#endif
  • trunk/src/VBox/Devices/Graphics/shaderlib/wined3d_private.h

    r53747 r53755  
    6969# include <VBox/log.h>
    7070# include "winoverride.h"
     71# include "shaderlib.h"
    7172#endif
    7273
     
    15961597extern void add_gl_compat_wrappers(struct wined3d_gl_info *gl_info) DECLSPEC_HIDDEN;
    15971598
    1598 extern BOOL IWineD3DImpl_FillGLCaps(struct wined3d_adapter *adapter);
     1599struct VBOXVMSVGASHADERIF;
     1600extern BOOL IWineD3DImpl_FillGLCaps(struct wined3d_adapter *adapter, struct VBOXVMSVGASHADERIF *pVBoxShaderIf);
    15991601
    16001602
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