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

Function glViewport

server/faker-gl.cpp:857–948  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

855// take that opportunity to resize the off-screen drawable.
856
857void glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
858{
859 if(faker::getOGLExcludeCurrent())
860 {
861 _glViewport(x, y, width, height); return;
862 }
863
864 TRY();
865
866 if(faker::getEGLXContextCurrent())
867 {
868 ///////////////////////////////////////////////////////////////////////////
869 OPENTRACE(glViewport); PRARGI(x); PRARGI(y); PRARGI(width);
870 PRARGI(height); STARTTRACE();
871 ///////////////////////////////////////////////////////////////////////////
872
873 EGLContext ctx = _eglGetCurrentContext();
874 EGLSurface draw = _eglGetCurrentSurface(EGL_DRAW);
875 EGLSurface read = _eglGetCurrentSurface(EGL_READ);
876 faker::EGLXDisplay *eglxdpy = faker::getCurrentEGLXDisplay();
877 EGLSurface newRead = 0, newDraw = 0;
878
879 if(eglxdpy && (draw || read) && ctx)
880 {
881 newRead = read, newDraw = draw;
882 faker::EGLXVirtualWin *drawEGLXVW =
883 EGLXWINHASH.findInternal(eglxdpy, draw);
884 faker::EGLXVirtualWin *readEGLXVW =
885 EGLXWINHASH.findInternal(eglxdpy, read);
886 if(drawEGLXVW) drawEGLXVW->checkResize();
887 if(readEGLXVW && readEGLXVW != drawEGLXVW) readEGLXVW->checkResize();
888 if(drawEGLXVW) newDraw = (EGLSurface)drawEGLXVW->updateGLXDrawable();
889 if(readEGLXVW) newRead = (EGLSurface)readEGLXVW->updateGLXDrawable();
890 if(newRead != read || newDraw != draw)
891 {
892 _eglMakeCurrent(eglxdpy->edpy, 0, 0, 0);
893 if(!_eglMakeCurrent(eglxdpy->edpy, newDraw, newRead, ctx))
894 THROW_EGL("eglMakeCurrent()");
895 if(drawEGLXVW) { drawEGLXVW->clear(); drawEGLXVW->cleanup(); }
896 if(readEGLXVW) readEGLXVW->cleanup();
897 }
898 }
899 _glViewport(x, y, width, height);
900
901 ///////////////////////////////////////////////////////////////////////////
902 STOPTRACE();
903 if(draw != newDraw) { PRARGX(draw); PRARGX(newDraw); }
904 if(read != newRead) { PRARGX(read); PRARGX(newRead); }
905 CLOSETRACE();
906 ///////////////////////////////////////////////////////////////////////////
907 }
908 else
909 {
910 ///////////////////////////////////////////////////////////////////////////
911 OPENTRACE(glViewport); PRARGI(x); PRARGI(y); PRARGI(width);
912 PRARGI(height); STARTTRACE();
913 ///////////////////////////////////////////////////////////////////////////
914

Callers 12

drawTileMethod · 0.85
runMethod · 0.85
copyContextTestFunction · 0.85
runMethod · 0.85
process_inputFunction · 0.85
renderSpheresFunction · 0.85
drawBufferFunction · 0.85
draw_loopFunction · 0.85
draw_loopFunction · 0.85
InitGLFunction · 0.85
renderSpheresFunction · 0.85
renderSpheresFunction · 0.85

Calls 12

getCurrentContextFunction · 0.85
getCurrentDrawableFunction · 0.85
getCurrentReadDrawableFunction · 0.85
getCurrentDisplayFunction · 0.85
makeCurrentFunction · 0.85
findInternalMethod · 0.80
checkResizeMethod · 0.80
cleanupMethod · 0.80
updateGLXDrawableMethod · 0.45
clearMethod · 0.45
findConfigMethod · 0.45
findMethod · 0.45

Tested by 1

drawBufferFunction · 0.68