[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

apitrace: Changes to 'debian-unstable'



 INSTALL.markdown                                     |   16 
 LICENSE                                              |    9 
 README.markdown                                      |   25 
 cmake/toolchain/android.toolchain.cmake              |  287 +++---
 common/os_posix.cpp                                  |    6 
 common/os_time.hpp                                   |   24 
 common/os_win32.cpp                                  |    9 
 common/pickle.hpp                                    |    9 
 common/trace_parser_flags.cpp                        |    3 
 common/trace_profiler.cpp                            |   61 -
 common/trace_profiler.hpp                            |   23 
 debian/changelog                                     |    2 
 debian/patches/02_use_system_libpng_snappy_zlib.diff |   16 
 gui/CMakeLists.txt                                   |   14 
 gui/calldurationgraph.h                              |  173 +++
 gui/graphing/frameaxiswidget.cpp                     |   99 ++
 gui/graphing/frameaxiswidget.h                       |   32 
 gui/graphing/graphaxiswidget.cpp                     |  141 +++
 gui/graphing/graphaxiswidget.h                       |   73 +
 gui/graphing/graphing.h                              |   48 +
 gui/graphing/graphlabelwidget.h                      |   42 
 gui/graphing/graphview.cpp                           |  187 ++++
 gui/graphing/graphview.h                             |   93 ++
 gui/graphing/graphwidget.cpp                         |  583 ++++++++++++
 gui/graphing/graphwidget.h                           |  112 ++
 gui/graphing/heatmapverticalaxiswidget.cpp           |   82 +
 gui/graphing/heatmapverticalaxiswidget.h             |   24 
 gui/graphing/heatmapview.cpp                         |  276 +++++
 gui/graphing/heatmapview.h                           |  124 ++
 gui/graphing/histogramview.cpp                       |  258 +++++
 gui/graphing/histogramview.h                         |   41 
 gui/graphing/timeaxiswidget.cpp                      |   80 +
 gui/graphing/timeaxiswidget.h                        |   16 
 gui/main.cpp                                         |    1 
 gui/profiledialog.cpp                                |  252 ++++-
 gui/profiledialog.h                                  |    7 
 gui/profileheatmap.h                                 |  470 ++++++++++
 gui/profiletablemodel.cpp                            |   87 +
 gui/profiletablemodel.h                              |   15 
 gui/profiling.h                                      |  128 ++
 gui/timelinewidget.cpp                               |  883 -------------------
 gui/timelinewidget.h                                 |  119 --
 gui/ui/profiledialog.ui                              |  248 +----
 helpers/glsize.hpp                                   |   30 
 retrace/d3dretrace_main.cpp                          |    1 
 retrace/d3dstate.cpp                                 |  120 ++
 retrace/glretrace.hpp                                |    6 
 retrace/glretrace.py                                 |   19 
 retrace/glretrace_cgl.cpp                            |   85 +
 retrace/glretrace_glx.cpp                            |   59 +
 retrace/glretrace_main.cpp                           |   14 
 retrace/glretrace_wgl.cpp                            |   11 
 retrace/glretrace_ws.cpp                             |   10 
 retrace/glstate_images.cpp                           |   11 
 retrace/glws.cpp                                     |   85 +
 retrace/glws.hpp                                     |    8 
 retrace/glws_cocoa.mm                                |    6 
 retrace/glws_glx.cpp                                 |   33 
 retrace/retrace_swizzle.cpp                          |   14 
 scripts/tracediff.py                                 |   10 
 scripts/tracediff2.py                                |    2 
 scripts/unpickle.py                                  |   41 
 specs/glapi.py                                       |   38 
 specs/gltypes.py                                     |    1 
 specs/glxapi.py                                      |    8 
 wrappers/.gitignore                                  |    1 
 wrappers/CMakeLists.txt                              |    1 
 wrappers/gltrace_state.cpp                           |    7 
 68 files changed, 4273 insertions(+), 1546 deletions(-)

New commits:
commit 71cffbd5db7db30747721a0e210a2a926fe671af
Author: Christopher James Halse Rogers <raof@ubuntu.com>
Date:   Fri Oct 19 09:01:48 2012 +1100

    Refresh patches for new upstream

diff --git a/debian/patches/02_use_system_libpng_snappy_zlib.diff b/debian/patches/02_use_system_libpng_snappy_zlib.diff
index 3171e8b..9d9612c 100644
--- a/debian/patches/02_use_system_libpng_snappy_zlib.diff
+++ b/debian/patches/02_use_system_libpng_snappy_zlib.diff
@@ -4,8 +4,8 @@ Forwarded: not-needed
 
 Index: apitrace/CMakeLists.txt
 ===================================================================
---- apitrace.orig/CMakeLists.txt	2012-08-21 11:28:58.205446085 +1000
-+++ apitrace/CMakeLists.txt	2012-08-21 11:28:58.501446094 +1000
+--- apitrace.orig/CMakeLists.txt	2012-10-19 08:59:55.000000000 +1100
++++ apitrace/CMakeLists.txt	2012-10-19 09:00:05.801094746 +1100
 @@ -159,23 +159,24 @@
  # - on unices to prevent symbol collisions when tracing applications that link
  # against other versions of these libraries
@@ -44,8 +44,8 @@ Index: apitrace/CMakeLists.txt
  
 Index: apitrace/common/trace_file_zlib.cpp
 ===================================================================
---- apitrace.orig/common/trace_file_zlib.cpp	2012-08-21 09:49:30.677240886 +1000
-+++ apitrace/common/trace_file_zlib.cpp	2012-08-21 11:28:58.501446094 +1000
+--- apitrace.orig/common/trace_file_zlib.cpp	2012-08-17 12:29:29.000000000 +1000
++++ apitrace/common/trace_file_zlib.cpp	2012-10-19 09:00:05.801094746 +1100
 @@ -31,7 +31,6 @@
  #include <string.h>
  
@@ -112,8 +112,8 @@ Index: apitrace/common/trace_file_zlib.cpp
  
 Index: apitrace/wrappers/CMakeLists.txt
 ===================================================================
---- apitrace.orig/wrappers/CMakeLists.txt	2012-08-17 12:29:29.206106465 +1000
-+++ apitrace/wrappers/CMakeLists.txt	2012-08-21 11:29:15.353446673 +1000
+--- apitrace.orig/wrappers/CMakeLists.txt	2012-10-19 08:58:34.000000000 +1100
++++ apitrace/wrappers/CMakeLists.txt	2012-10-19 09:01:06.181091522 +1100
 @@ -7,6 +7,7 @@
      ${CMAKE_SOURCE_DIR}/helpers
      ${CMAKE_BINARY_DIR}/dispatch
@@ -129,10 +129,10 @@ Index: apitrace/wrappers/CMakeLists.txt
 -        ${ZLIB_LIBRARIES}
 -        ${SNAPPY_LIBRARIES}
 +        ${BUNDLED_SNAPPY_LIBRARIES}
-         ${X11_X11_LIB}
          ${CMAKE_THREAD_LIBS_INIT}
          dl
-@@ -393,8 +393,7 @@
+     )
+@@ -392,8 +392,7 @@
          glproc_egl
          common_trace
          common

