Changeset 48291 in vbox for trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu.c
- Timestamp:
- Sep 5, 2013 7:25:47 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu.c
r48275 r48291 298 298 if (render_spu.defaultSharedContext == context) 299 299 { 300 renderspuContextRelease(render_spu.defaultSharedContext); 301 render_spu.defaultSharedContext = NULL; 300 renderspuSetDefaultSharedContext(NULL); 302 301 } 303 302 … … 317 316 } 318 317 319 320 void RENDER_APIENTRY 321 renderspuMakeCurrent(GLint crWindow, GLint nativeWindow, GLint ctx) 322 { 323 WindowInfo *window; 324 ContextInfo *context; 325 326 /* 327 crDebug("%s win=%d native=0x%x ctx=%d", __FUNCTION__, crWindow, (int) nativeWindow, ctx); 328 */ 329 330 window = (WindowInfo *) crHashtableSearch(render_spu.windowTable, crWindow); 331 context = (ContextInfo *) crHashtableSearch(render_spu.contextTable, ctx); 332 318 WindowInfo* renderspuGetDummyWindow(GLint visBits) 319 { 320 WindowInfo *window = (WindowInfo *) crHashtableSearch(render_spu.dummyWindowTable, visBits); 321 if (!window) 322 { 323 window = (WindowInfo *)crAlloc(sizeof (*window)); 324 if (!window) 325 { 326 crWarning("crAlloc failed"); 327 return NULL; 328 } 329 330 if (!renderspuWindowInit(window, NULL, visBits, -1)) 331 { 332 crWarning("renderspuWindowInit failed"); 333 crFree(window); 334 return NULL; 335 } 336 337 crHashtableAdd(render_spu.dummyWindowTable, visBits, window); 338 } 339 340 return window; 341 } 342 343 void renderspuPerformMakeCurrent(WindowInfo *window, GLint nativeWindow, ContextInfo *context) 344 { 333 345 if (window && context) 334 346 { … … 341 353 if (!window) 342 354 { 343 crDebug("Render SPU: MakeCurrent invalid window id: %d", crWindow);355 crDebug("Render SPU: MakeCurrent invalid window id: %d", window->BltInfo.Base.id); 344 356 return; 345 357 } 346 358 if (!context) 347 359 { 348 crDebug("Render SPU: MakeCurrent invalid context id: %d", c tx);360 crDebug("Render SPU: MakeCurrent invalid context id: %d", context->BltInfo.Base.id); 349 361 return; 350 362 } … … 367 379 context->everCurrent = GL_TRUE; 368 380 } 369 if ( crWindow== CR_RENDER_DEFAULT_WINDOW_ID && window->mapPending &&381 if (window->BltInfo.Base.id == CR_RENDER_DEFAULT_WINDOW_ID && window->mapPending && 370 382 !render_spu.render_to_app_window && !render_spu.render_to_crut_window) { 371 383 /* Window[CR_RENDER_DEFAULT_CONTEXT_ID] is special, it's the default window and normally hidden. … … 378 390 window->everCurrent = GL_TRUE; 379 391 } 380 else if (! crWindow && !ctx)392 else if (!window && !context) 381 393 { 382 394 renderspu_SystemMakeCurrent( NULL, 0, NULL ); … … 389 401 else 390 402 { 391 crError("renderspuMakeCurrent invalid ids: crWindow(%d), ctx(%d)", crWindow, ctx); 392 } 393 } 394 395 GLboolean renderspuWindowInit( WindowInfo *window, VisualInfo *visual, GLboolean showIt, GLint id ) 403 crError("renderspuMakeCurrent invalid ids: crWindow(%d), ctx(%d)", 404 window ? window->BltInfo.Base.id : 0, 405 context ? context->BltInfo.Base.id : 0); 406 } 407 } 408 409 void RENDER_APIENTRY 410 renderspuMakeCurrent(GLint crWindow, GLint nativeWindow, GLint ctx) 411 { 412 WindowInfo *window = NULL; 413 ContextInfo *context = NULL; 414 415 /* 416 crDebug("%s win=%d native=0x%x ctx=%d", __FUNCTION__, crWindow, (int) nativeWindow, ctx); 417 */ 418 419 if (crWindow) 420 { 421 window = (WindowInfo *) crHashtableSearch(render_spu.windowTable, crWindow); 422 if (!window) 423 { 424 crWarning("invalid window %d specified", crWindow); 425 return; 426 } 427 } 428 429 if (ctx) 430 { 431 context = (ContextInfo *) crHashtableSearch(render_spu.contextTable, ctx); 432 if (!context) 433 { 434 crWarning("invalid context %d specified", ctx); 435 return; 436 } 437 } 438 439 if (!context != !window) 440 { 441 crWarning("either window %d or context %d are zero", crWindow, ctx); 442 return; 443 } 444 445 renderspuPerformMakeCurrent(window, nativeWindow, context); 446 } 447 448 GLboolean renderspuWindowInitWithVisual( WindowInfo *window, VisualInfo *visual, GLboolean showIt, GLint id ) 396 449 { 397 450 crMemset(window, 0, sizeof (*window)); … … 449 502 * Window functions 450 503 */ 451 452 GLint renderspuWindowCreateEx( const char *dpyName, GLint visBits, GLint id ) 453 { 454 WindowInfo *window; 504 GLboolean renderspuWindowInit(WindowInfo *pWindow, const char *dpyName, GLint visBits, GLint id) 505 { 455 506 VisualInfo *visual; 456 GLboolean showIt; 457 458 if (id <= 0) 459 { 460 id = (GLint)crHashtableAllocKeys(render_spu.windowTable, 1); 461 if (id <= 0) 462 { 463 crWarning("failed to allocate window id"); 464 return -1; 465 } 466 } 467 else 468 { 469 if (crHashtableIsKeyUsed(render_spu.windowTable, id)) 470 { 471 crWarning("the specified window key %d is in use", id); 472 return -1; 473 } 474 } 475 507 508 crMemset(pWindow, 0, sizeof (*pWindow)); 476 509 477 510 if (!dpyName || crStrlen(render_spu.display_string) > 0) … … 482 515 { 483 516 crWarning( "Render SPU: Couldn't create a window, renderspuFindVisual returned NULL" ); 484 return -1; 485 } 486 487 /* Allocate WindowInfo */ 488 window = (WindowInfo *) crCalloc(sizeof(WindowInfo)); 489 if (!window) 490 { 491 crWarning( "Render SPU: Couldn't create a window" ); 492 return -1; 493 } 494 495 crHashtableAdd(render_spu.windowTable, id, window); 496 497 showIt = 0; 517 return GL_FALSE; 518 } 498 519 499 520 /* … … 501 522 */ 502 523 /* Have GLX/WGL/AGL create the window */ 503 if (!renderspuWindowInit( window, visual, showIt, id )) 504 { 524 if (!renderspuWindowInitWithVisual( pWindow, visual, 0, id )) 525 { 526 crWarning( "Render SPU: Couldn't create a window, renderspu_SystemCreateWindow failed" ); 527 return GL_FALSE; 528 } 529 530 return GL_TRUE; 531 } 532 533 GLint renderspuWindowCreateEx( const char *dpyName, GLint visBits, GLint id ) 534 { 535 WindowInfo *window; 536 537 GLboolean showIt; 538 539 if (id <= 0) 540 { 541 id = (GLint)crHashtableAllocKeys(render_spu.windowTable, 1); 542 if (id <= 0) 543 { 544 crWarning("failed to allocate window id"); 545 return -1; 546 } 547 } 548 else 549 { 550 if (crHashtableIsKeyUsed(render_spu.windowTable, id)) 551 { 552 crWarning("the specified window key %d is in use", id); 553 return -1; 554 } 555 } 556 557 /* Allocate WindowInfo */ 558 window = (WindowInfo *) crCalloc(sizeof(WindowInfo)); 559 if (!window) 560 { 561 crWarning( "Render SPU: Couldn't create a window" ); 562 return -1; 563 } 564 565 if (!renderspuWindowInit(window, dpyName, visBits, id)) 566 { 567 crWarning("renderspuWindowInit failed"); 505 568 crFree(window); 506 crWarning( "Render SPU: Couldn't create a window, renderspu_SystemCreateWindow failed" );507 569 return -1; 508 570 } 509 571 572 crHashtableAdd(render_spu.windowTable, id, window); 510 573 return window->BltInfo.Base.id; 511 574 } … … 1260 1323 * Misc functions 1261 1324 */ 1262 1325 void renderspuSetDefaultSharedContext(ContextInfo *pCtx) 1326 { 1327 if (pCtx == render_spu.defaultSharedContext) 1328 return; 1329 1330 renderspu_SystemDefaultSharedContextChanged(render_spu.defaultSharedContext, pCtx); 1331 1332 if (render_spu.defaultSharedContext) 1333 renderspuContextRelease(render_spu.defaultSharedContext); 1334 1335 renderspuContextRetain(pCtx); 1336 render_spu.defaultSharedContext = pCtx; 1337 } 1263 1338 1264 1339 … … 1269 1344 { 1270 1345 case GL_HH_SET_DEFAULT_SHARED_CTX: 1271 if (render_spu.defaultSharedContext) 1272 { 1273 renderspuContextRelease(render_spu.defaultSharedContext); 1274 render_spu.defaultSharedContext = NULL; 1275 } 1276 1346 { 1347 ContextInfo * pCtx = NULL; 1277 1348 if (value) 1278 { 1279 render_spu.defaultSharedContext = (ContextInfo *) crHashtableSearch(render_spu.contextTable, value); 1280 if (render_spu.defaultSharedContext) 1281 renderspuContextRetain(render_spu.defaultSharedContext); 1282 else 1283 crWarning("invalid default shared context id %d", value); 1284 } 1285 1349 pCtx = (ContextInfo *)crHashtableSearch(render_spu.contextTable, value); 1350 else 1351 crWarning("invalid default shared context id %d", value); 1352 1353 renderspuSetDefaultSharedContext(pCtx); 1286 1354 break; 1355 } 1287 1356 default: 1288 1357 // crWarning("Unhandled target in renderspuChromiumParameteriCR()");
Note:
See TracChangeset
for help on using the changeset viewer.