Changeset 25453 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Dec 17, 2009 11:27:18 AM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 56113
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/VBoxFBOverlay.cpp
r25441 r25453 309 309 } 310 310 311 static VBoxVHWATextureImage* vboxVHWAImageCreate(const QRect & aRect, const VBoxVHWAColorFormat & aFormat, class VBoxVHWAGlProgramMngr * pMgr, bool bDisablePBO) 312 { 313 #ifdef VBOXVHWA_NEW_PBO 311 static VBoxVHWATextureImage* vboxVHWAImageCreate(const QRect & aRect, const VBoxVHWAColorFormat & aFormat, class VBoxVHWAGlProgramMngr * pMgr, VBOXVHWAIMG_TYPE flags) 312 { 314 313 const VBoxVHWAInfo & info = vboxVHWAGetSupportInfo(NULL); 315 if(!bDisablePBO && info.getGlInfo().isPBOSupported()) 316 { 314 if((flags & VBOXVHWAIMG_PBO) && !info.getGlInfo().isPBOSupported()) 315 flags &= ~VBOXVHWAIMG_PBO; 316 317 if((flags & VBOXVHWAIMG_PBOIMG) && 318 (!info.getGlInfo().isPBOSupported() || !info.getGlInfo().isPBOOffsetSupported())) 319 flags &= ~VBOXVHWAIMG_PBOIMG; 320 321 if((flags & VBOXVHWAIMG_FBO) && !info.getGlInfo().isFBOSupported()) 322 flags &= ~VBOXVHWAIMG_FBO; 323 324 /* ensure we don't create a PBO-based texture in case we use a PBO-based image */ 325 if(flags & VBOXVHWAIMG_PBOIMG) 326 flags &= ~VBOXVHWAIMG_PBO; 327 328 if(flags & VBOXVHWAIMG_PBOIMG) 329 { 330 if(flags & VBOXVHWAIMG_FBO) 331 { 332 VBOXQGLLOG(("FBO PBO Image\n")); 333 return new VBoxVHWATextureImageFBO<VBoxVHWATextureImagePBO>(aRect, aFormat, pMgr, flags); 334 } 317 335 VBOXQGLLOG(("PBO Image\n")); 318 return new VBoxVHWATextureImagePBO(aRect, aFormat, pMgr); 319 } 320 #endif 336 return new VBoxVHWATextureImagePBO(aRect, aFormat, pMgr, flags); 337 } 338 if(flags & VBOXVHWAIMG_FBO) 339 { 340 VBOXQGLLOG(("FBO Generic Image\n")); 341 return new VBoxVHWATextureImageFBO<VBoxVHWATextureImage>(aRect, aFormat, pMgr, flags); 342 } 321 343 VBOXQGLLOG(("Generic Image\n")); 322 return new VBoxVHWATextureImage(aRect, aFormat, pMgr, bDisablePBO);323 } 324 325 static VBoxVHWATexture* vboxVHWATextureCreate(const QGLContext * pContext, const QRect & aRect, const VBoxVHWAColorFormat & aFormat, bool bDisablePBO)344 return new VBoxVHWATextureImage(aRect, aFormat, pMgr, flags); 345 } 346 347 static VBoxVHWATexture* vboxVHWATextureCreate(const QGLContext * pContext, const QRect & aRect, const VBoxVHWAColorFormat & aFormat, VBOXVHWAIMG_TYPE flags) 326 348 { 327 349 const VBoxVHWAInfo & info = vboxVHWAGetSupportInfo(pContext); 328 if( !bDisablePBO&& info.getGlInfo().isPBOSupported())350 if((flags & VBOXVHWAIMG_PBO) && info.getGlInfo().isPBOSupported()) 329 351 { 330 352 VBOXQGLLOG(("VBoxVHWATextureNP2RectPBO\n")); … … 1195 1217 resetDefaultSrcOverlayCKey(); 1196 1218 1197 mImage = vboxVHWAImageCreate(QRect(0,0,aSize.width(),aSize.height()), aColorFormat, getGlProgramMngr(), bVGA );1219 mImage = vboxVHWAImageCreate(QRect(0,0,aSize.width(),aSize.height()), aColorFormat, getGlProgramMngr(), bVGA ? 0 : (VBOXVHWAIMG_PBO | VBOXVHWAIMG_PBOIMG/* | VBOXVHWAIMG_FBO*/)); 1198 1220 1199 1221 setRectValues(aTargRect, aSrcRect); … … 1966 1988 void VBoxGLWidget::adjustViewport(const QSize &display, const QRect &viewport) 1967 1989 { 1968 #ifdef VBOXVHWA_OLD_COORD1969 /* viewport: (viewport.x;viewport.y) (viewport.width;viewport.height)*/1970 glViewport(-((int)display.width() + viewport.x()),1971 -((int)display.height() - viewport.y() + display.height() - viewport.height()),1972 2*display.width(),1973 2*display.height());1974 #else1975 1990 glViewport(-viewport.x(), 1976 1991 viewport.height() + viewport.y() - display.height(), 1977 1992 display.width(), 1978 1993 display.height()); 1979 1980 #endif1981 1994 } 1982 1995 1983 1996 void VBoxGLWidget::setupMatricies(const QSize &display) 1984 1997 { 1985 #ifdef VBOXVHWA_OLD_COORD1986 glMatrixMode(GL_PROJECTION);1987 glLoadIdentity();1988 glFrustum(0., (GLdouble)display.width(), 0., (GLdouble)display.height(), 0., 0.);1989 1990 glMatrixMode(GL_MODELVIEW);1991 // doSetupMatrix(bInverted ? &mRect.size() : &mTargSize.size(), bInverted);1992 doSetupMatrix(display, false);1993 #else1994 1998 glMatrixMode(GL_PROJECTION); 1995 1999 glLoadIdentity(); … … 1998 2002 glMatrixMode(GL_MODELVIEW); 1999 2003 glLoadIdentity(); 2000 #endif2001 2004 } 2002 2005 … … 4991 4994 } 4992 4995 4993 VBoxVHWATextureImage::VBoxVHWATextureImage(const QRect &size, const VBoxVHWAColorFormat &format, class VBoxVHWAGlProgramMngr * aMgr, bool bDisablePBO) :4996 VBoxVHWATextureImage::VBoxVHWATextureImage(const QRect &size, const VBoxVHWAColorFormat &format, class VBoxVHWAGlProgramMngr * aMgr, VBOXVHWAIMG_TYPE flags) : 4994 4997 mVisibleDisplay(0), 4995 4998 mpProgram(0), … … 5000 5003 mbNotIntersected(false) 5001 5004 { 5002 mpTex[0] = vboxVHWATextureCreate(NULL, size, format, bDisablePBO);5005 mpTex[0] = vboxVHWATextureCreate(NULL, size, format, flags); 5003 5006 mColorFormat = format; 5004 5007 if(mColorFormat.fourcc() == FOURCC_YV12) 5005 5008 { 5006 5009 QRect rect(size.x()/2,size.y()/2,size.width()/2,size.height()/2); 5007 mpTex[1] = vboxVHWATextureCreate(NULL, rect, format, bDisablePBO);5008 mpTex[2] = vboxVHWATextureCreate(NULL, rect, format, bDisablePBO);5010 mpTex[1] = vboxVHWATextureCreate(NULL, rect, format, flags); 5011 mpTex[2] = vboxVHWATextureCreate(NULL, rect, format, flags); 5009 5012 mcTex = 3; 5010 5013 } … … 5161 5164 { 5162 5165 uint32_t type = calcProgramType(pDst, pDstCKey, pSrcCKey, bNotIntersected); 5163 5164 if(pDstCKey != NULL)5165 type |= VBOXVHWA_PROGRAM_DSTCOLORKEY;5166 if(pSrcCKey)5167 type |= VBOXVHWA_PROGRAM_SRCCOLORKEY;5168 if((pDstCKey || pSrcCKey) && bNotIntersected)5169 type |= VBOXVHWA_PROGRAM_COLORKEYNODISCARD;5170 5166 5171 5167 return mProgramMngr->getProgram(type, &colorFormat(), pDst ? &pDst->colorFormat() : NULL); -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxFBOverlay.h
r25445 r25453 29 29 //#define VBOXVHWADBG_RENDERCHECK 30 30 31 //#define VBOXVHWA_NEW_PBO32 33 31 #include "COMDefs.h" 34 32 #include <QGLWidget> … … 377 375 }; 378 376 377 #define VBOXVHWAIMG_PBO 0x00000001U 378 #define VBOXVHWAIMG_PBOIMG 0x00000002U 379 #define VBOXVHWAIMG_FBO 0x00000004U 380 typedef uint32_t VBOXVHWAIMG_TYPE; 381 379 382 class VBoxVHWATextureImage 380 383 { 381 384 public: 382 VBoxVHWATextureImage(const QRect &size, const VBoxVHWAColorFormat &format, class VBoxVHWAGlProgramMngr * aMgr, bool bDisablePBO);385 VBoxVHWATextureImage(const QRect &size, const VBoxVHWAColorFormat &format, class VBoxVHWAGlProgramMngr * aMgr, VBOXVHWAIMG_TYPE flags); 383 386 384 387 virtual ~VBoxVHWATextureImage() … … 549 552 { 550 553 public: 551 VBoxVHWATextureImagePBO(const QRect &size, const VBoxVHWAColorFormat &format, class VBoxVHWAGlProgramMngr * aMgr ) :552 VBoxVHWATextureImage(size, format, aMgr, true),554 VBoxVHWATextureImagePBO(const QRect &size, const VBoxVHWAColorFormat &format, class VBoxVHWAGlProgramMngr * aMgr, VBOXVHWAIMG_TYPE flags) : 555 VBoxVHWATextureImage(size, format, aMgr, flags & (~VBOXVHWAIMG_PBO)), 553 556 mPBO(0) 554 557 { … … 1575 1578 { 1576 1579 public: 1577 VBoxVHWATextureImageFBO(const QRect &size, const VBoxVHWAColorFormat &format, class VBoxVHWAGlProgramMngr * aMgr) : 1578 T(size, format, aMgr), 1579 mFBOTex(size, VBoxVHWAColorFormat(32, 0xff0000, 0xff00, 0xff), aMgr) 1580 { 1580 VBoxVHWATextureImageFBO(const QRect &size, const VBoxVHWAColorFormat &format, class VBoxVHWAGlProgramMngr * aMgr, VBOXVHWAIMG_TYPE flags) : 1581 T(size, format, aMgr, flags & (~VBOXVHWAIMG_FBO)), 1582 mFBOTex(size, VBoxVHWAColorFormat(32, 0xff0000, 0xff00, 0xff), aMgr, flags & (~VBOXVHWAIMG_FBO)), 1583 mpvFBOTexMem(NULL) 1584 { 1585 } 1586 1587 virtual ~VBoxVHWATextureImageFBO() 1588 { 1589 if(mpvFBOTexMem) 1590 free(mpvFBOTexMem); 1581 1591 } 1582 1592 … … 1584 1594 { 1585 1595 mFBO.init(); 1586 mFBOTex.init(NULL); 1587 T:init(pvMem); 1596 mpvFBOTexMem = (uchar*)malloc(mFBOTex.memSize()); 1597 mFBOTex.init(mpvFBOTexMem); 1598 T::init(pvMem); 1588 1599 mFBO.bind(); 1589 mFBO.attachBound(mFBOTex. mpTex[0]);1600 mFBO.attachBound(mFBOTex.component(0)); 1590 1601 mFBO.unbind(); 1591 1602 } … … 1595 1606 GLuint *pDisplay, class VBoxVHWAGlProgramVHWA ** ppProgram) 1596 1607 { 1597 T::createDisplay( &mFBOTex, &mFBOTex.rect(), &rect(),1608 T::createDisplay(NULL, &mFBOTex.rect(), &rect(), 1598 1609 NULL, NULL, false, 1599 1610 pDisplay, ppProgram); 1600 1611 1601 return mFBOTex.createDisplay(pDst, pDstRect, pSrcRect, 1602 pDstCKey, pSrcCKey, bNotIntersected, 1603 pDisplay, ppProgram); 1612 return mFBOTex.initDisplay(pDst, pDstRect, pSrcRect, 1613 pDstCKey, pSrcCKey, bNotIntersected); 1604 1614 } 1605 1615 1606 1616 virtual void update(const QRect * pRect) 1607 1617 { 1618 T::update(pRect); 1619 1620 VBoxGLWidget::pushSettingsAndSetupViewport(rect().size(), rect()); 1608 1621 mFBO.bind(); 1609 T:update(pRect); 1610 1611 VBoxGLWidget::pushSettingsAndSetupViewport(rect(), rect()); 1612 mFBO.bind(); 1613 mFBOTex.display(); 1622 T::display(); 1614 1623 mFBO.unbind(); 1615 1624 VBoxGLWidget::popSettingsAfterSetupViewport(); … … 1631 1640 VBoxVHWAFBO mFBO; 1632 1641 VBoxVHWATextureImage mFBOTex; 1642 uchar * mpvFBOTexMem; 1633 1643 }; 1634 1644
Note:
See TracChangeset
for help on using the changeset viewer.