commit f59aa24bcea694ceb32a2ba6c5265a78c428e716
Author: Christopher James Halse Rogers <raof@ubuntu.com>
Date:   Fri Oct 19 08:59:19 2012 +1100

    Bump changelog for new upstream snapshot

diff --git a/debian/changelog b/debian/changelog
index d27daf4..62fbe2c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,4 +1,4 @@
-apitrace (3.0+git20120817.56ad11c7-1) UNRELEASED; urgency=low
+apitrace (3.0+git20121018.d1c301f7-1) UNRELEASED; urgency=low
 
   * Initial release (Closes: #636679, LP: #813848)
 

commit d1c301f7dbb2a90a52cd0109b5185c4ad463a612
Author: José Fonseca <jose.r.fonseca@gmail.com>
Date:   Thu Oct 18 15:22:41 2012 +0100

    Check extensions via glGetStringi() on core profile.
    
    Fixes segfault on MacOSX, given that glGetString() returns NULL there.

diff --git a/retrace/glretrace.hpp b/retrace/glretrace.hpp
index 11f4d27..7729ec5 100644
--- a/retrace/glretrace.hpp
+++ b/retrace/glretrace.hpp
@@ -48,6 +48,12 @@ struct Context {
     glws::Context* wsContext;
     GLuint activeProgram;
     bool used;
+    
+    // Context must be current
+    inline bool
+    hasExtension(const char *extension) const {
+        return wsContext->hasExtension(extension);
+    }
 };
 
 extern bool insideList;
diff --git a/retrace/glretrace_main.cpp b/retrace/glretrace_main.cpp
index 1086be9..05567a2 100755
--- a/retrace/glretrace_main.cpp
+++ b/retrace/glretrace_main.cpp
@@ -230,13 +230,12 @@ endProfile(trace::Call &call, bool isDraw) {
 
 void
 initContext() {
-    const char* extensions = (const char*)glGetString(GL_EXTENSIONS);
-
     /* Ensure we have adequate extension support */
-    supportsTimestamp   = glws::checkExtension("GL_ARB_timer_query", extensions);
-    supportsElapsed     = glws::checkExtension("GL_EXT_timer_query", extensions) || supportsTimestamp;
-    supportsOcclusion   = glws::checkExtension("GL_ARB_occlusion_query", extensions);
-    supportsDebugOutput = glws::checkExtension("GL_ARB_debug_output", extensions);
+    assert(currentContext);
+    supportsTimestamp   = currentContext->hasExtension("GL_ARB_timer_query");
+    supportsElapsed     = currentContext->hasExtension("GL_EXT_timer_query") || supportsTimestamp;
+    supportsOcclusion   = currentContext->hasExtension("GL_ARB_occlusion_query");
+    supportsDebugOutput = currentContext->hasExtension("GL_ARB_debug_output");
 
     /* Check for timer query support */
     if (retrace::profilingGpuTimes) {
diff --git a/retrace/glretrace_ws.cpp b/retrace/glretrace_ws.cpp
index bead54e..ccc7023 100644
--- a/retrace/glretrace_ws.cpp
+++ b/retrace/glretrace_ws.cpp
@@ -132,16 +132,14 @@ makeCurrent(trace::Call &call, glws::Drawable *drawable, Context *context)
         return false;
     }
 
-    if (context) {
+    if (drawable && context) {
+        currentDrawable = drawable;
+        currentContext = context;
+        
         if (!context->used) {
             initContext();
             context->used = true;
         }
-    }
-
-    if (drawable && context) {
-        currentDrawable = drawable;
-        currentContext = context;
     } else {
         currentDrawable = NULL;
         currentContext = NULL;
diff --git a/retrace/glws.cpp b/retrace/glws.cpp
index 4e07ede..f89f980 100644
--- a/retrace/glws.cpp
+++ b/retrace/glws.cpp
@@ -24,6 +24,9 @@
  **************************************************************************/
 
 
+#include <assert.h>
+
+#include "glproc.hpp"
 #include "glws.hpp"
 
 
@@ -33,26 +36,68 @@ namespace glws {
 bool
 checkExtension(const char *extName, const char *extString)
 {
-   const char *p = extString;
-   const char *q = extName;
-   char c;
-   do {
-       c = *p++;
-       if (c == '\0' || c == ' ') {
-           if (q && *q == '\0') {
-               return true;
-           } else {
-               q = extName;
-           }
-       } else {
-           if (q && *q == c) {
-               ++q;
-           } else {
-               q = 0;
-           }
-       }
-   } while (c);
-   return false;
+    assert(extName);
+    assert(extString);
+
+    const char *p = extString;
+    const char *q = extName;
+    char c;
+    do {
+        c = *p++;
+        if (c == '\0' || c == ' ') {
+            if (q && *q == '\0') {
+                return true;
+            } else {
+                q = extName;
+            }
+        } else {
+            if (q && *q == c) {
+                ++q;
+            } else {
+                q = 0;
+            }
+        }
+    } while (c);
+    return false;
+}
+
+
+bool
+Context::hasExtension(const char *string) {
+    if (extensions.empty()) {
+        if (profile == PROFILE_CORE) {
+            // Use glGetStringi
+            GLint num_extensions = 0;
+            glGetIntegerv(GL_NUM_EXTENSIONS, &num_extensions);
+            for (int i = 0; i < num_extensions; ++i) {
+                const char *extension = reinterpret_cast<const char *>(glGetStringi(GL_EXTENSIONS, i));
+                if (extension) {
+                    extensions.insert(extension);
+                }
+            }
+        } else {
+            // Use glGetString
+            const char *begin = reinterpret_cast<const char *>(glGetString(GL_EXTENSIONS));
+            do {
+                const char *end = begin;
+                char c = *end;
+                while (c != '\0' && c != ' ') {
+                    ++end;
+                    c = *end;
+                }
+                if (end != begin) {
+                    extensions.insert(std::string(begin, end));
+                }
+                
+                if (c == '\0') {
+                    break;
+                }
+                begin = end + 1;
+            } while(1);
+        }
+    }
+
+    return extensions.find(string) != extensions.end();
 }
 
 
diff --git a/retrace/glws.hpp b/retrace/glws.hpp
index 05903a7..9557c0c 100644
--- a/retrace/glws.hpp
+++ b/retrace/glws.hpp
@@ -32,6 +32,8 @@
 
 
 #include <vector>
+#include <set>
+#include <string>
 
 
 namespace glws {
@@ -130,12 +132,18 @@ public:
     const Visual *visual;
     Profile profile;
     
+    std::set<std::string> extensions;
+
     Context(const Visual *vis, Profile prof) :
         visual(vis),
         profile(prof)
     {}
 
     virtual ~Context() {}
+
+    // Context must be current
+    bool
+    hasExtension(const char *extension);
 };
 
 

commit 8efcb8556a3cfc884b4af5ab36407395d2cfdbab
Author: José Fonseca <jose.r.fonseca@gmail.com>
Date:   Thu Oct 18 15:13:19 2012 +0100

    Swizzle fence names.

diff --git a/specs/glapi.py b/specs/glapi.py
index ddc0fcf..e82287d 100644
--- a/specs/glapi.py
+++ b/specs/glapi.py
@@ -1881,13 +1881,13 @@ glapi.addFunctions([
     GlFunction(Void, "glIglooInterfaceSGIX", [(GLenum, "pname"), (OpaqueBlob(Const(GLvoid), "_glIglooInterfaceSGIX_size(pname)"), "params")]),
 
     # GL_NV_fence
-    GlFunction(Void, "glDeleteFencesNV", [(GLsizei, "n"), (Array(Const(GLuint), "n"), "fences")]),
-    GlFunction(Void, "glGenFencesNV", [(GLsizei, "n"), Out(Array(GLuint, "n"), "fences")]),
-    GlFunction(GLboolean, "glIsFenceNV", [(GLuint, "fence")], sideeffects=False),
-    GlFunction(GLboolean, "glTestFenceNV", [(GLuint, "fence")]),
-    GlFunction(Void, "glGetFenceivNV", [(GLuint, "fence"), (GLenum, "pname"), Out(Array(GLint, "_gl_param_size(pname)"), "params")], sideeffects=False),
-    GlFunction(Void, "glFinishFenceNV", [(GLuint, "fence")]),
-    GlFunction(Void, "glSetFenceNV", [(GLuint, "fence"), (GLenum, "condition")]),
+    GlFunction(Void, "glDeleteFencesNV", [(GLsizei, "n"), (Array(Const(GLfence), "n"), "fences")]),
+    GlFunction(Void, "glGenFencesNV", [(GLsizei, "n"), Out(Array(GLfence, "n"), "fences")]),
+    GlFunction(GLboolean, "glIsFenceNV", [(GLfence, "fence")], sideeffects=False),
+    GlFunction(GLboolean, "glTestFenceNV", [(GLfence, "fence")]),
+    GlFunction(Void, "glGetFenceivNV", [(GLfence, "fence"), (GLenum, "pname"), Out(Array(GLint, "_gl_param_size(pname)"), "params")], sideeffects=False),
+    GlFunction(Void, "glFinishFenceNV", [(GLfence, "fence")]),
+    GlFunction(Void, "glSetFenceNV", [(GLfence, "fence"), (GLenum, "condition")]),
 
     # GL_NV_evaluators
     GlFunction(Void, "glMapControlPointsNV", [(GLenum, "target"), (GLuint, "index"), (GLenum, "type"), (GLsizei, "ustride"), (GLsizei, "vstride"), (GLint, "uorder"), (GLint, "vorder"), (GLboolean, "packed"), (OpaqueBlob(Const(GLvoid), "_glMapControlPointsNV_size(target, uorder, vorder)"), "points")]),
@@ -2133,14 +2133,14 @@ glapi.addFunctions([
     GlFunction(Void, "glMultiDrawRangeElementArrayAPPLE", [(GLenum_mode, "mode"), (GLuint, "start"), (GLuint, "end"), (Array(Const(GLint), "primcount"), "first"), (Array(Const(GLsizei), "primcount"), "count"), (GLsizei, "primcount")]),
 
     # GL_APPLE_fence
-    GlFunction(Void, "glGenFencesAPPLE", [(GLsizei, "n"), Out(Array(GLuint, "n"), "fences")]),
-    GlFunction(Void, "glDeleteFencesAPPLE", [(GLsizei, "n"), (Array(Const(GLuint), "n"), "fences")]),
-    GlFunction(Void, "glSetFenceAPPLE", [(GLuint, "fence")]),
-    GlFunction(GLboolean, "glIsFenceAPPLE", [(GLuint, "fence")], sideeffects=False),
-    GlFunction(GLboolean, "glTestFenceAPPLE", [(GLuint, "fence")]),
-    GlFunction(Void, "glFinishFenceAPPLE", [(GLuint, "fence")]),
-    GlFunction(GLboolean, "glTestObjectAPPLE", [(GLenum, "object"), (GLuint, "name")]),
-    GlFunction(Void, "glFinishObjectAPPLE", [(GLenum, "object"), (GLint, "name")]),
+    GlFunction(Void, "glGenFencesAPPLE", [(GLsizei, "n"), Out(Array(GLfence, "n"), "fences")]),
+    GlFunction(Void, "glDeleteFencesAPPLE", [(GLsizei, "n"), (Array(Const(GLfence), "n"), "fences")]),
+    GlFunction(Void, "glSetFenceAPPLE", [(GLfence, "fence")]),
+    GlFunction(GLboolean, "glIsFenceAPPLE", [(GLfence, "fence")], sideeffects=False),
+    GlFunction(GLboolean, "glTestFenceAPPLE", [(GLfence, "fence")]),
+    GlFunction(Void, "glFinishFenceAPPLE", [(GLfence, "fence")]),
+    GlFunction(GLboolean, "glTestObjectAPPLE", [(GLenum, "object"), (GLuint, "name")]), # XXX: name needs swizzling
+    GlFunction(Void, "glFinishObjectAPPLE", [(GLenum, "object"), (GLint, "name")]), # XXX: name needs swizzling
 
     # GL_APPLE_vertex_array_object
     GlFunction(Void, "glBindVertexArrayAPPLE", [(GLarray, "array")]),
diff --git a/specs/gltypes.py b/specs/gltypes.py
index 45231b2..2f565cd 100644
--- a/specs/gltypes.py
+++ b/specs/gltypes.py
@@ -109,6 +109,7 @@ GLregion = Handle("region", GLuint)
 GLpipeline = Handle("pipeline", GLuint)
 GLsampler = Handle("sampler", GLuint)
 GLfeedback = Handle("feedback", GLuint)
+GLfence = Handle("fence", GLuint)
 
 # GL mappings are pointers to linear memory regions.
 #

commit 4b9e58e55f107d269fb973a1daac04e0d0467f24
Author: José Fonseca <jose.r.fonseca@gmail.com>
Date:   Thu Oct 18 13:25:45 2012 +0100

    Improvement LD_LIBRARY_PATH explanation.

diff --git a/README.markdown b/README.markdown
index ea886aa..7d85837 100644
--- a/README.markdown
+++ b/README.markdown
@@ -118,14 +118,14 @@ and it will generate a trace named `application.trace` in the current
 directory.  You can specify the written trace filename by setting the
 `TRACE_FILE` environment variable before running.
 
-The `LD_PRELOAD` mechanism should work with most applications.  There are some
-applications, e.g., Unigine Heaven, which global function pointers with the
-same name as GL entrypoints, living in a shared object that wasn't linked with
-`-Bsymbolic` flag, so relocations to those globals function pointers get
-overwritten with the address to our wrapper library, and the application will
-segfault when trying to write to them.  For these applications it is possible
-to trace by using `glxtrace.so` as an ordinary `libGL.so` and injecting into
-`LD_LIBRARY_PATH`:
+The `LD_PRELOAD` mechanism should work with the majority applications.  There
+are some applications (e.g., Unigine Heaven, Android GPU emulator, etc.), that
+have global function pointers with the same name as GL entrypoints, living in a
+shared object that wasn't linked with `-Bsymbolic` flag, so relocations to
+those globals function pointers get overwritten with the address to our wrapper
+library, and the application will segfault when trying to write to them.  For
+these applications it is possible to trace by using `glxtrace.so` as an
+ordinary `libGL.so` and injecting it via `LD_LIBRARY_PATH`:
 
     ln -s glxtrace.so wrappers/libGL.so
     ln -s glxtrace.so wrappers/libGL.so.1
@@ -134,6 +134,9 @@ to trace by using `glxtrace.so` as an ordinary `libGL.so` and injecting into
     export TRACE_LIBGL=/path/to/real/libGL.so.1
     /path/to/application
 
+If you are an application developer, you can avoid this either by linking with
+`-Bsymbolic` flag, or by using some unique prefix for your function pointers.
+
 See the `ld.so` man page for more information about `LD_PRELOAD` and
 `LD_LIBRARY_PATH` environment flags.
 

commit 6c9eef5704cf6ca132cadc49231708158ed3564c
Author: José Fonseca <jose.r.fonseca@gmail.com>
Date:   Wed Oct 17 16:23:29 2012 +0100

    Fix CGL call ordering in flag table.
    
    oops...

diff --git a/common/trace_parser_flags.cpp b/common/trace_parser_flags.cpp
index 71d918a..d9c12cb 100644
--- a/common/trace_parser_flags.cpp
+++ b/common/trace_parser_flags.cpp
@@ -55,8 +55,8 @@ defaultCallFlags = 0;
  */
 const Entry<CallFlags>
 callFlagTable[] = {
-    { "CGLGetCurrentContext",                          CALL_FLAG_NO_SIDE_EFFECTS | CALL_FLAG_VERBOSE },
     { "CGLFlushDrawable",                              CALL_FLAG_END_FRAME },
+    { "CGLGetCurrentContext",                          CALL_FLAG_NO_SIDE_EFFECTS | CALL_FLAG_VERBOSE },
     { "IDirect3D9::CheckDeviceFormat",                 CALL_FLAG_NO_SIDE_EFFECTS | CALL_FLAG_VERBOSE },
     { "IDirect3D9::EnumAdapterModes",                  CALL_FLAG_NO_SIDE_EFFECTS | CALL_FLAG_VERBOSE },
     { "IDirect3D9::GetAdapterModeCount",               CALL_FLAG_NO_SIDE_EFFECTS | CALL_FLAG_VERBOSE },

commit 12d1fc11ddfd1ab92f7db6909d73ecd6a3e86ada
Author: José Fonseca <jose.r.fonseca@gmail.com>
Date:   Wed Oct 17 12:19:36 2012 +0100

    Better instructions for 32-bits cross build (issue #98)

diff --git a/INSTALL.markdown b/INSTALL.markdown
index e310df1..2228bdf 100644
--- a/INSTALL.markdown
+++ b/INSTALL.markdown
@@ -40,8 +40,9 @@ Build as:
     cmake -H. -Bbuild
     make -C build
 
-You can also build the 32bit GL wrapper on 64bit distro with a multilib gcc by
-doing:
+
+You can also build the 32-bits GL wrapper on a 64-bits distribution, provided
+you have a multilib gcc and 32-bits X11 libraries, by doing:
 
     cmake \
         -DCMAKE_C_FLAGS=-m32 \
@@ -52,6 +53,10 @@ doing:
         -H. -Bbuild32
     make -C build32 glxtrace
 
+The `/usr/lib32` refers to the path where the 32-bits shared objects are may
+differ depending on the actual Linux distribution.
+
+
 Android
 -------
 

commit 8ced2ed6d5590c59d8a04e2c3997dd2eb3375dd8
Author: José Fonseca <jose.r.fonseca@gmail.com>
Date:   Tue Oct 16 17:35:18 2012 +0100

    Disabled code to use Apple software renderer.

diff --git a/retrace/glws_cocoa.mm b/retrace/glws_cocoa.mm
index 2ac3091..245ea4f 100644
--- a/retrace/glws_cocoa.mm
+++ b/retrace/glws_cocoa.mm
@@ -193,6 +193,12 @@ createVisual(bool doubleBuffer, Profile profile) {
 	return NULL;
 #endif
     }
+    
+    // Use Apple software rendering for debugging purposes.
+    if (0) {
+        attribs.add(NSOpenGLPFARendererID, 0x00020200); // kCGLRendererGenericID
+    }
+
     attribs.end();
 
     NSOpenGLPixelFormat *pixelFormat = [[NSOpenGLPixelFormat alloc]

commit 36ac3f29fa7080469e80e13d21acb15648d108d7
Author: José Fonseca <jose.r.fonseca@gmail.com>
Date:   Tue Oct 16 16:32:20 2012 +0100

    Hide CGLGetCurrentContext calls

diff --git a/common/trace_parser_flags.cpp b/common/trace_parser_flags.cpp
index fe24514..71d918a 100644
--- a/common/trace_parser_flags.cpp
+++ b/common/trace_parser_flags.cpp
@@ -55,6 +55,7 @@ defaultCallFlags = 0;
  */
 const Entry<CallFlags>
 callFlagTable[] = {
+    { "CGLGetCurrentContext",                          CALL_FLAG_NO_SIDE_EFFECTS | CALL_FLAG_VERBOSE },
     { "CGLFlushDrawable",                              CALL_FLAG_END_FRAME },
     { "IDirect3D9::CheckDeviceFormat",                 CALL_FLAG_NO_SIDE_EFFECTS | CALL_FLAG_VERBOSE },
     { "IDirect3D9::EnumAdapterModes",                  CALL_FLAG_NO_SIDE_EFFECTS | CALL_FLAG_VERBOSE },

commit fe2b9f4225a491d9f10d549bf87e37e760f6391a
Author: José Fonseca <jose.r.fonseca@gmail.com>
Date:   Tue Oct 16 16:24:35 2012 +0100

    Fix GraphView member initialization order to silence gcc warning.

diff --git a/gui/graphing/graphview.cpp b/gui/graphing/graphview.cpp
index 6ecac57..9b42c4b 100644
--- a/gui/graphing/graphview.cpp
+++ b/gui/graphing/graphview.cpp
@@ -5,7 +5,6 @@
 
 GraphView::GraphView(QWidget* parent) :
     QWidget(parent),
-    m_selectionState(NULL),
     m_viewLeft(0),
     m_viewRight(0),
     m_viewBottom(0),
@@ -19,7 +18,8 @@ GraphView::GraphView(QWidget* parent) :
     m_viewWidthMax(0),
     m_viewHeight(0),
     m_viewHeightMin(0),
-    m_viewHeightMax(0)
+    m_viewHeightMax(0),
+    m_selectionState(NULL)
 {
     memset(&m_previous, -1, sizeof(m_previous));
 }

commit e12479caa434b1a33a15542d545d88190b7259d0
Author: José Fonseca <jose.r.fonseca@gmail.com>
Date:   Tue Oct 16 16:12:27 2012 +0100

    Swizzle array objects of GL_APPLE_vertex_array_object

diff --git a/specs/glapi.py b/specs/glapi.py
index fa7e91e..ddc0fcf 100644
--- a/specs/glapi.py
+++ b/specs/glapi.py
@@ -2143,10 +2143,10 @@ glapi.addFunctions([
     GlFunction(Void, "glFinishObjectAPPLE", [(GLenum, "object"), (GLint, "name")]),
 
     # GL_APPLE_vertex_array_object
-    GlFunction(Void, "glBindVertexArrayAPPLE", [(GLuint, "array")]),
-    GlFunction(Void, "glDeleteVertexArraysAPPLE", [(GLsizei, "n"), (Array(Const(GLuint), "n"), "arrays")]),
-    GlFunction(Void, "glGenVertexArraysAPPLE", [(GLsizei, "n"), Out(Array(GLuint, "n"), "arrays")]),
-    GlFunction(GLboolean, "glIsVertexArrayAPPLE", [(GLuint, "array")], sideeffects=False),
+    GlFunction(Void, "glBindVertexArrayAPPLE", [(GLarray, "array")]),
+    GlFunction(Void, "glDeleteVertexArraysAPPLE", [(GLsizei, "n"), (Array(Const(GLarray), "n"), "arrays")]),
+    GlFunction(Void, "glGenVertexArraysAPPLE", [(GLsizei, "n"), Out(Array(GLarray, "n"), "arrays")]),
+    GlFunction(GLboolean, "glIsVertexArrayAPPLE", [(GLarray, "array")], sideeffects=False),
 
     # GL_APPLE_vertex_array_range
     GlFunction(Void, "glVertexArrayRangeAPPLE", [(GLsizei, "length"), (GLpointer, "pointer")]),

commit 46650a4a18f142d0e91455e01d06419350e9ca2e
Author: José Fonseca <jose.r.fonseca@gmail.com>
Date:   Tue Oct 16 12:30:57 2012 +0100

    Ignore CGLChoose/DestroyPixelFormat calls.

diff --git a/retrace/glretrace_cgl.cpp b/retrace/glretrace_cgl.cpp
index b702ae1..8ae0e3e 100644
--- a/retrace/glretrace_cgl.cpp
+++ b/retrace/glretrace_cgl.cpp
@@ -185,6 +185,8 @@ static void retrace_CGLTexImageIOSurface2D(trace::Call &call) {
 
 
 const retrace::Entry glretrace::cgl_callbacks[] = {
+    {"CGLChoosePixelFormat", &retrace::ignore},
+    {"CGLDestroyPixelFormat", &retrace::ignore},
     {"CGLCreateContext", &retrace_CGLCreateContext},
     {"CGLDestroyContext", &retrace_CGLDestroyContext},
     {"CGLSetCurrentContext", &retrace_CGLSetCurrentContext},

commit b724acdd3362ec9bd19f502dd48449c96012b56a
Author: José Fonseca <jose.r.fonseca@gmail.com>
Date:   Tue Oct 16 12:30:36 2012 +0100

    Minimal implementation of CGLTexImageIOSurface2D.

diff --git a/retrace/glretrace_cgl.cpp b/retrace/glretrace_cgl.cpp
index 0419d95..b702ae1 100644
--- a/retrace/glretrace_cgl.cpp
+++ b/retrace/glretrace_cgl.cpp
@@ -130,6 +130,60 @@ static void retrace_CGLFlushDrawable(trace::Call &call) {
 }
 
 
+/**
+ * We can't fully reimplement CGLTexImageIOSurface2D, as external IOSurface are
+ * no longer present.  Simply emit a glTexImage2D to ensure the texture storage
+ * is present.
+ *
+ * See also:
+ * - /System/Library/Frameworks/OpenGL.framework/Headers/CGLIOSurface.h
+ */
+static void retrace_CGLTexImageIOSurface2D(trace::Call &call) {
+    if (retrace::debug) {
+        retrace::warning(call) << "external IOSurface not supported\n";
+    }
+
+    unsigned long long ctx = call.arg(0).toUIntPtr();
+    Context *context = getContext(ctx);
+
+    GLenum target;
+    target = static_cast<GLenum>((call.arg(1)).toSInt());
+
+    GLint level = 0;
+
+    GLint internalformat;
+    internalformat = static_cast<GLenum>((call.arg(2)).toSInt());
+
+    GLsizei width;
+    width = (call.arg(3)).toSInt();
+
+    GLsizei height;
+    height = (call.arg(4)).toSInt();
+
+    GLint border = 0;
+
+    GLenum format;
+    format = static_cast<GLenum>((call.arg(5)).toSInt());
+
+    GLenum type;
+    type = static_cast<GLenum>((call.arg(6)).toSInt());
+
+    GLvoid * pixels = NULL;
+
+    if (glretrace::currentContext != context) {
+        if (retrace::debug) {
+            retrace::warning(call) << "current context mismatch\n";
+        }
+    }
+
+    glTexImage2D(target, level, internalformat, width, height, border, format, type, pixels);
+
+    if (retrace::debug && !glretrace::insideGlBeginEnd) {
+        glretrace::checkGlError(call);
+    }
+}
+
+
 const retrace::Entry glretrace::cgl_callbacks[] = {
     {"CGLCreateContext", &retrace_CGLCreateContext},
     {"CGLDestroyContext", &retrace_CGLDestroyContext},
@@ -140,6 +194,7 @@ const retrace::Entry glretrace::cgl_callbacks[] = {
     {"CGLSetParameter", &retrace::ignore},
     {"CGLGetParameter", &retrace::ignore},
     {"CGLFlushDrawable", &retrace_CGLFlushDrawable},
+    {"CGLTexImageIOSurface2D", &retrace_CGLTexImageIOSurface2D},
     {NULL, NULL},
 };
 

commit e514295ccf3017cfcbc6dd5a281107664ea3ccd2
Author: José Fonseca <jose.r.fonseca@gmail.com>
Date:   Wed Oct 3 15:55:51 2012 +0100

    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<const trace::Array *>(&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},

commit 17483ad1989ce725fe7d943b3fcb79b9802f7f70
Author: José Fonseca <jose.r.fonseca@gmail.com>
Date:   Tue Oct 16 10:17:13 2012 +0100

    Don't link glxtrace against Xlib. It is unnecessary.

diff --git a/wrappers/CMakeLists.txt b/wrappers/CMakeLists.txt
index a2bcfff..551c5d8 100644
--- a/wrappers/CMakeLists.txt
+++ b/wrappers/CMakeLists.txt
@@ -346,7 +346,6 @@ elseif (X11_FOUND)
         common
         ${ZLIB_LIBRARIES}
         ${SNAPPY_LIBRARIES}
-        ${X11_X11_LIB}
         ${CMAKE_THREAD_LIBS_INIT}
         dl
     )

commit a23e4495a463bb4e6ee2988a228f9f9fe14c5f92
Author: José Fonseca <jose.r.fonseca@gmail.com>
Date:   Sat Oct 13 09:48:37 2012 +0100

    Mention AMD CodeXL.

diff --git a/README.markdown b/README.markdown
index b59ee3b..ea886aa 100644
--- a/README.markdown
+++ b/README.markdown
@@ -503,9 +503,11 @@ Open-source:
 
 Closed-source:
 
+* [AMD CodeXL](http://developer.amd.com/tools/hc/CodeXL/Pages/default.aspx)
+
+* [AMD GPU PerfStudio](http://developer.amd.com/gpu/PerfStudio/pages/APITraceWindow.aspx)
+
 * [gDEBugger](http://www.gremedy.com/products.php) and [AMD gDEBugger](http://developer.amd.com/tools/gDEBugger/Pages/default.aspx)
 
 * [glslDevil](http://cumbia.informatik.uni-stuttgart.de/glsldevil/index.html)
 
-* [AMD GPU PerfStudio](http://developer.amd.com/gpu/PerfStudio/pages/APITraceWindow.aspx)
-

commit e3cd78b53b9a39913d847c4ef1779f14a391177f
Author: José Fonseca <jose.r.fonseca@gmail.com>
Date:   Sat Oct 13 09:27:07 2012 +0100

    retrace: Sleep when polling for input.
    
    As Carl Worth identified, if the user passed the "-w" option to beable
    to see the last frame of the retrace, the glretrace would enter a
    busy-waiting loop, consuming as much CPU as possible.

diff --git a/common/os_time.hpp b/common/os_time.hpp
index 75175d8..13cc733 100644
--- a/common/os_time.hpp
+++ b/common/os_time.hpp
@@ -32,13 +32,16 @@
 
 
 #if defined(_WIN32)
-#include <windows.h>
-#elif defined(__linux__)
-#include <time.h>
-#elif defined(__APPLE__)
-#include <mach/mach_time.h>
+#  include <windows.h>
 #else
-#include <sys/time.h>
+#  if defined(__linux__)
+#    include <time.h>
+#  elif defined(__APPLE__)
+#    include <mach/mach_time.h>
+#  else
+#    include <sys/time.h>
+#  endif
+#  include <unistd.h>
 #endif
 
 
@@ -88,6 +91,15 @@ namespace os {
 #endif
     }
 
+    // Suspend execution
+    inline void
+    sleep(unsigned long usecs) {
+#if defined(_WIN32)
+        Sleep((usecs + 999) / 1000);
+#else
+        usleep(usecs);
+#endif
+    }
 
 } /* namespace os */
 
diff --git a/retrace/d3dretrace_main.cpp b/retrace/d3dretrace_main.cpp
index 40d53ea..9878fe3 100644
--- a/retrace/d3dretrace_main.cpp
+++ b/retrace/d3dretrace_main.cpp
@@ -87,6 +87,7 @@ retrace::flushRendering(void) {
 
 void
 retrace::waitForInput(void) {
+    /* TODO */
 }
 
 void
diff --git a/retrace/glretrace_main.cpp b/retrace/glretrace_main.cpp
index d857d03..1086be9 100755
--- a/retrace/glretrace_main.cpp
+++ b/retrace/glretrace_main.cpp
@@ -435,6 +435,7 @@ retrace::flushRendering(void) {
 void
 retrace::waitForInput(void) {
     while (glws::processEvents()) {
+        os::sleep(100*1000);
     }
 }
 

commit e9392864d660f2d4e2c325e9b01ff7121786d92c
Author: José Fonseca <jose.r.fonseca@gmail.com>
Date:   Sat Oct 13 09:33:04 2012 +0100

    retrace: Exit when Escape key is pressed on X.
    
    Match Windows behavior.

diff --git a/retrace/glws_glx.cpp b/retrace/glws_glx.cpp
index 1573bb9..575776e 100644
--- a/retrace/glws_glx.cpp
+++ b/retrace/glws_glx.cpp
@@ -60,7 +60,8 @@ public:
 };
 
 
-static void describeEvent(const XEvent &event) {
+static void
+processEvent(XEvent &event) {
     if (0) {
         switch (event.type) {
         case ConfigureNotify:
@@ -83,6 +84,19 @@ static void describeEvent(const XEvent &event) {
         }
         std::cerr << " " << event.xany.window << "\n";
     }
+
+    switch (event.type) {
+    case KeyPress:
+        {
+            char buffer[32];
+            KeySym keysym;
+            XLookupString(&event.xkey, buffer, sizeof buffer - 1, &keysym, NULL);
+            if (keysym == XK_Escape) {
+                exit(0);
+            }
+        }
+        break;
+    }
 }
 
 class GlxDrawable : public Drawable
@@ -102,7 +116,7 @@ public:
         attr.background_pixel = 0;
         attr.border_pixel = 0;
         attr.colormap = XCreateColormap(display, root, visinfo->visual, AllocNone);
-        attr.event_mask = StructureNotifyMask;
+        attr.event_mask = StructureNotifyMask | KeyPressMask;
 
         unsigned long mask;
         mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
@@ -135,11 +149,18 @@ public:
         glXWaitX();
     }
 
+    void processKeys(void) {
+        XEvent event;
+        while (XCheckWindowEvent(display, window, StructureNotifyMask | KeyPressMask, &event)) {
+            processEvent(event);
+        }
+    }
+
     void waitForEvent(int type) {
         XEvent event;
         do {
-            XWindowEvent(display, window, StructureNotifyMask, &event);
-            describeEvent(event);
+            XWindowEvent(display, window, StructureNotifyMask | KeyPressMask, &event);
+            processEvent(event);
         } while (event.type != type);
     }
 
@@ -194,6 +215,8 @@ public:
 
     void swapBuffers(void) {
         glXSwapBuffers(display, window);
+
+        processKeys();
     }
 };
 
@@ -368,7 +391,7 @@ processEvents(void) {
     while (XPending(display) > 0) {
         XEvent event;
         XNextEvent(display, &event);
-        describeEvent(event);
+        processEvent(event);
     }
     return true;
 }

commit 0358fa2723c363b2146e8dc9c39b6b8254d88018
Author: José Fonseca <jose.r.fonseca@gmail.com>
Date:   Sat Oct 13 09:26:17 2012 +0100

    retrace: ignore glXGetSwapIntervalMESA.

diff --git a/retrace/glretrace_glx.cpp b/retrace/glretrace_glx.cpp
index 4e42096..6ff17d8 100644
--- a/retrace/glretrace_glx.cpp
+++ b/retrace/glretrace_glx.cpp
@@ -230,6 +230,7 @@ const retrace::Entry glretrace::glx_callbacks[] = {
     {"glXGetProcAddress", &retrace::ignore},


Reply to: