From e514295ccf3017cfcbc6dd5a281107664ea3ccd2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jos=C3=A9=20Fonseca?= Date: Wed, 3 Oct 2012 15:55:51 +0100 Subject: [PATCH] Minimal implementation of CGLCreateContext/CGLDestroyContext. Doesn't change much in practice, other than avoiding spurious warnings. --- retrace/glretrace_cgl.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) 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}, -- 2.45.2