From: José Fonseca Date: Wed, 3 Oct 2012 14:55:51 +0000 (+0100) Subject: Minimal implementation of CGLCreateContext/CGLDestroyContext. X-Git-Url: https://git.cworth.org/git?a=commitdiff_plain;h=e514295ccf3017cfcbc6dd5a281107664ea3ccd2;p=apitrace Minimal implementation of CGLCreateContext/CGLDestroyContext. Doesn't change much in practice, other than avoiding spurious warnings. --- diff --git a/retrace/glretrace_cgl.cpp b/retrace/glretrace_cgl.cpp index 76b62fb..0419d95 100644 --- a/retrace/glretrace_cgl.cpp +++ b/retrace/glretrace_cgl.cpp @@ -80,6 +80,32 @@ getContext(unsigned long long ctx) { return it->second; } +static void retrace_CGLCreateContext(trace::Call &call) { + unsigned long long share = call.arg(1).toUIntPtr(); + Context *sharedContext = getContext(share); + + const trace::Array *ctx_ptr = dynamic_cast(&call.arg(2)); + unsigned long long ctx = ctx_ptr->values[0]->toUIntPtr(); + + Context *context = glretrace::createContext(sharedContext); + context_map[ctx] = context; +} + + +static void retrace_CGLDestroyContext(trace::Call &call) { + unsigned long long ctx = call.arg(0).toUIntPtr(); + + ContextMap::iterator it; + it = context_map.find(ctx); + if (it == context_map.end()) { + return; + } + + delete it->second; + + context_map.erase(it); +} + static void retrace_CGLSetCurrentContext(trace::Call &call) { unsigned long long ctx = call.arg(0).toUIntPtr(); @@ -105,6 +131,8 @@ static void retrace_CGLFlushDrawable(trace::Call &call) { const retrace::Entry glretrace::cgl_callbacks[] = { + {"CGLCreateContext", &retrace_CGLCreateContext}, + {"CGLDestroyContext", &retrace_CGLDestroyContext}, {"CGLSetCurrentContext", &retrace_CGLSetCurrentContext}, {"CGLGetCurrentContext", &retrace::ignore}, {"CGLEnable", &retrace::ignore},