Permalink
Browse files

Create a Visual for each Profile.

Signed-off-by: José Fonseca <jose.r.fonseca@gmail.com>
  • Loading branch information...
1 parent fefa663 commit c58efb0e18f41e8db5522ccbed02f5a6bcca8b51 @afrantzis afrantzis committed with jrfonseca Dec 5, 2011
Showing with 27 additions and 18 deletions.
  1. +1 −1 glretrace.hpp
  2. +2 −2 glretrace_cgl.cpp
  3. +2 −2 glretrace_egl.cpp
  4. +5 −5 glretrace_glx.cpp
  5. +10 −4 glretrace_main.cpp
  6. +4 −4 glretrace_wgl.cpp
  7. +1 −0 glws.hpp
  8. +2 −0 glws_egl_xlib.cpp
View
@@ -38,7 +38,7 @@ extern bool double_buffer;
extern bool insideGlBeginEnd;
extern trace::Parser parser;
extern glws::Profile defaultProfile;
-extern glws::Visual *visual;
+extern glws::Visual *visual[glws::PROFILE_MAX];
extern glws::Drawable *drawable;
extern glws::Context *context;
View
@@ -53,7 +53,7 @@ getDrawable(unsigned long drawable_id) {
DrawableMap::const_iterator it;
it = drawable_map.find(drawable_id);
if (it == drawable_map.end()) {
- return (drawable_map[drawable_id] = glws::createDrawable(visual));
+ return (drawable_map[drawable_id] = glws::createDrawable(visual[glretrace::defaultProfile]));
}
return it->second;
@@ -70,7 +70,7 @@ getContext(unsigned long long ctx) {
it = context_map.find(ctx);
if (it == context_map.end()) {
glws::Context *context;
- context_map[ctx] = context = glws::createContext(visual, sharedContext, glretrace::defaultProfile);
+ context_map[ctx] = context = glws::createContext(visual[glretrace::defaultProfile], sharedContext, glretrace::defaultProfile);
if (!sharedContext) {
sharedContext = context;
}
View
@@ -78,7 +78,7 @@ getContext(unsigned long long context_ptr) {
static void retrace_eglCreateWindowSurface(trace::Call &call) {
unsigned long long orig_surface = call.ret->toUIntPtr();
- glws::Drawable *drawable = glws::createDrawable(glretrace::visual);
+ glws::Drawable *drawable = glws::createDrawable(glretrace::visual[glws::PROFILE_COMPAT]);
drawable_map[orig_surface] = drawable;
}
@@ -126,7 +126,7 @@ static void retrace_eglCreateContext(trace::Call &call) {
}
- glws::Context *context = glws::createContext(glretrace::visual, share_context, profile);
+ glws::Context *context = glws::createContext(glretrace::visual[glws::PROFILE_COMPAT], share_context, profile);
if (!context) {
const char *name;
switch (profile) {
View
@@ -47,7 +47,7 @@ getDrawable(unsigned long drawable_id) {
DrawableMap::const_iterator it;
it = drawable_map.find(drawable_id);
if (it == drawable_map.end()) {
- return (drawable_map[drawable_id] = glws::createDrawable(visual));
+ return (drawable_map[drawable_id] = glws::createDrawable(visual[glretrace::defaultProfile]));
}
return it->second;
@@ -62,7 +62,7 @@ getContext(unsigned long long context_ptr) {
ContextMap::const_iterator it;
it = context_map.find(context_ptr);
if (it == context_map.end()) {
- return (context_map[context_ptr] = glws::createContext(visual, NULL, glretrace::defaultProfile));
+ return (context_map[context_ptr] = glws::createContext(visual[glretrace::defaultProfile], NULL, glretrace::defaultProfile));
}
return it->second;
@@ -72,15 +72,15 @@ static void retrace_glXCreateContext(trace::Call &call) {
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, glretrace::defaultProfile);
+ glws::Context *context = glws::createContext(glretrace::visual[glretrace::defaultProfile], share_context, glretrace::defaultProfile);
context_map[orig_context] = context;
}
static void retrace_glXCreateContextAttribsARB(trace::Call &call) {
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, glretrace::defaultProfile);
+ glws::Context *context = glws::createContext(glretrace::visual[glretrace::defaultProfile], share_context, glretrace::defaultProfile);
context_map[orig_context] = context;
}
@@ -134,7 +134,7 @@ static void retrace_glXCreateNewContext(trace::Call &call) {
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, glretrace::defaultProfile);
+ glws::Context *context = glws::createContext(glretrace::visual[glretrace::defaultProfile], share_context, glretrace::defaultProfile);
context_map[orig_context] = context;
}
View
@@ -40,7 +40,7 @@ bool double_buffer = true;
bool insideGlBeginEnd = false;
trace::Parser parser;
glws::Profile defaultProfile = glws::PROFILE_COMPAT;
-glws::Visual *visual = NULL;
+glws::Visual *visual[glws::PROFILE_MAX];
glws::Drawable *drawable = NULL;
glws::Context *context = NULL;
@@ -330,7 +330,10 @@ int main(int argc, char **argv)
}
glws::init();
- visual = glws::createVisual(double_buffer, defaultProfile);
+ visual[glws::PROFILE_COMPAT] = glws::createVisual(double_buffer, glws::PROFILE_COMPAT);
+ visual[glws::PROFILE_CORE] = glws::createVisual(double_buffer, glws::PROFILE_CORE);
+ visual[glws::PROFILE_ES1] = glws::createVisual(double_buffer, glws::PROFILE_ES1);
+ visual[glws::PROFILE_ES2] = glws::createVisual(double_buffer, glws::PROFILE_ES2);
for ( ; i < argc; ++i) {
if (!parser.open(argv[i])) {
@@ -342,8 +345,11 @@ int main(int argc, char **argv)
parser.close();
}
-
- delete visual;
+
+ for (int n = 0; n < glws::PROFILE_MAX; n++) {
+ delete visual[n];
+ }
+
glws::cleanup();
return 0;
View
@@ -48,15 +48,15 @@ getDrawable(unsigned long long hdc) {
DrawableMap::const_iterator it;
it = drawable_map.find(hdc);
if (it == drawable_map.end()) {
- return (drawable_map[hdc] = glws::createDrawable(visual));
+ return (drawable_map[hdc] = glws::createDrawable(visual[glretrace::defaultProfile]));
}
return it->second;
}
static void retrace_wglCreateContext(trace::Call &call) {
unsigned long long orig_context = call.ret->toUIntPtr();
- glws::Context *context = glws::createContext(glretrace::visual, NULL, glretrace::defaultProfile);
+ glws::Context *context = glws::createContext(glretrace::visual[glretrace::defaultProfile], NULL, glretrace::defaultProfile);
context_map[orig_context] = context;
}
@@ -181,7 +181,7 @@ static void retrace_wglCreatePbufferARB(trace::Call &call) {
int iHeight = call.arg(3).toUInt();
unsigned long long orig_pbuffer = call.ret->toUIntPtr();
- glws::Drawable *drawable = glws::createDrawable(glretrace::visual);
+ glws::Drawable *drawable = glws::createDrawable(glretrace::visual[glretrace::defaultProfile]);
drawable->resize(iWidth, iHeight);
drawable->show();
@@ -223,7 +223,7 @@ static void retrace_wglCreateContextAttribsARB(trace::Call &call) {
share_context = context_map[call.arg(1).toUIntPtr()];
}
- glws::Context *context = glws::createContext(glretrace::visual, share_context, glretrace::defaultProfile);
+ glws::Context *context = glws::createContext(glretrace::visual[glretrace::defaultProfile], share_context, glretrace::defaultProfile);
context_map[orig_context] = context;
}
View
@@ -42,6 +42,7 @@ enum Profile {
PROFILE_CORE,
PROFILE_ES1,
PROFILE_ES2,
+ PROFILE_MAX
};
View
@@ -384,6 +384,8 @@ createContext(const Visual *_visual, Context *shareContext, Profile profile)
eglBindAPI(EGL_OPENGL_ES_API);
attribs.add(EGL_CONTEXT_CLIENT_VERSION, 2);
break;
+ default:
+ return NULL;
}
attribs.end(EGL_NONE);

0 comments on commit c58efb0

Please sign in to comment.