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

Function createContext

server/backend.cpp:147–294  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

145
146
147GLXContext createContext(Display *dpy, VGLFBConfig config, GLXContext share,
148 Bool direct, const int *glxAttribs)
149{
150 if(fconfig.egl)
151 {
152 if(!direct) return NULL;
153
154 int eglAttribs[MAX_ATTRIBS + 1], egli = 0;
155 for(int i = 0; i < MAX_ATTRIBS + 1; i++) eglAttribs[i] = EGL_NONE;
156 bool majorVerSpecified = false, forwardCompatSpecified = false;
157 int majorVer = -1;
158
159 if(glxAttribs && glxAttribs[0] != None)
160 {
161 for(int glxi = 0; glxAttribs[glxi] && egli < MAX_ATTRIBS; glxi += 2)
162 {
163 switch(glxAttribs[glxi])
164 {
165 case GLX_CONTEXT_MAJOR_VERSION_ARB:
166 eglAttribs[egli++] = EGL_CONTEXT_MAJOR_VERSION;
167 eglAttribs[egli++] = majorVer = glxAttribs[glxi + 1];
168 majorVerSpecified = true;
169 break;
170 case GLX_CONTEXT_MINOR_VERSION_ARB:
171 eglAttribs[egli++] = EGL_CONTEXT_MINOR_VERSION;
172 eglAttribs[egli++] = glxAttribs[glxi + 1];
173 break;
174 case GLX_CONTEXT_FLAGS_ARB:
175 {
176 int flags = glxAttribs[glxi + 1];
177 if(flags & GLX_CONTEXT_DEBUG_BIT_ARB)
178 {
179 eglAttribs[egli++] = EGL_CONTEXT_OPENGL_DEBUG;
180 eglAttribs[egli++] = EGL_TRUE;
181 }
182 if(flags & GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB)
183 {
184 eglAttribs[egli++] = EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE;
185 eglAttribs[egli++] = EGL_TRUE;
186 forwardCompatSpecified = true;
187 }
188 if(flags & GLX_CONTEXT_ROBUST_ACCESS_BIT_ARB)
189 {
190 // For future expansion
191 eglAttribs[egli++] = EGL_CONTEXT_OPENGL_ROBUST_ACCESS;
192 eglAttribs[egli++] = EGL_TRUE;
193 }
194 if(flags & ~(GLX_CONTEXT_DEBUG_BIT_ARB |
195 GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB))
196 {
197 faker::sendGLXError(dpy, X_GLXCreateContextAttribsARB, BadValue,
198 true);
199 return NULL;
200 }
201 break;
202 }
203 case GLX_CONTEXT_PROFILE_MASK_ARB:
204 // The mask bits are the same for GLX_ARB_create_context and EGL.

Callers 4

initReadbackContextMethod · 0.85
glXCreateContextFunction · 0.85
glXCreateNewContextFunction · 0.85

Calls 5

sendGLXErrorFunction · 0.85
EGLErrorClass · 0.85
createContextMethod · 0.80
getContextMethod · 0.80
addMethod · 0.45

Tested by

no test coverage detected