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

Function glXMakeContextCurrent

server/faker-glx.cpp:1765–1916  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1763
1764
1765Bool glXMakeContextCurrent(Display *dpy, GLXDrawable draw, GLXDrawable read,
1766 GLXContext ctx)
1767{
1768 Bool retval = False; const char *renderer = "Unknown";
1769 faker::VirtualWin *vw; VGLFBConfig config = 0;
1770
1771 if(faker::deadYet || faker::getFakerLevel() > 0)
1772 return _glXMakeContextCurrent(dpy, draw, read, ctx);
1773
1774 TRY();
1775
1776 if(ctx) config = CTXHASH.findConfig(ctx);
1777 if(faker::isDisplayExcluded(dpy))
1778 {
1779 faker::setGLXExcludeCurrent(true);
1780 faker::setOGLExcludeCurrent(true);
1781 return _glXMakeContextCurrent(dpy, draw, read, ctx);
1782 }
1783 faker::setGLXExcludeCurrent(false);
1784 faker::setOGLExcludeCurrent(false);
1785
1786 /////////////////////////////////////////////////////////////////////////////
1787 OPENTRACE(glXMakeContextCurrent); PRARGD(dpy); PRARGX(draw); PRARGX(read);
1788 PRARGX(ctx); STARTTRACE();
1789 /////////////////////////////////////////////////////////////////////////////
1790
1791 DISABLE_FAKER();
1792
1793 // glXMakeContextCurrent() implies a glFinish() on the previous context,
1794 // which is why we read back the front buffer here if it is dirty.
1795 GLXDrawable curdraw = backend::getCurrentDrawable();
1796 if(backend::getCurrentContext() && curdraw
1797 && (vw = WINHASH.find(NULL, curdraw)) != NULL)
1798 {
1799 faker::VirtualWin *newvw;
1800 if(draw == 0 || !(newvw = WINHASH.find(dpy, draw))
1801 || newvw->getGLXDrawable() != curdraw)
1802 {
1803 if(DrawingToFront() || vw->dirty)
1804 vw->readback(GL_FRONT, false, fconfig.sync);
1805 }
1806 }
1807
1808 // If the drawable isn't a window, we pass it through unmodified, else we
1809 // map it to an off-screen drawable.
1810 faker::VirtualWin *drawVW, *readVW;
1811 int direct = CTXHASH.isDirect(ctx);
1812 if(dpy && (draw || read) && ctx)
1813 {
1814 if(!config)
1815 {
1816 vglout.PRINTLN("[VGL] WARNING: glXMakeContextCurrent() called with a previously-destroyed context");
1817 goto done;
1818 }
1819 try
1820 {
1821 bool differentReadDrawable = (read && read != draw);
1822

Callers 9

readbackTestFunction · 0.85
readbackTestMSFunction · 0.85
runMethod · 0.85
offScreenTestFunction · 0.85
contextMismatchTestFunction · 0.85
extensionQueryTestFunction · 0.85
glXMakeCurrentReadSGIFunction · 0.85
drawBufferFunction · 0.85
drawableInitFunction · 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

drawBufferFunction · 0.68
drawableInitFunction · 0.68