VirtualBox

Changeset 20617 in vbox for trunk/src/VBox/Additions


Ignore:
Timestamp:
Jun 16, 2009 10:00:45 AM (16 years ago)
Author:
vboxsync
Message:

crOpenGL: check for host 2.0 support before exporting pre 2.0 arb extension strings

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_getstring.c

    r20468 r20617  
    1515static GLubyte gpszShadingVersion[255]="";
    1616#endif
     17
     18static void GetString(GLenum name, char *pszStr)
     19{
     20    GET_THREAD(thread);
     21    int writeback = 1;
     22
     23    if (pack_spu.swap)
     24        crPackGetStringSWAP(name, pszStr, &writeback);
     25    else
     26        crPackGetString(name, pszStr, &writeback);
     27    packspuFlush( (void *) thread );
     28
     29    while (writeback)
     30        crNetRecv();
     31}
     32
     33static GLfloat
     34GetVersionString(void)
     35{
     36    GLubyte return_value[100];
     37    GLfloat version;
     38
     39    GetString(GL_VERSION, return_value);
     40    CRASSERT(crStrlen((char *)return_value) < 100);
     41
     42    version = crStrToFloat((char *) return_value);
     43    version = crStateComputeVersion(version);
     44
     45    return version;
     46}
    1747
    1848static const GLubyte *
     
    4777
    4878#ifdef CR_OPENGL_VERSION_2_0
    49     /* @todo, check if host supports opengl 2.0 or this extension
    50      * before exporting it.
     79    /* @todo move to known extensions etc, for now just a hack.
    5180     */
    52     sprintf(gpszExtensions, "%sGL_ARB_shading_language_100 GL_ARB_shader_objects GL_ARB_vertex_shader GL_ARB_fragment_shader", ext);
     81    {
     82        GLfloat fversion = GetVersionString();
     83        if (fversion>=2.f)
     84        {
     85            sprintf(gpszExtensions, "%sGL_ARB_shading_language_100 GL_ARB_shader_objects GL_ARB_vertex_shader GL_ARB_fragment_shader", ext);
     86        }
     87    }
    5388#else
    5489    sprintf(gpszExtensions, "%s", ext);
     
    5691
    5792    return gpszExtensions;
    58 }
    59 
    60 static void GetString(GLenum name, char *pszStr)
    61 {
    62     GET_THREAD(thread);
    63     int writeback = 1;
    64 
    65     if (pack_spu.swap)
    66         crPackGetStringSWAP(name, pszStr, &writeback);
    67     else
    68         crPackGetString(name, pszStr, &writeback);
    69     packspuFlush( (void *) thread );
    70 
    71     while (writeback)
    72         crNetRecv();
    73 }
    74 
    75 static GLfloat
    76 GetVersionString(void)
    77 {
    78     GLubyte return_value[100];
    79     int writeback = 1;
    80     GLfloat version;
    81 
    82     GetString(GL_VERSION, return_value);
    83     CRASSERT(crStrlen((char *)return_value) < 100);
    84 
    85     version = crStrToFloat((char *) return_value);
    86     version = crStateComputeVersion(version);
    87 
    88     return version;
    8993}
    9094
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