VirtualBox

Ignore:
Timestamp:
Jan 26, 2009 10:26:43 AM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
42009
Message:

crOpenGL: tabs to spaces

Location:
trunk/src/VBox/Additions/WINNT/Graphics/crOpenGL
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/Graphics/crOpenGL/wgl.c

    r15532 r16219  
    2626static GLuint ComputeVisBits( HDC hdc )
    2727{
    28         PIXELFORMATDESCRIPTOR pfd;
    29         int iPixelFormat;
    30         GLuint b = 0;
    31 
    32         iPixelFormat = GetPixelFormat( hdc );
    33 
    34         DescribePixelFormat( hdc, iPixelFormat, sizeof(pfd), &pfd );
    35 
    36         if (pfd.cDepthBits > 0)
    37                 b |= CR_DEPTH_BIT;
    38         if (pfd.cAccumBits > 0)
    39                 b |= CR_ACCUM_BIT;
    40         if (pfd.cColorBits > 8)
    41                 b |= CR_RGB_BIT;
    42         if (pfd.cStencilBits > 0)
    43                 b |= CR_STENCIL_BIT;
    44         if (pfd.cAlphaBits > 0)
    45                 b |= CR_ALPHA_BIT;
    46         if (pfd.dwFlags & PFD_DOUBLEBUFFER)
    47                 b |= CR_DOUBLE_BIT;
    48         if (pfd.dwFlags & PFD_STEREO)
    49                 b |= CR_STEREO_BIT;
    50 
    51         return b;
     28    PIXELFORMATDESCRIPTOR pfd;
     29    int iPixelFormat;
     30    GLuint b = 0;
     31
     32    iPixelFormat = GetPixelFormat( hdc );
     33
     34    DescribePixelFormat( hdc, iPixelFormat, sizeof(pfd), &pfd );
     35
     36    if (pfd.cDepthBits > 0)
     37        b |= CR_DEPTH_BIT;
     38    if (pfd.cAccumBits > 0)
     39        b |= CR_ACCUM_BIT;
     40    if (pfd.cColorBits > 8)
     41        b |= CR_RGB_BIT;
     42    if (pfd.cStencilBits > 0)
     43        b |= CR_STENCIL_BIT;
     44    if (pfd.cAlphaBits > 0)
     45        b |= CR_ALPHA_BIT;
     46    if (pfd.dwFlags & PFD_DOUBLEBUFFER)
     47        b |= CR_DOUBLE_BIT;
     48    if (pfd.dwFlags & PFD_STEREO)
     49        b |= CR_STEREO_BIT;
     50
     51    return b;
    5252}
    5353
    5454int WINAPI wglChoosePixelFormat_prox( HDC hdc, CONST PIXELFORMATDESCRIPTOR *pfd )
    5555{
    56         DWORD okayFlags;
    57 
    58         stubInit();
    59 
    60         /*
    61         * NOTE!!!
    62         * Here we're telling the renderspu not to use the GDI
    63         * equivalent's of ChoosePixelFormat/DescribePixelFormat etc
    64         * There are subtle differences in the use of these calls.
    65         */
    66         crSetenv("CR_WGL_DO_NOT_USE_GDI", "yes");
    67 
    68         if ( pfd->nSize != sizeof(*pfd) || pfd->nVersion != 1 ) {
    69                 crError( "wglChoosePixelFormat: bad pfd\n" );
    70                 return 0;
    71         }
    72 
    73         okayFlags = ( PFD_DRAW_TO_WINDOW        |
    74                         PFD_SUPPORT_GDI           |
    75                         PFD_SUPPORT_OPENGL        |
    76                         PFD_DOUBLEBUFFER          |
    77                         PFD_DOUBLEBUFFER_DONTCARE |
    78                         PFD_SWAP_EXCHANGE         |
    79                         PFD_SWAP_COPY             |
    80                         PFD_STEREO                |
    81                         PFD_STEREO_DONTCARE       |
    82                         PFD_DEPTH_DONTCARE        );
    83         if ( pfd->dwFlags & ~okayFlags ) {
    84                 crWarning( "wglChoosePixelFormat: only support flags=0x%x, but you gave me flags=0x%x", okayFlags, pfd->dwFlags );
    85                 return 0;
    86         }
    87 
    88         if ( pfd->iPixelType != PFD_TYPE_RGBA ) {
    89                 crError( "wglChoosePixelFormat: only support RGBA\n" );
    90         }
    91 
    92         if ( pfd->cColorBits > 32 ||
    93                         pfd->cRedBits   > 8  ||
    94                         pfd->cGreenBits > 8  ||
    95                         pfd->cBlueBits  > 8  ||
    96                         pfd->cAlphaBits > 8 ) {
    97                 crWarning( "wglChoosePixelFormat: too much color precision requested\n" );
    98         }
    99 
    100         if ( pfd->dwFlags & PFD_DOUBLEBUFFER )
    101                 desiredVisual |= CR_DOUBLE_BIT;
    102 
    103         if ( pfd->dwFlags & PFD_STEREO )
    104                 desiredVisual |= CR_STEREO_BIT;
    105 
    106         if ( pfd->cColorBits > 8)
    107                 desiredVisual |= CR_RGB_BIT;
    108 
    109         if ( pfd->cAccumBits      > 0 ||
    110                         pfd->cAccumRedBits   > 0 ||
    111                         pfd->cAccumGreenBits > 0 ||
    112                         pfd->cAccumBlueBits  > 0 ||
    113                         pfd->cAccumAlphaBits > 0 ) {
    114                 crWarning( "wglChoosePixelFormat: asked for accumulation buffer, ignoring\n" );
    115         }
    116 
    117         if ( pfd->cAccumBits > 0 )
    118                 desiredVisual |= CR_ACCUM_BIT;
    119 
    120         if ( pfd->cDepthBits > 32 ) {
    121                 crError( "wglChoosePixelFormat; asked for too many depth bits\n" );
    122         }
    123        
    124         if ( pfd->cDepthBits > 0 )
    125                 desiredVisual |= CR_DEPTH_BIT;
    126 
    127         if ( pfd->cStencilBits > 8 ) {
    128                 crError( "wglChoosePixelFormat: asked for too many stencil bits\n" );
    129         }
    130 
    131         if ( pfd->cStencilBits > 0 )
    132                 desiredVisual |= CR_STENCIL_BIT;
    133 
    134         if ( pfd->cAuxBuffers > 0 ) {
    135                 crError( "wglChoosePixelFormat: asked for aux buffers\n" );
    136         }
    137 
    138         if ( pfd->iLayerType != PFD_MAIN_PLANE ) {
    139                 crError( "wglChoosePixelFormat: asked for a strange layer\n" );
    140         }
    141 
    142         return 1;
     56    DWORD okayFlags;
     57
     58    stubInit();
     59
     60    /*
     61    * NOTE!!!
     62    * Here we're telling the renderspu not to use the GDI
     63    * equivalent's of ChoosePixelFormat/DescribePixelFormat etc
     64    * There are subtle differences in the use of these calls.
     65    */
     66    crSetenv("CR_WGL_DO_NOT_USE_GDI", "yes");
     67
     68    if ( pfd->nSize != sizeof(*pfd) || pfd->nVersion != 1 ) {
     69        crError( "wglChoosePixelFormat: bad pfd\n" );
     70        return 0;
     71    }
     72
     73    okayFlags = ( PFD_DRAW_TO_WINDOW        |
     74            PFD_SUPPORT_GDI           |
     75            PFD_SUPPORT_OPENGL        |
     76            PFD_DOUBLEBUFFER          |
     77            PFD_DOUBLEBUFFER_DONTCARE |
     78            PFD_SWAP_EXCHANGE         |
     79            PFD_SWAP_COPY             |
     80            PFD_STEREO            |
     81            PFD_STEREO_DONTCARE       |
     82            PFD_DEPTH_DONTCARE        );
     83    if ( pfd->dwFlags & ~okayFlags ) {
     84        crWarning( "wglChoosePixelFormat: only support flags=0x%x, but you gave me flags=0x%x", okayFlags, pfd->dwFlags );
     85        return 0;
     86    }
     87
     88    if ( pfd->iPixelType != PFD_TYPE_RGBA ) {
     89        crError( "wglChoosePixelFormat: only support RGBA\n" );
     90    }
     91
     92    if ( pfd->cColorBits > 32 ||
     93            pfd->cRedBits   > 8  ||
     94            pfd->cGreenBits > 8  ||
     95            pfd->cBlueBits  > 8  ||
     96            pfd->cAlphaBits > 8 ) {
     97        crWarning( "wglChoosePixelFormat: too much color precision requested\n" );
     98    }
     99
     100    if ( pfd->dwFlags & PFD_DOUBLEBUFFER )
     101        desiredVisual |= CR_DOUBLE_BIT;
     102
     103    if ( pfd->dwFlags & PFD_STEREO )
     104        desiredVisual |= CR_STEREO_BIT;
     105
     106    if ( pfd->cColorBits > 8)
     107        desiredVisual |= CR_RGB_BIT;
     108
     109    if ( pfd->cAccumBits      > 0 ||
     110            pfd->cAccumRedBits   > 0 ||
     111            pfd->cAccumGreenBits > 0 ||
     112            pfd->cAccumBlueBits  > 0 ||
     113            pfd->cAccumAlphaBits > 0 ) {
     114        crWarning( "wglChoosePixelFormat: asked for accumulation buffer, ignoring\n" );
     115    }
     116
     117    if ( pfd->cAccumBits > 0 )
     118        desiredVisual |= CR_ACCUM_BIT;
     119
     120    if ( pfd->cDepthBits > 32 ) {
     121        crError( "wglChoosePixelFormat; asked for too many depth bits\n" );
     122    }
     123   
     124    if ( pfd->cDepthBits > 0 )
     125        desiredVisual |= CR_DEPTH_BIT;
     126
     127    if ( pfd->cStencilBits > 8 ) {
     128        crError( "wglChoosePixelFormat: asked for too many stencil bits\n" );
     129    }
     130
     131    if ( pfd->cStencilBits > 0 )
     132        desiredVisual |= CR_STENCIL_BIT;
     133
     134    if ( pfd->cAuxBuffers > 0 ) {
     135        crError( "wglChoosePixelFormat: asked for aux buffers\n" );
     136    }
     137
     138    if ( pfd->iLayerType != PFD_MAIN_PLANE ) {
     139        crError( "wglChoosePixelFormat: asked for a strange layer\n" );
     140    }
     141
     142    return 1;
    143143}
    144144
    145145BOOL WINAPI wglSetPixelFormat_prox( HDC hdc, int pixelFormat,
    146                 CONST PIXELFORMATDESCRIPTOR *pdf )
    147 {
    148         if ( pixelFormat != 1 ) {
    149                 crError( "wglSetPixelFormat: pixelFormat=%d?\n", pixelFormat );
    150         }
    151 
    152         return 1;
     146        CONST PIXELFORMATDESCRIPTOR *pdf )
     147{
     148    if ( pixelFormat != 1 ) {
     149        crError( "wglSetPixelFormat: pixelFormat=%d?\n", pixelFormat );
     150    }
     151
     152    return 1;
    153153}
    154154
    155155BOOL WINAPI wglDeleteContext_prox( HGLRC hglrc )
    156156{
    157         stubDestroyContext( (unsigned long) hglrc );
    158         return 1;
     157    stubDestroyContext( (unsigned long) hglrc );
     158    return 1;
    159159}
    160160
    161161BOOL WINAPI wglMakeCurrent_prox( HDC hdc, HGLRC hglrc )
    162162{
    163         ContextInfo *context;
    164         WindowInfo *window;
    165 
    166         context = (ContextInfo *) crHashtableSearch(stub.contextTable, (unsigned long) hglrc);
    167         window = stubGetWindowInfo(hdc);
    168 
    169         return stubMakeCurrent( window, context );
     163    ContextInfo *context;
     164    WindowInfo *window;
     165
     166    context = (ContextInfo *) crHashtableSearch(stub.contextTable, (unsigned long) hglrc);
     167    window = stubGetWindowInfo(hdc);
     168
     169    return stubMakeCurrent( window, context );
    170170}
    171171
    172172HGLRC WINAPI wglGetCurrentContext_prox( void )
    173173{
    174         return (HGLRC) stub.currentContext;
     174    return (HGLRC) stub.currentContext;
    175175}
    176176
    177177HDC WINAPI wglGetCurrentDC_prox( void )
    178178{
    179         if (stub.currentContext && stub.currentContext->currentDrawable)
    180                 return (HDC) stub.currentContext->currentDrawable->drawable;
    181         else
    182                 return (HDC) NULL;
     179    if (stub.currentContext && stub.currentContext->currentDrawable)
     180        return (HDC) stub.currentContext->currentDrawable->drawable;
     181    else
     182        return (HDC) NULL;
    183183}
    184184
    185185int WINAPI wglGetPixelFormat_prox( HDC hdc )
    186186{
    187         /* this is what we call our generic pixelformat, regardless of the HDC */
    188         return 1;
     187    /* this is what we call our generic pixelformat, regardless of the HDC */
     188    return 1;
    189189}
    190190
    191191int WINAPI wglDescribePixelFormat_prox( HDC hdc, int pixelFormat, UINT nBytes,
    192                 LPPIXELFORMATDESCRIPTOR pfd )
    193 {
    194 /*      if ( pixelFormat != 1 ) {
    195  *              crError( "wglDescribePixelFormat: pixelFormat=%d?\n", pixelFormat );
    196  *              return 0;
    197  *      } */
    198 
    199         if ( !pfd ) {
    200                 crWarning( "wglDescribePixelFormat: pfd=NULL\n" );
    201                 return 1; /* There's only one, baby */
    202         }
    203 
    204         if ( nBytes != sizeof(*pfd) ) {
    205                 crWarning( "wglDescribePixelFormat: nBytes=%u?\n", nBytes );
    206                 return 1; /* There's only one, baby */
    207         }
    208 
    209         pfd->nSize           = sizeof(*pfd);
    210         pfd->nVersion        = 1;
    211         pfd->dwFlags         = ( PFD_DRAW_TO_WINDOW |
    212                                 PFD_SUPPORT_GDI    |
    213                                 PFD_SUPPORT_OPENGL |
    214                                 PFD_DOUBLEBUFFER );
    215         pfd->iPixelType      = PFD_TYPE_RGBA;
    216         pfd->cColorBits      = 32;
    217         pfd->cRedBits        = 8;
    218         pfd->cRedShift       = 24;
    219         pfd->cGreenBits      = 8;
    220         pfd->cGreenShift     = 16;
    221         pfd->cBlueBits       = 8;
    222         pfd->cBlueShift      = 8;
    223         pfd->cAlphaBits      = 8;
    224         pfd->cAlphaShift     = 0;
    225         pfd->cAccumBits      = 0;
    226         pfd->cAccumRedBits   = 0;
    227         pfd->cAccumGreenBits = 0;
    228         pfd->cAccumBlueBits  = 0;
    229         pfd->cAccumAlphaBits = 0;
    230         pfd->cDepthBits      = 32;
    231         pfd->cStencilBits    = 8;
    232         pfd->cAuxBuffers     = 0;
    233         pfd->iLayerType      = PFD_MAIN_PLANE;
    234         pfd->bReserved       = 0;
    235         pfd->dwLayerMask     = 0;
    236         pfd->dwVisibleMask   = 0;
    237         pfd->dwDamageMask    = 0;
    238 
    239         /* the max PFD index */
    240         return 1;
     192        LPPIXELFORMATDESCRIPTOR pfd )
     193{
     194/*  if ( pixelFormat != 1 ) {
     195 *      crError( "wglDescribePixelFormat: pixelFormat=%d?\n", pixelFormat );
     196 *      return 0;
     197 *  } */
     198
     199    if ( !pfd ) {
     200        crWarning( "wglDescribePixelFormat: pfd=NULL\n" );
     201        return 1; /* There's only one, baby */
     202    }
     203
     204    if ( nBytes != sizeof(*pfd) ) {
     205        crWarning( "wglDescribePixelFormat: nBytes=%u?\n", nBytes );
     206        return 1; /* There's only one, baby */
     207    }
     208
     209    pfd->nSize           = sizeof(*pfd);
     210    pfd->nVersion        = 1;
     211    pfd->dwFlags         = ( PFD_DRAW_TO_WINDOW |
     212                PFD_SUPPORT_GDI    |
     213                PFD_SUPPORT_OPENGL |
     214                PFD_DOUBLEBUFFER );
     215    pfd->iPixelType      = PFD_TYPE_RGBA;
     216    pfd->cColorBits      = 32;
     217    pfd->cRedBits        = 8;
     218    pfd->cRedShift       = 24;
     219    pfd->cGreenBits      = 8;
     220    pfd->cGreenShift     = 16;
     221    pfd->cBlueBits       = 8;
     222    pfd->cBlueShift      = 8;
     223    pfd->cAlphaBits      = 8;
     224    pfd->cAlphaShift     = 0;
     225    pfd->cAccumBits      = 0;
     226    pfd->cAccumRedBits   = 0;
     227    pfd->cAccumGreenBits = 0;
     228    pfd->cAccumBlueBits  = 0;
     229    pfd->cAccumAlphaBits = 0;
     230    pfd->cDepthBits      = 32;
     231    pfd->cStencilBits    = 8;
     232    pfd->cAuxBuffers     = 0;
     233    pfd->iLayerType      = PFD_MAIN_PLANE;
     234    pfd->bReserved       = 0;
     235    pfd->dwLayerMask     = 0;
     236    pfd->dwVisibleMask   = 0;
     237    pfd->dwDamageMask    = 0;
     238
     239    /* the max PFD index */
     240    return 1;
    241241}
    242242
    243243BOOL WINAPI wglShareLists_prox( HGLRC hglrc1, HGLRC hglrc2 )
    244244{
    245         crWarning( "wglShareLists: unsupported" );
    246         return 0;
     245    crWarning( "wglShareLists: unsupported" );
     246    return 0;
    247247}
    248248
     
    250250HGLRC WINAPI wglCreateContext_prox( HDC hdc )
    251251{
    252         char dpyName[MAX_DPY_NAME];
    253         ContextInfo *context;
    254 
    255         stubInit();
    256 
    257         CRASSERT(stub.contextTable);
    258 
    259         sprintf(dpyName, "%d", hdc);
    260         if (stub.haveNativeOpenGL)
    261                 desiredVisual |= ComputeVisBits( hdc );
    262 
    263         context = stubNewContext(dpyName, desiredVisual, UNDECIDED, 0);
    264         if (!context)
    265                 return 0;
    266 
    267         return (HGLRC) context->id;
     252    char dpyName[MAX_DPY_NAME];
     253    ContextInfo *context;
     254
     255    stubInit();
     256
     257    CRASSERT(stub.contextTable);
     258
     259    sprintf(dpyName, "%d", hdc);
     260    if (stub.haveNativeOpenGL)
     261        desiredVisual |= ComputeVisBits( hdc );
     262
     263    context = stubNewContext(dpyName, desiredVisual, UNDECIDED, 0);
     264    if (!context)
     265        return 0;
     266
     267    return (HGLRC) context->id;
    268268}
    269269
     
    271271wglSwapBuffers_prox( HDC hdc )
    272272{
    273         const WindowInfo *window = stubGetWindowInfo(hdc);
    274         stubSwapBuffers( window, 0 );
    275         return 1;
     273    const WindowInfo *window = stubGetWindowInfo(hdc);
     274    stubSwapBuffers( window, 0 );
     275    return 1;
    276276}
    277277
    278278BOOL WINAPI wglCopyContext_prox( HGLRC src, HGLRC dst, UINT mask )
    279279{
    280         crWarning( "wglCopyContext: unsupported" );
    281         return 0;
     280    crWarning( "wglCopyContext: unsupported" );
     281    return 0;
    282282}
    283283
    284284HGLRC WINAPI wglCreateLayerContext_prox( HDC hdc, int layerPlane )
    285285{
    286         stubInit();
    287         crWarning( "wglCreateLayerContext: unsupported" );
    288         return 0;
     286    stubInit();
     287    crWarning( "wglCreateLayerContext: unsupported" );
     288    return 0;
    289289}
    290290
    291291PROC WINAPI wglGetProcAddress_prox( LPCSTR name )
    292292{
    293         return (PROC) crGetProcAddress( name );
     293    return (PROC) crGetProcAddress( name );
    294294}
    295295
    296296BOOL WINAPI wglUseFontBitmapsA_prox( HDC hdc, DWORD first, DWORD count, DWORD listBase )
    297297{
    298         crWarning( "wglUseFontBitmapsA: unsupported" );
    299         return 0;
     298    crWarning( "wglUseFontBitmapsA: unsupported" );
     299    return 0;
    300300}
    301301
    302302BOOL WINAPI wglUseFontBitmapsW_prox( HDC hdc, DWORD first, DWORD count, DWORD listBase )
    303303{
    304         crWarning( "wglUseFontBitmapsW: unsupported" );
    305         return 0;
     304    crWarning( "wglUseFontBitmapsW: unsupported" );
     305    return 0;
    306306}
    307307
    308308BOOL WINAPI wglDescribeLayerPlane_prox( HDC hdc, int pixelFormat, int layerPlane,
    309                 UINT nBytes, LPLAYERPLANEDESCRIPTOR lpd )
    310 {
    311         crWarning( "wglDescribeLayerPlane: unimplemented" );
    312         return 0;
     309        UINT nBytes, LPLAYERPLANEDESCRIPTOR lpd )
     310{
     311    crWarning( "wglDescribeLayerPlane: unimplemented" );
     312    return 0;
    313313}
    314314
    315315int WINAPI wglSetLayerPaletteEntries_prox( HDC hdc, int layerPlane, int start,
    316                 int entries, CONST COLORREF *cr )
    317 {
    318         crWarning( "wglSetLayerPaletteEntries: unsupported" );
    319         return 0;
     316        int entries, CONST COLORREF *cr )
     317{
     318    crWarning( "wglSetLayerPaletteEntries: unsupported" );
     319    return 0;
    320320}
    321321
    322322int WINAPI wglGetLayerPaletteEntries_prox( HDC hdc, int layerPlane, int start,
    323                 int entries, COLORREF *cr )
    324 {
    325         crWarning( "wglGetLayerPaletteEntries: unsupported" );
    326         return 0;
     323        int entries, COLORREF *cr )
     324{
     325    crWarning( "wglGetLayerPaletteEntries: unsupported" );
     326    return 0;
    327327}
    328328
    329329BOOL WINAPI wglRealizeLayerPalette_prox( HDC hdc, int layerPlane, BOOL realize )
    330330{
    331         crWarning( "wglRealizeLayerPalette: unsupported" );
    332         return 0;
     331    crWarning( "wglRealizeLayerPalette: unsupported" );
     332    return 0;
    333333}
    334334
    335335DWORD WINAPI wglSwapMultipleBuffers_prox( UINT a, CONST void *b )
    336336{
    337         crWarning( "wglSwapMultipleBuffer: unsupported" );
    338         return 0;
     337    crWarning( "wglSwapMultipleBuffer: unsupported" );
     338    return 0;
    339339}
    340340
    341341BOOL WINAPI wglUseFontOutlinesA_prox( HDC hdc, DWORD first, DWORD count, DWORD listBase,
    342                 FLOAT deviation, FLOAT extrusion, int format,
    343                 LPGLYPHMETRICSFLOAT gmf )
    344 {
    345         crWarning( "wglUseFontOutlinesA: unsupported" );
    346         return 0;
     342        FLOAT deviation, FLOAT extrusion, int format,
     343        LPGLYPHMETRICSFLOAT gmf )
     344{
     345    crWarning( "wglUseFontOutlinesA: unsupported" );
     346    return 0;
    347347}
    348348
    349349BOOL WINAPI wglUseFontOutlinesW_prox( HDC hdc, DWORD first, DWORD count, DWORD listBase,
    350                 FLOAT deviation, FLOAT extrusion, int format,
    351                 LPGLYPHMETRICSFLOAT gmf )
    352 {
    353         crWarning( "wglUseFontOutlinesW: unsupported" );
    354         return 0;
     350        FLOAT deviation, FLOAT extrusion, int format,
     351        LPGLYPHMETRICSFLOAT gmf )
     352{
     353    crWarning( "wglUseFontOutlinesW: unsupported" );
     354    return 0;
    355355}
    356356
    357357BOOL WINAPI wglSwapLayerBuffers_prox( HDC hdc, UINT planes )
    358358{
    359         crWarning( "wglSwapLayerBuffers: unsupported" );
    360         return 0;
     359    crWarning( "wglSwapLayerBuffers: unsupported" );
     360    return 0;
    361361}
    362362
    363363BOOL WINAPI wglChoosePixelFormatEXT_prox(HDC hdc, const int *piAttributes, const FLOAT *pfAttributes, UINT nMaxFormats, int *piFormats, UINT *nNumFormats)
    364364{
    365         int *pi;
    366         int wants_rgb = 0;
    367 
    368         stubInit();
    369 
    370         /* TODO : Need to check pfAttributes too ! */
    371 
    372         for ( pi = (int *)piAttributes; *pi != 0; pi++ )
    373         {
    374                 switch ( *pi )
    375                 {
    376                         case WGL_COLOR_BITS_EXT:
    377                                 if (pi[1] > 8)
    378                                         wants_rgb = 1;
    379                                 pi++;
    380                                 break;
    381 
    382                         case WGL_RED_BITS_EXT:
    383                         case WGL_GREEN_BITS_EXT:
    384                         case WGL_BLUE_BITS_EXT:
    385                                 if (pi[1] > 3)
    386                                         wants_rgb = 1;
    387                                 pi++;
    388                                 break;
    389 
    390                         case WGL_ACCUM_ALPHA_BITS_EXT:
    391                         case WGL_ALPHA_BITS_EXT:
    392                                 if (pi[1] > 0)
    393                                         desiredVisual |= CR_ALPHA_BIT;
    394                                 pi++;
    395                                 break;
    396 
    397                         case WGL_DOUBLE_BUFFER_EXT:
    398                                 if (pi[1] > 0)
    399                                         desiredVisual |= CR_DOUBLE_BIT;
    400                                 pi++;
    401                                 break;
    402 
    403                         case WGL_STEREO_EXT:
    404                                 if (pi[1] > 0)
    405                                         desiredVisual |= CR_STEREO_BIT;
    406                                 pi++;
    407                                 break;
    408 
    409                         case WGL_DEPTH_BITS_EXT:
    410                                 if (pi[1] > 0)
    411                                         desiredVisual |= CR_DEPTH_BIT;
    412                                 pi++;
    413                                 break;
    414 
    415                         case WGL_STENCIL_BITS_EXT:
    416                                 if (pi[1] > 0)
    417                                         desiredVisual |= CR_STENCIL_BIT;
    418                                 pi++;
    419                                 break;
    420 
    421                         case WGL_ACCUM_RED_BITS_EXT:
    422                         case WGL_ACCUM_GREEN_BITS_EXT:
    423                         case WGL_ACCUM_BLUE_BITS_EXT:
    424                                 if (pi[1] > 0)
    425                                         desiredVisual |= CR_ACCUM_BIT;
    426                                 pi++;
    427                                 break;
    428 
    429                         case WGL_SAMPLE_BUFFERS_EXT:
    430                         case WGL_SAMPLES_EXT:
    431                                 if (pi[1] > 0)
    432                                         desiredVisual |= CR_MULTISAMPLE_BIT;
    433                                 pi++;
    434                                 break;
    435 
    436 
    437                         default:
    438                                 crWarning( "wglChoosePixelFormatEXT: bad pi=0x%x", *pi );
    439                                 return 0;
    440                 }
    441         }
    442 
    443         return 1;
     365    int *pi;
     366    int wants_rgb = 0;
     367
     368    stubInit();
     369
     370    /* TODO : Need to check pfAttributes too ! */
     371
     372    for ( pi = (int *)piAttributes; *pi != 0; pi++ )
     373    {
     374        switch ( *pi )
     375        {
     376            case WGL_COLOR_BITS_EXT:
     377                if (pi[1] > 8)
     378                    wants_rgb = 1;
     379                pi++;
     380                break;
     381
     382            case WGL_RED_BITS_EXT:
     383            case WGL_GREEN_BITS_EXT:
     384            case WGL_BLUE_BITS_EXT:
     385                if (pi[1] > 3)
     386                    wants_rgb = 1;
     387                pi++;
     388                break;
     389
     390            case WGL_ACCUM_ALPHA_BITS_EXT:
     391            case WGL_ALPHA_BITS_EXT:
     392                if (pi[1] > 0)
     393                    desiredVisual |= CR_ALPHA_BIT;
     394                pi++;
     395                break;
     396
     397            case WGL_DOUBLE_BUFFER_EXT:
     398                if (pi[1] > 0)
     399                    desiredVisual |= CR_DOUBLE_BIT;
     400                pi++;
     401                break;
     402
     403            case WGL_STEREO_EXT:
     404                if (pi[1] > 0)
     405                    desiredVisual |= CR_STEREO_BIT;
     406                pi++;
     407                break;
     408
     409            case WGL_DEPTH_BITS_EXT:
     410                if (pi[1] > 0)
     411                    desiredVisual |= CR_DEPTH_BIT;
     412                pi++;
     413                break;
     414
     415            case WGL_STENCIL_BITS_EXT:
     416                if (pi[1] > 0)
     417                    desiredVisual |= CR_STENCIL_BIT;
     418                pi++;
     419                break;
     420
     421            case WGL_ACCUM_RED_BITS_EXT:
     422            case WGL_ACCUM_GREEN_BITS_EXT:
     423            case WGL_ACCUM_BLUE_BITS_EXT:
     424                if (pi[1] > 0)
     425                    desiredVisual |= CR_ACCUM_BIT;
     426                pi++;
     427                break;
     428
     429            case WGL_SAMPLE_BUFFERS_EXT:
     430            case WGL_SAMPLES_EXT:
     431                if (pi[1] > 0)
     432                    desiredVisual |= CR_MULTISAMPLE_BIT;
     433                pi++;
     434                break;
     435
     436
     437            default:
     438                crWarning( "wglChoosePixelFormatEXT: bad pi=0x%x", *pi );
     439                return 0;
     440        }
     441    }
     442
     443    return 1;
    444444}
    445445
    446446BOOL WINAPI wglGetPixelFormatAttribivEXT_prox(HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, int *pValues)
    447447{
    448         /* TODO */
    449 
    450         return 1;
     448    /* TODO */
     449
     450    return 1;
    451451}
    452452
    453453BOOL WINAPI wglGetPixelFormatAttribfvEXT_prox(HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, int *pValues)
    454454{
    455         /* TODO */
    456 
    457         return 1;
     455    /* TODO */
     456
     457    return 1;
    458458}
    459459
    460460const GLubyte * WINAPI wglGetExtensionsStringEXT_prox( HDC hdc )
    461461{
    462         static GLubyte *retval = "WGL_EXT_pixel_format WGL_ARB_multisample";
    463 
    464         (void) hdc;
    465 
    466         return retval;
    467 }
    468 
     462    static GLubyte *retval = "WGL_EXT_pixel_format WGL_ARB_multisample";
     463
     464    (void) hdc;
     465
     466    return retval;
     467}
     468
  • trunk/src/VBox/Additions/WINNT/Graphics/crOpenGL/windows_getprocaddress.py

    r15532 r16219  
    3939keys = apiutil.GetAllFunctions(sys.argv[1]+"/APIspec.txt")
    4040for func_name in keys:
    41         if "Chromium" == apiutil.Category(func_name):
    42                 continue
    43         if func_name == "BoundsInfoCR":
    44                 continue
    45         if "GL_chromium" == apiutil.Category(func_name):
    46                 pass #continue
     41    if "Chromium" == apiutil.Category(func_name):
     42        continue
     43    if func_name == "BoundsInfoCR":
     44        continue
     45    if "GL_chromium" == apiutil.Category(func_name):
     46        pass #continue
    4747
    48         wrap = apiutil.GetCategoryWrapper(func_name)
    49         name = "gl" + func_name
    50         address = "cr_gl" + func_name
    51         if wrap:
    52                 print '#ifdef CR_%s' % wrap
    53         print '\t{ "%s", (CR_PROC) %s },' % (name, address)
    54         if wrap:
    55                 print '#endif'
     48    wrap = apiutil.GetCategoryWrapper(func_name)
     49    name = "gl" + func_name
     50    address = "cr_gl" + func_name
     51    if wrap:
     52        print '#ifdef CR_%s' % wrap
     53    print '\t{ "%s", (CR_PROC) %s },' % (name, address)
     54    if wrap:
     55        print '#endif'
    5656
    5757
     
    5959
    6060for func_name in keys:
    61         if (func_name == "Writeback" or
    62                 func_name == "BoundsInfoCR"):
    63                 continue
    64         if apiutil.Category(func_name) == "Chromium":
    65                 print '\t{ "cr%s", (CR_PROC) cr%s },' % (func_name, func_name)
     61    if (func_name == "Writeback" or
     62        func_name == "BoundsInfoCR"):
     63        continue
     64    if apiutil.Category(func_name) == "Chromium":
     65        print '\t{ "cr%s", (CR_PROC) cr%s },' % (func_name, func_name)
    6666
    6767print "\t/* Windows ICD functions */"
     
    8080    "SwapBuffers",
    8181    "SwapLayerBuffers",
    82         "ReleaseContext",
    83         "SetContext",
    84         "ValidateVersion"):
    85         print '\t{ "Drv%s", (CR_PROC) Drv%s },' % (func_name, func_name)
     82    "ReleaseContext",
     83    "SetContext",
     84    "ValidateVersion"):
     85    print '\t{ "Drv%s", (CR_PROC) Drv%s },' % (func_name, func_name)
    8686
    8787print '\t{ "DrvGetProcAddress", (CR_PROC) wglGetProcAddress_prox },'
    8888
    8989print """
    90         { NULL, NULL }
     90    { NULL, NULL }
    9191};
    9292
    9393CR_PROC CR_APIENTRY crGetProcAddress( const char *name )
    9494{
    95         int i;
    96         stubInit();
     95    int i;
     96    stubInit();
    9797
    98         for (i = 0; functions[i].name; i++) {
    99                 if (crStrcmp(name, functions[i].name) == 0) {
    100                         return functions[i].address;
    101                 }
    102         }
     98    for (i = 0; functions[i].name; i++) {
     99        if (crStrcmp(name, functions[i].name) == 0) {
     100            return functions[i].address;
     101        }
     102    }
    103103
    104         return NULL;
     104    return NULL;
    105105}
    106106
     
    114114/* As these are Windows specific (i.e. wgl), define these now.... */
    115115#ifdef WINDOWS
    116         {
    117                 wglGetExtensionsStringEXTFunc_t wglGetExtensionsStringEXT = NULL;
    118                 wglChoosePixelFormatFunc_t wglChoosePixelFormatEXT = NULL;
    119                 wglGetPixelFormatAttribivEXTFunc_t wglGetPixelFormatAttribivEXT = NULL;
    120                 wglGetPixelFormatAttribfvEXTFunc_t wglGetPixelFormatAttribfvEXT = NULL;
    121                 if (!crStrcmp( name, "wglGetExtensionsStringEXT" )) return (CR_PROC) wglGetExtensionsStringEXT;
    122                 if (!crStrcmp( name, "wglChoosePixelFormatEXT" )) return (CR_PROC) wglChoosePixelFormatEXT;
    123                 if (!crStrcmp( name, "wglGetPixelFormatAttribivEXT" )) return (CR_PROC) wglGetPixelFormatAttribivEXT;
    124                 if (!crStrcmp( name, "wglGetPixelFormatAttribfvEXT" )) return (CR_PROC) wglGetPixelFormatAttribfvEXT;
    125         }
     116    {
     117        wglGetExtensionsStringEXTFunc_t wglGetExtensionsStringEXT = NULL;
     118        wglChoosePixelFormatFunc_t wglChoosePixelFormatEXT = NULL;
     119        wglGetPixelFormatAttribivEXTFunc_t wglGetPixelFormatAttribivEXT = NULL;
     120        wglGetPixelFormatAttribfvEXTFunc_t wglGetPixelFormatAttribfvEXT = NULL;
     121        if (!crStrcmp( name, "wglGetExtensionsStringEXT" )) return (CR_PROC) wglGetExtensionsStringEXT;
     122        if (!crStrcmp( name, "wglChoosePixelFormatEXT" )) return (CR_PROC) wglChoosePixelFormatEXT;
     123        if (!crStrcmp( name, "wglGetPixelFormatAttribivEXT" )) return (CR_PROC) wglGetPixelFormatAttribivEXT;
     124        if (!crStrcmp( name, "wglGetPixelFormatAttribfvEXT" )) return (CR_PROC) wglGetPixelFormatAttribfvEXT;
     125    }
    126126#endif
    127127"""
Note: See TracChangeset for help on using the changeset viewer.

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