VirtualBox

Changeset 35031 in vbox


Ignore:
Timestamp:
Dec 13, 2010 4:34:04 PM (14 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
68860
Message:

crOpenGL: fix opengl for mesa 7.9

File:
1 edited

Legend:

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

    r34211 r35031  
    9696#endif
    9797
    98 static struct _glapi_table vbox_glapi_table;
     98static struct _glapi_table* vbox_glapi_table = NULL;
    9999fakedri_glxapi_table glxim;
    100100
     
    105105extern const __DRIextension * __driDriverExtensions[];
    106106
    107 #define GLAPI_ENTRY(Func) pGLTable->Func = cr_gl##Func;
    108 static void
    109 vboxFillMesaGLAPITable(struct _glapi_table *pGLTable)
    110 {
     107#define GLAPI_ENTRY(Func) SET_by_offset(vbox_glapi_table, _glapi_get_proc_offset("gl"#Func), cr_gl##Func);
     108
     109static void
     110vboxPatchMesaGLAPITable()
     111{
     112    void *pGLTable;
     113
     114    pGLTable = (void *)_glapi_get_dispatch();
     115    vbox_glapi_table = crAlloc(_glapi_get_dispatch_table_size() * sizeof (void *));
     116    if (!vbox_glapi_table)
     117    {
     118        crError("Not enough memory to allocate dispatch table");
     119    }
     120    crMemcpy(vbox_glapi_table, pGLTable, _glapi_get_dispatch_table_size() * sizeof (void *));
     121
    111122    #include "fakedri_glfuncsList.h"
    112123
    113     pGLTable->SampleMaskSGIS = cr_glSampleMaskEXT;
    114     pGLTable->SamplePatternSGIS = cr_glSamplePatternEXT;
    115     pGLTable->WindowPos2dMESA = cr_glWindowPos2d;
    116     pGLTable->WindowPos2dvMESA = cr_glWindowPos2dv;
    117     pGLTable->WindowPos2fMESA = cr_glWindowPos2f;
    118     pGLTable->WindowPos2fvMESA = cr_glWindowPos2fv;
    119     pGLTable->WindowPos2iMESA = cr_glWindowPos2i;
    120     pGLTable->WindowPos2ivMESA = cr_glWindowPos2iv;
    121     pGLTable->WindowPos2sMESA = cr_glWindowPos2s;
    122     pGLTable->WindowPos2svMESA = cr_glWindowPos2sv;
    123     pGLTable->WindowPos3dMESA = cr_glWindowPos3d;
    124     pGLTable->WindowPos3dvMESA = cr_glWindowPos3dv;
    125     pGLTable->WindowPos3fMESA = cr_glWindowPos3f;
    126     pGLTable->WindowPos3fvMESA = cr_glWindowPos3fv;
    127     pGLTable->WindowPos3iMESA = cr_glWindowPos3i;
    128     pGLTable->WindowPos3ivMESA = cr_glWindowPos3iv;
    129     pGLTable->WindowPos3sMESA = cr_glWindowPos3s;
    130     pGLTable->WindowPos3svMESA = cr_glWindowPos3sv;
     124    SET_by_offset(vbox_glapi_table, _glapi_get_proc_offset("glSampleMaskSGIS"), cr_glSampleMaskEXT);
     125    SET_by_offset(vbox_glapi_table, _glapi_get_proc_offset("glSamplePatternSGIS"), cr_glSamplePatternEXT);
     126    SET_by_offset(vbox_glapi_table, _glapi_get_proc_offset("glWindowPos2dMESA"), cr_glWindowPos2d);
     127    SET_by_offset(vbox_glapi_table, _glapi_get_proc_offset("glWindowPos2dvMESA"), cr_glWindowPos2dv);
     128    SET_by_offset(vbox_glapi_table, _glapi_get_proc_offset("glWindowPos2fMESA"), cr_glWindowPos2f);
     129    SET_by_offset(vbox_glapi_table, _glapi_get_proc_offset("glWindowPos2fvMESA"), cr_glWindowPos2fv);
     130    SET_by_offset(vbox_glapi_table, _glapi_get_proc_offset("glWindowPos2iMESA"), cr_glWindowPos2i);
     131    SET_by_offset(vbox_glapi_table, _glapi_get_proc_offset("glWindowPos2ivMESA"), cr_glWindowPos2iv);
     132    SET_by_offset(vbox_glapi_table, _glapi_get_proc_offset("glWindowPos2sMESA"), cr_glWindowPos2s);
     133    SET_by_offset(vbox_glapi_table, _glapi_get_proc_offset("glWindowPos2svMESA"), cr_glWindowPos2sv);
     134    SET_by_offset(vbox_glapi_table, _glapi_get_proc_offset("glWindowPos3dMESA"), cr_glWindowPos3d);
     135    SET_by_offset(vbox_glapi_table, _glapi_get_proc_offset("glWindowPos3dvMESA"), cr_glWindowPos3dv);
     136    SET_by_offset(vbox_glapi_table, _glapi_get_proc_offset("glWindowPos3fMESA"), cr_glWindowPos3f);
     137    SET_by_offset(vbox_glapi_table, _glapi_get_proc_offset("glWindowPos3fvMESA"), cr_glWindowPos3fv);
     138    SET_by_offset(vbox_glapi_table, _glapi_get_proc_offset("glWindowPos3iMESA"), cr_glWindowPos3i);
     139    SET_by_offset(vbox_glapi_table, _glapi_get_proc_offset("glWindowPos3ivMESA"), cr_glWindowPos3iv);
     140    SET_by_offset(vbox_glapi_table, _glapi_get_proc_offset("glWindowPos3sMESA"), cr_glWindowPos3s);
     141    SET_by_offset(vbox_glapi_table, _glapi_get_proc_offset("glWindowPos3svMESA"), cr_glWindowPos3sv);
     142
     143    _glapi_set_dispatch(vbox_glapi_table);
    131144};
    132145#undef GLAPI_ENTRY
     
    553566     * app call glFoo->(mesa asm dispatch stub)->cr_glFoo(vbox asm dispatch stub)->SPU Foo function(packspuFoo or alike)
    554567     * Note, we don't need to install extension functions via _glapi_add_dispatch, because we'd override glXGetProcAddress.
    555      */   
    556     /* We don't support all mesa's functions. Initialize our table to mesa dispatch first*/
    557     crMemcpy(&vbox_glapi_table, _glapi_get_dispatch(), sizeof(struct _glapi_table));
    558     /* Now install our assembly dispatch entries into table */
    559     vboxFillMesaGLAPITable(&vbox_glapi_table);
    560     /* Install our dispatch table into mesa */
    561     _glapi_set_dispatch(&vbox_glapi_table);
     568     */
     569    /* Mesa's dispatch table is different across library versions, have to modify mesa's table using offset info functions*/
     570    vboxPatchMesaGLAPITable();
    562571
    563572    /* Handle glx api.
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