From: José Fonseca <jose.r.fonseca@gmail.com>
Date: Wed, 11 Jul 2012 11:14:31 +0000 (+0100)
Subject: Eliminate destroyContext.
X-Git-Url: https://git.cworth.org/git?a=commitdiff_plain;h=5c298db8fe117e0a445af051335aa0da91c3a31b;p=apitrace

Eliminate destroyContext.

Same as releaseContext.
---

diff --git a/wrappers/cgltrace.py b/wrappers/cgltrace.py
index 4bb0c4c..e7cbd7b 100644
--- a/wrappers/cgltrace.py
+++ b/wrappers/cgltrace.py
@@ -53,7 +53,7 @@ class CglTracer(GlTracer):
 
         if function.name == 'CGLDestroyContext':
             # The same rule applies here about the  as for CGLReleaseContext.
-            print '    if (gltrace::destroyContext((uintptr_t)ctx)) {'
+            print '    if (gltrace::releaseContext((uintptr_t)ctx)) {'
             print '        if (_CGLGetCurrentContext() == ctx) {'
             print '            gltrace::clearContext();'
             print '        }'
diff --git a/wrappers/egltrace.py b/wrappers/egltrace.py
index fb8a3a0..1805846 100644
--- a/wrappers/egltrace.py
+++ b/wrappers/egltrace.py
@@ -77,8 +77,9 @@ class EglTracer(GlTracer):
             print '    }'
 
         if function.name == 'eglDestroyContext':
-            print '    if (_result)'
-            print '        gltrace::destroyContext((uintptr_t)ctx);'
+            print '    if (_result) {'
+            print '        gltrace::releaseContext((uintptr_t)ctx);'
+            print '    }'
 
 if __name__ == '__main__':
     print '#include <stdlib.h>'
diff --git a/wrappers/gltrace.hpp b/wrappers/gltrace.hpp
index 49d8631..db824bb 100644
--- a/wrappers/gltrace.hpp
+++ b/wrappers/gltrace.hpp
@@ -47,17 +47,18 @@ public:
     bool user_arrays_nv;
     unsigned retain_count;
 
-    Context(void) : profile(PROFILE_COMPAT), user_arrays(false),
-                    user_arrays_arb(false), user_arrays_nv(false),
-                    retain_count(0) { }
+    Context(void) :
+        profile(PROFILE_COMPAT),
+        user_arrays(false),
+        user_arrays_arb(false),
+        user_arrays_nv(false),
+        retain_count(0)
+    { }
 };
 
 void
 createContext(uintptr_t context_id);
 
-bool
-destroyContext(uintptr_t context_id);
-
 void
 retainContext(uintptr_t context_id);
 
diff --git a/wrappers/gltrace_state.cpp b/wrappers/gltrace_state.cpp
index 9fcc56e..cb8e08b 100644
--- a/wrappers/gltrace_state.cpp
+++ b/wrappers/gltrace_state.cpp
@@ -126,15 +126,6 @@ void createContext(uintptr_t context_id)
     context_map_mutex.unlock();
 }
 
-/*
- * return true if the context has been destroyed, false otherwise. See
- * the note at releaseContext about the actual ccontext lifetime.
- */
-bool destroyContext(uintptr_t context_id)
-{
-    return releaseContext(context_id);
-}
-
 void setContext(uintptr_t context_id)
 {
     ThreadState *ts = get_ts();
diff --git a/wrappers/glxtrace.py b/wrappers/glxtrace.py
index 73e41b3..ff3eb4c 100644
--- a/wrappers/glxtrace.py
+++ b/wrappers/glxtrace.py
@@ -46,6 +46,9 @@ class GlxTracer(GlTracer):
     ]
 
     def traceFunctionImplBody(self, function):
+        if function.name == 'glXDestroyContext':
+            print '    gltrace::releaseContext((uintptr_t)ctx);'
+
         GlTracer.traceFunctionImplBody(self, function)
 
         if function.name == 'glXCreateContext':
@@ -60,9 +63,6 @@ class GlxTracer(GlTracer):
             print '            gltrace::clearContext();'
             print '    }'
 
-        if function.name == 'glXDestroyContext':
-            print '    gltrace::destroyContext((uintptr_t)ctx);'
-
 
 if __name__ == '__main__':
     print
diff --git a/wrappers/wgltrace.py b/wrappers/wgltrace.py
index b3a29e2..1b00357 100644
--- a/wrappers/wgltrace.py
+++ b/wrappers/wgltrace.py
@@ -46,7 +46,7 @@ class WglTracer(GlTracer):
             print '    if (_wglGetCurrentContext() == hglrc) {'
             print '        gltrace::clearContext();'
             print '    }'
-            print '    gltrace::destroyContext((uintptr_t)hglrc);'
+            print '    gltrace::releaseContext((uintptr_t)hglrc);'
 
         GlTracer.traceFunctionImplBody(self, function)