MCPcopy Create free account
hub / github.com/VirtualGL/virtualgl / glXMakeCurrent

Function glXMakeCurrent

server/faker-glx.cpp:1641–1762  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1639// See notes
1640
1641Bool glXMakeCurrent(Display *dpy, GLXDrawable drawable, GLXContext ctx)
1642{
1643 Bool retval = False; const char *renderer = "Unknown";
1644 faker::VirtualWin *vw; VGLFBConfig config = 0;
1645
1646 if(faker::deadYet || faker::getFakerLevel() > 0)
1647 return _glXMakeCurrent(dpy, drawable, ctx);
1648
1649 TRY();
1650
1651 // Find the FB config that was previously hashed to this context when it was
1652 // created.
1653 if(ctx) config = CTXHASH.findConfig(ctx);
1654 if(faker::isDisplayExcluded(dpy))
1655 {
1656 faker::setGLXExcludeCurrent(true);
1657 faker::setOGLExcludeCurrent(true);
1658 return _glXMakeCurrent(dpy, drawable, ctx);
1659 }
1660 faker::setGLXExcludeCurrent(false);
1661 faker::setOGLExcludeCurrent(false);
1662
1663 /////////////////////////////////////////////////////////////////////////////
1664 OPENTRACE(glXMakeCurrent); PRARGD(dpy); PRARGX(drawable); PRARGX(ctx);
1665 STARTTRACE();
1666 /////////////////////////////////////////////////////////////////////////////
1667
1668 DISABLE_FAKER();
1669
1670 // glXMakeCurrent() implies a glFinish() on the previous context, which is
1671 // why we read back the front buffer here if it is dirty.
1672 GLXDrawable curdraw = backend::getCurrentDrawable();
1673 if(backend::getCurrentContext() && curdraw
1674 && (vw = WINHASH.find(NULL, curdraw)) != NULL)
1675 {
1676 faker::VirtualWin *newvw;
1677 if(drawable == 0 || !(newvw = WINHASH.find(dpy, drawable))
1678 || newvw->getGLXDrawable() != curdraw)
1679 {
1680 if(DrawingToFront() || vw->dirty)
1681 vw->readback(GL_FRONT, false, fconfig.sync);
1682 }
1683 }
1684
1685 // If the drawable isn't a window, we pass it through unmodified, else we
1686 // map it to an off-screen drawable.
1687 int direct = CTXHASH.isDirect(ctx);
1688 if(dpy && drawable && ctx)
1689 {
1690 if(!config)
1691 {
1692 vglout.PRINTLN("[VGL] WARNING: glXMakeCurrent() called with a previously-destroyed context.");
1693 goto done;
1694 }
1695 try
1696 {
1697 vw = WINHASH.initVW(dpy, drawable, config);
1698 if(vw)

Callers 15

initMethod · 0.85
~GLFrameMethod · 0.85
drawTileMethod · 0.85
syncMethod · 0.85
readbackTestFunction · 0.85
readbackTestMSFunction · 0.85
flushTestFunction · 0.85
multiThreadTestFunction · 0.85
offScreenTestFunction · 0.85
contextMismatchTestFunction · 0.85
copyContextTestFunction · 0.85
subWinTestFunction · 0.85

Calls 15

isDisplayExcludedFunction · 0.85
getCurrentDrawableFunction · 0.85
getCurrentContextFunction · 0.85
DrawingToFrontFunction · 0.85
setWMAtomFunction · 0.85
sendGLXErrorFunction · 0.85
makeCurrentFunction · 0.85
isDirectMethod · 0.80
PRINTLNMethod · 0.80
initVWMethod · 0.80
setDirectMethod · 0.80
getCurrentDisplayMethod · 0.80

Tested by 2

drawableInitFunction · 0.68
mainFunction · 0.68