extern bool double_buffer;
extern bool insideGlBeginEnd;
extern trace::Parser parser;
+extern glws::Profile defaultProfile;
extern glws::Visual *visual;
extern glws::Drawable *drawable;
extern glws::Context *context;
it = context_map.find(ctx);
if (it == context_map.end()) {
glws::Context *context;
- context_map[ctx] = context = glws::createContext(visual, sharedContext);
+ context_map[ctx] = context = glws::createContext(visual, sharedContext, glretrace::defaultProfile);
if (!sharedContext) {
sharedContext = context;
}
ContextMap::const_iterator it;
it = context_map.find(context_ptr);
if (it == context_map.end()) {
- return (context_map[context_ptr] = glws::createContext(visual, NULL));
+ return (context_map[context_ptr] = glws::createContext(visual, NULL, glretrace::defaultProfile));
}
return it->second;
unsigned long long orig_context = call.ret->toUIntPtr();
glws::Context *share_context = getContext(call.arg(2).toUIntPtr());
- glws::Context *context = glws::createContext(glretrace::visual, share_context);
+ glws::Context *context = glws::createContext(glretrace::visual, share_context, glretrace::defaultProfile);
context_map[orig_context] = context;
}
unsigned long long orig_context = call.ret->toUIntPtr();
glws::Context *share_context = getContext(call.arg(2).toUIntPtr());
- glws::Context *context = glws::createContext(glretrace::visual, share_context);
+ glws::Context *context = glws::createContext(glretrace::visual, share_context, glretrace::defaultProfile);
context_map[orig_context] = context;
}
unsigned long long orig_context = call.ret->toUIntPtr();
glws::Context *share_context = getContext(call.arg(3).toUIntPtr());
- glws::Context *context = glws::createContext(glretrace::visual, share_context);
+ glws::Context *context = glws::createContext(glretrace::visual, share_context, glretrace::defaultProfile);
context_map[orig_context] = context;
}
bool double_buffer = true;
bool insideGlBeginEnd = false;
trace::Parser parser;
+glws::Profile defaultProfile = glws::PROFILE_COMPAT;
glws::Visual *visual = NULL;
glws::Drawable *drawable = NULL;
glws::Context *context = NULL;
"\n"
" -b benchmark mode (no error checking or warning messages)\n"
" -c PREFIX compare against snapshots\n"
+ " -core use core profile\n"
" -db use a double buffer visual (default)\n"
" -sb use a single buffer visual\n"
" -s PREFIX take snapshots; `-` for PNM stdout output\n"
} else if (!strcmp(arg, "-D")) {
dump_state = atoi(argv[++i]);
retrace::verbosity = -2;
+ } else if (!strcmp(arg, "-core")) {
+ defaultProfile = glws::PROFILE_CORE;
} else if (!strcmp(arg, "-db")) {
double_buffer = true;
} else if (!strcmp(arg, "-sb")) {
static void retrace_wglCreateContext(trace::Call &call) {
unsigned long long orig_context = call.ret->toUIntPtr();
- glws::Context *context = glws::createContext(glretrace::visual);
+ glws::Context *context = glws::createContext(glretrace::visual, NULL, glretrace::defaultProfile);
context_map[orig_context] = context;
}
glws::Context *old_context = context_map[hglrc2];
glws::Context *new_context =
- glws::createContext(old_context->visual, share_context);
+ glws::createContext(old_context->visual, share_context, glretrace::defaultProfile);
if (new_context) {
if (context == old_context) {
glws::makeCurrent(drawable, new_context);
share_context = context_map[call.arg(1).toUIntPtr()];
}
- glws::Context *context = glws::createContext(glretrace::visual, share_context);
+ glws::Context *context = glws::createContext(glretrace::visual, share_context, glretrace::defaultProfile);
context_map[orig_context] = context;
}
enum Profile {
- PROFILE_COMPAT,
+ PROFILE_COMPAT = 0,
+ PROFILE_CORE,
PROFILE_ES1,
PROFILE_ES2,
};
load("libGL.so.1");
eglBindAPI(EGL_OPENGL_API);
break;
+ case PROFILE_CORE:
+ assert(0);
+ return NULL;
case PROFILE_ES1:
load("libGLESv1_CM.so.1");
eglBindAPI(EGL_OPENGL_ES_API);
GLXContext share_context = NULL;
GLXContext context;
- if (profile != PROFILE_COMPAT) {
- return NULL;
- }
-
if (shareContext) {
share_context = static_cast<GlxContext*>(shareContext)->context;
}
if (glxVersion >= 0x0104 && has_GLX_ARB_create_context) {
Attributes<int> attribs;
+
attribs.add(GLX_RENDER_TYPE, GLX_RGBA_TYPE);
if (debug) {
attribs.add(GLX_CONTEXT_FLAGS_ARB, GLX_CONTEXT_DEBUG_BIT_ARB);
}
+
+ switch (profile) {
+ case PROFILE_COMPAT:
+ break;
+ case PROFILE_CORE:
+ // XXX: This will invariable return a 3.2 context, when supported.
+ // We probably should have a PROFILE_CORE_XX per version.
+ attribs.add(GLX_CONTEXT_MAJOR_VERSION_ARB, 3);
+ attribs.add(GLX_CONTEXT_MINOR_VERSION_ARB, 2);
+ attribs.add(GLX_CONTEXT_PROFILE_MASK_ARB, GLX_CONTEXT_CORE_PROFILE_BIT_ARB);
+ break;
+ default:
+ return NULL;
+ }
+
attribs.end();
context = glXCreateContextAttribsARB(display, visual->fbconfig, share_context, True, attribs);
- } else
- if (glxVersion >= 0x103) {
- context = glXCreateNewContext(display, visual->fbconfig, GLX_RGBA_TYPE, share_context, True);
} else {
- context = glXCreateContext(display, visual->visinfo, share_context, True);
+ if (profile != PROFILE_COMPAT) {
+ return NULL;
+ }
+
+ if (glxVersion >= 0x103) {
+ context = glXCreateNewContext(display, visual->fbconfig, GLX_RGBA_TYPE, share_context, True);
+ } else {
+ context = glXCreateContext(display, visual->visinfo, share_context, True);
+ }
+ }
+
+ if (!context) {
+ return NULL;
}
return new GlxContext(visual, profile, context);