Changeset 16219 in vbox
- Timestamp:
- Jan 26, 2009 10:26:43 AM (16 years ago)
- Location:
- trunk/src/VBox/Additions/WINNT/Graphics/crOpenGL
- Files:
-
- 2 edited
-
wgl.c (modified) (3 diffs)
-
windows_getprocaddress.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/crOpenGL/wgl.c
r15532 r16219 26 26 static GLuint ComputeVisBits( HDC hdc ) 27 27 { 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; 52 52 } 53 53 54 54 int WINAPI wglChoosePixelFormat_prox( HDC hdc, CONST PIXELFORMATDESCRIPTOR *pfd ) 55 55 { 56 DWORD okayFlags;57 58 stubInit();59 60 /*61 * NOTE!!!62 * Here we're telling the renderspu not to use the GDI63 * equivalent's of ChoosePixelFormat/DescribePixelFormat etc64 * 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; 143 143 } 144 144 145 145 BOOL 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; 153 153 } 154 154 155 155 BOOL WINAPI wglDeleteContext_prox( HGLRC hglrc ) 156 156 { 157 stubDestroyContext( (unsigned long) hglrc );158 return 1;157 stubDestroyContext( (unsigned long) hglrc ); 158 return 1; 159 159 } 160 160 161 161 BOOL WINAPI wglMakeCurrent_prox( HDC hdc, HGLRC hglrc ) 162 162 { 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 ); 170 170 } 171 171 172 172 HGLRC WINAPI wglGetCurrentContext_prox( void ) 173 173 { 174 return (HGLRC) stub.currentContext;174 return (HGLRC) stub.currentContext; 175 175 } 176 176 177 177 HDC WINAPI wglGetCurrentDC_prox( void ) 178 178 { 179 if (stub.currentContext && stub.currentContext->currentDrawable)180 return (HDC) stub.currentContext->currentDrawable->drawable;181 else182 return (HDC) NULL;179 if (stub.currentContext && stub.currentContext->currentDrawable) 180 return (HDC) stub.currentContext->currentDrawable->drawable; 181 else 182 return (HDC) NULL; 183 183 } 184 184 185 185 int WINAPI wglGetPixelFormat_prox( HDC hdc ) 186 186 { 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; 189 189 } 190 190 191 191 int 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; 241 241 } 242 242 243 243 BOOL WINAPI wglShareLists_prox( HGLRC hglrc1, HGLRC hglrc2 ) 244 244 { 245 crWarning( "wglShareLists: unsupported" );246 return 0;245 crWarning( "wglShareLists: unsupported" ); 246 return 0; 247 247 } 248 248 … … 250 250 HGLRC WINAPI wglCreateContext_prox( HDC hdc ) 251 251 { 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; 268 268 } 269 269 … … 271 271 wglSwapBuffers_prox( HDC hdc ) 272 272 { 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; 276 276 } 277 277 278 278 BOOL WINAPI wglCopyContext_prox( HGLRC src, HGLRC dst, UINT mask ) 279 279 { 280 crWarning( "wglCopyContext: unsupported" );281 return 0;280 crWarning( "wglCopyContext: unsupported" ); 281 return 0; 282 282 } 283 283 284 284 HGLRC WINAPI wglCreateLayerContext_prox( HDC hdc, int layerPlane ) 285 285 { 286 stubInit();287 crWarning( "wglCreateLayerContext: unsupported" );288 return 0;286 stubInit(); 287 crWarning( "wglCreateLayerContext: unsupported" ); 288 return 0; 289 289 } 290 290 291 291 PROC WINAPI wglGetProcAddress_prox( LPCSTR name ) 292 292 { 293 return (PROC) crGetProcAddress( name );293 return (PROC) crGetProcAddress( name ); 294 294 } 295 295 296 296 BOOL WINAPI wglUseFontBitmapsA_prox( HDC hdc, DWORD first, DWORD count, DWORD listBase ) 297 297 { 298 crWarning( "wglUseFontBitmapsA: unsupported" );299 return 0;298 crWarning( "wglUseFontBitmapsA: unsupported" ); 299 return 0; 300 300 } 301 301 302 302 BOOL WINAPI wglUseFontBitmapsW_prox( HDC hdc, DWORD first, DWORD count, DWORD listBase ) 303 303 { 304 crWarning( "wglUseFontBitmapsW: unsupported" );305 return 0;304 crWarning( "wglUseFontBitmapsW: unsupported" ); 305 return 0; 306 306 } 307 307 308 308 BOOL 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; 313 313 } 314 314 315 315 int 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; 320 320 } 321 321 322 322 int 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; 327 327 } 328 328 329 329 BOOL WINAPI wglRealizeLayerPalette_prox( HDC hdc, int layerPlane, BOOL realize ) 330 330 { 331 crWarning( "wglRealizeLayerPalette: unsupported" );332 return 0;331 crWarning( "wglRealizeLayerPalette: unsupported" ); 332 return 0; 333 333 } 334 334 335 335 DWORD WINAPI wglSwapMultipleBuffers_prox( UINT a, CONST void *b ) 336 336 { 337 crWarning( "wglSwapMultipleBuffer: unsupported" );338 return 0;337 crWarning( "wglSwapMultipleBuffer: unsupported" ); 338 return 0; 339 339 } 340 340 341 341 BOOL 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; 347 347 } 348 348 349 349 BOOL 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; 355 355 } 356 356 357 357 BOOL WINAPI wglSwapLayerBuffers_prox( HDC hdc, UINT planes ) 358 358 { 359 crWarning( "wglSwapLayerBuffers: unsupported" );360 return 0;359 crWarning( "wglSwapLayerBuffers: unsupported" ); 360 return 0; 361 361 } 362 362 363 363 BOOL WINAPI wglChoosePixelFormatEXT_prox(HDC hdc, const int *piAttributes, const FLOAT *pfAttributes, UINT nMaxFormats, int *piFormats, UINT *nNumFormats) 364 364 { 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; 444 444 } 445 445 446 446 BOOL WINAPI wglGetPixelFormatAttribivEXT_prox(HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, int *pValues) 447 447 { 448 /* TODO */449 450 return 1;448 /* TODO */ 449 450 return 1; 451 451 } 452 452 453 453 BOOL WINAPI wglGetPixelFormatAttribfvEXT_prox(HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, int *pValues) 454 454 { 455 /* TODO */456 457 return 1;455 /* TODO */ 456 457 return 1; 458 458 } 459 459 460 460 const GLubyte * WINAPI wglGetExtensionsStringEXT_prox( HDC hdc ) 461 461 { 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 39 39 keys = apiutil.GetAllFunctions(sys.argv[1]+"/APIspec.txt") 40 40 for func_name in keys: 41 if "Chromium" == apiutil.Category(func_name):42 continue43 if func_name == "BoundsInfoCR":44 continue45 if "GL_chromium" == apiutil.Category(func_name):46 pass #continue41 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 47 47 48 wrap = apiutil.GetCategoryWrapper(func_name)49 name = "gl" + func_name50 address = "cr_gl" + func_name51 if wrap:52 print '#ifdef CR_%s' % wrap53 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' 56 56 57 57 … … 59 59 60 60 for func_name in keys: 61 if (func_name == "Writeback" or62 func_name == "BoundsInfoCR"):63 continue64 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) 66 66 67 67 print "\t/* Windows ICD functions */" … … 80 80 "SwapBuffers", 81 81 "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) 86 86 87 87 print '\t{ "DrvGetProcAddress", (CR_PROC) wglGetProcAddress_prox },' 88 88 89 89 print """ 90 { NULL, NULL }90 { NULL, NULL } 91 91 }; 92 92 93 93 CR_PROC CR_APIENTRY crGetProcAddress( const char *name ) 94 94 { 95 int i;96 stubInit();95 int i; 96 stubInit(); 97 97 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 } 103 103 104 return NULL;104 return NULL; 105 105 } 106 106 … … 114 114 /* As these are Windows specific (i.e. wgl), define these now.... */ 115 115 #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 } 126 126 #endif 127 127 """
Note:
See TracChangeset
for help on using the changeset viewer.

