Changeset 45507 in vbox for trunk/src/VBox/GuestHost
- Timestamp:
- Apr 12, 2013 8:27:12 AM (12 years ago)
- svn:sync-xref-src-repo-rev:
- 84977
- Location:
- trunk/src/VBox/GuestHost/OpenGL
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/GuestHost/OpenGL/include/cr_blitter.h
r45348 r45507 44 44 uint32_t CtxCreated : 1; 45 45 uint32_t SupportsFBO : 1; 46 uint32_t SupportsFBOBlit : 1;47 46 uint32_t CurrentMuralChanged : 1; 48 47 uint32_t LastWasFBODraw : 1; 48 uint32_t ForceDrawBlit : 1; 49 49 uint32_t Reserved : 26; 50 50 }; … … 103 103 } 104 104 105 VBOXBLITTERDECL(int) CrBltInit(PCR_BLITTER pBlitter, const CR_BLITTER_CONTEXT *pCtxBase, bool fCreateNewCtx, SPUDispatchTable *pDispatch); 105 VBOXBLITTERDECL(int) CrBltInit(PCR_BLITTER pBlitter, const CR_BLITTER_CONTEXT *pCtxBase, bool fCreateNewCtx, bool fForceDrawBlt, SPUDispatchTable *pDispatch); 106 106 107 VBOXBLITTERDECL(void) CrBltTerm(PCR_BLITTER pBlitter); 107 108 … … 132 133 } 133 134 134 VBOXBLITTERDECL( void) CrBltMuralSetCurrent(PCR_BLITTER pBlitter, const CR_BLITTER_WINDOW *pMural);135 VBOXBLITTERDECL(int) CrBltMuralSetCurrent(PCR_BLITTER pBlitter, const CR_BLITTER_WINDOW *pMural); 135 136 DECLINLINE(const CR_BLITTER_WINDOW *) CrBltMuralGetCurrentInfo(PCR_BLITTER pBlitter) 136 137 { -
trunk/src/VBox/GuestHost/OpenGL/util/blitter.cpp
r45201 r45507 29 29 30 30 31 int CrBltInit(PCR_BLITTER pBlitter, const CR_BLITTER_CONTEXT *pCtxBase, bool fCreateNewCtx, SPUDispatchTable *pDispatch) 32 { 33 if (pCtxBase->Base.id == 0 || pCtxBase->Base.id < -1) 31 /* @param pCtxBase - contains the blitter context info. Its value is treated differently depending on the fCreateNewCtx value 32 * @param fCreateNewCtx - if true - the pCtxBase must NOT be NULL. its visualBits is used as a visual bits info for the new context, 33 * its id field is used to specified the shared context id to be used for blitter context. 34 * The id can be null to specify no shared context is needed 35 * if false - if pCtxBase is NOT null AND its id field is NOT null - 36 * specified the blitter context to be used 37 * blitter treats it as if it has default ogl state. 38 * otherwise - 39 * the blitter works in a "no-context" mode, i.e. a caller is responsible 40 * to making a proper context current before calling the blitter. 41 * Note that BltEnter/Leave MUST still be called, but the proper context 42 * must be set before doing BltEnter, and ResoreContext info is ignored in that case. 43 * Also note that blitter caches the current window info, and assumes the current context's values are preserved 44 * wrt that window before the calls, so if one uses different contexts for one blitter, 45 * the blitter current window values must be explicitly reset by doing CrBltMuralSetCurrent(pBlitter, NULL) 46 * @param fForceDrawBlt - if true - forces the blitter to always use glDrawXxx-based blits even if GL_EXT_framebuffer_blit. 47 * This is needed because BlitFramebufferEXT is known to be often buggy, and glDrawXxx-based blits appear to be more reliable 48 */ 49 int CrBltInit(PCR_BLITTER pBlitter, const CR_BLITTER_CONTEXT *pCtxBase, bool fCreateNewCtx, bool fForceDrawBlt, SPUDispatchTable *pDispatch) 50 { 51 if (pCtxBase && pCtxBase->Base.id < 0) 34 52 { 35 53 crWarning("Default share context not initialized!"); … … 37 55 } 38 56 57 if (!pCtxBase && fCreateNewCtx) 58 { 59 crWarning("pCtxBase is zero while fCreateNewCtx is set!"); 60 return VERR_INVALID_PARAMETER; 61 } 62 39 63 memset(pBlitter, 0, sizeof (*pBlitter)); 40 64 41 65 pBlitter->pDispatch = pDispatch; 42 pBlitter->CtxInfo = *pCtxBase; 66 if (pCtxBase) 67 pBlitter->CtxInfo = *pCtxBase; 68 69 pBlitter->Flags.ForceDrawBlit = fForceDrawBlt; 70 43 71 if (fCreateNewCtx) 44 72 { … … 62 90 } 63 91 64 voidCrBltMuralSetCurrent(PCR_BLITTER pBlitter, const CR_BLITTER_WINDOW *pMural)92 int CrBltMuralSetCurrent(PCR_BLITTER pBlitter, const CR_BLITTER_WINDOW *pMural) 65 93 { 66 94 if (pMural) 67 95 { 68 96 if (!memcmp(&pBlitter->CurrentMural, pMural, sizeof (pBlitter->CurrentMural))) 69 return ;97 return VINF_SUCCESS; 70 98 memcpy(&pBlitter->CurrentMural, pMural, sizeof (pBlitter->CurrentMural)); 71 99 } … … 73 101 { 74 102 if (!pBlitter->CurrentMural.Base.id) 75 return ;103 return VINF_SUCCESS; 76 104 pBlitter->CurrentMural.Base.id = 0; 77 105 } … … 80 108 81 109 if (!CrBltIsEntered(pBlitter)) 82 return; 110 return VINF_SUCCESS; 111 else if (!pBlitter->CtxInfo.Base.id) 112 { 113 crWarning("setting current mural for entered no-context blitter"); 114 return VERR_INVALID_STATE; 115 } 116 117 pBlitter->pDispatch->Flush(); 83 118 84 119 if (pMural) … … 86 121 else 87 122 pBlitter->pDispatch->MakeCurrent(0, 0, 0); 123 124 return VINF_SUCCESS; 88 125 } 89 126 … … 436 473 } 437 474 475 pBlitter->pDispatch->BindTexture(pSrc->target, 0); 476 438 477 return VINF_SUCCESS; 439 478 } … … 453 492 /* BlitFramebuffer seems to be buggy on Intel, 454 493 * try always glDrawXxx for now */ 455 if (0 && crStrstr(pszExtension, "GL_EXT_framebuffer_blit")) 456 { 457 pBlitter->Flags.SupportsFBOBlit = 1; 494 if (!pBlitter->Flags.ForceDrawBlit && crStrstr(pszExtension, "GL_EXT_framebuffer_blit")) 495 { 458 496 pBlitter->pfnBlt = crBltBlitTexBufImplFbo; 459 497 } … … 486 524 pBlitter->pDispatch->Flush(); 487 525 488 if (pBlitter->pRestoreCtxInfo != &pBlitter->CtxInfo) 489 { 490 pBlitter->pDispatch->MakeCurrent(pBlitter->pRestoreMural->Base.id, 0, pBlitter->pRestoreCtxInfo->Base.id); 491 } 492 else 493 { 494 pBlitter->pDispatch->MakeCurrent(0, 0, 0); 526 if (pBlitter->CtxInfo.Base.id) 527 { 528 if (pBlitter->pRestoreCtxInfo != &pBlitter->CtxInfo) 529 { 530 pBlitter->pDispatch->MakeCurrent(pBlitter->pRestoreMural->Base.id, 0, pBlitter->pRestoreCtxInfo->Base.id); 531 } 532 else 533 { 534 pBlitter->pDispatch->MakeCurrent(0, 0, 0); 535 } 495 536 } 496 537 … … 512 553 } 513 554 555 if (pBlitter->CurrentMural.Base.id) /* <- pBlitter->CurrentMural.Base.id can be null if the blitter is in a "no-context" mode (see comments to BltInit for detail)*/ 556 { 557 pBlitter->pDispatch->MakeCurrent(pBlitter->CurrentMural.Base.id, pBlitter->i32MakeCurrentUserData, pBlitter->CtxInfo.Base.id); 558 } 559 else 560 { 561 if (pRestoreCtxInfo) 562 { 563 crWarning("pRestoreCtxInfo is not NULL for \"no-context\" blitter"); 564 pRestoreCtxInfo = NULL; 565 } 566 } 567 514 568 if (pRestoreCtxInfo) 515 569 { … … 523 577 pBlitter->pRestoreCtxInfo = &pBlitter->CtxInfo; 524 578 } 525 526 pBlitter->pDispatch->MakeCurrent(pBlitter->CurrentMural.Base.id, pBlitter->i32MakeCurrentUserData, pBlitter->CtxInfo.Base.id);527 579 528 580 if (pBlitter->Flags.Initialized) … … 573 625 574 626 crBltBlitTexBuf(pBlitter, pSrc, pSrcRect, GL_DRAW_FRAMEBUFFER, &DstSize, pDstRect, cRects, fFlags); 627 628 pBlitter->pDispatch->FramebufferTexture2DEXT(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, pDst->target, 0, 0); 575 629 } 576 630
Note:
See TracChangeset
for help on using the changeset viewer.