COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/wgltrace.py > ${CMAKE_CURRENT_BINARY_DIR}/wgltrace.cpp
DEPENDS wgltrace.py gltrace.py trace.py wglapi.py wglenum.py glapi.py glparams.py gltypes.py winapi.py stdapi.py
)
- add_library (wgltrace MODULE opengl32.def wgltrace.cpp trace_writer.cpp os_win32.cpp ${CMAKE_CURRENT_BINARY_DIR}/glproc.hpp)
+ add_library (wgltrace MODULE opengl32.def
+ wgltrace.cpp
+ glcaps.cpp
+ trace_writer.cpp
+ os_win32.cpp
+ ${CMAKE_CURRENT_BINARY_DIR}/glproc.hpp
+ )
set_target_properties (wgltrace PROPERTIES
PREFIX ""
OUTPUT_NAME opengl32
DEPENDS cgltrace.py gltrace.py trace.py cglapi.py glapi.py glparams.py gltypes.py stdapi.py
)
- add_library (cgltrace SHARED cgltrace.cpp trace_writer.cpp os_posix.cpp ${CMAKE_CURRENT_BINARY_DIR}/glproc.hpp)
+ add_library (cgltrace SHARED
+ cgltrace.cpp
+ glcaps.cpp
+ trace_writer.cpp
+ os_posix.cpp
+ ${CMAKE_CURRENT_BINARY_DIR}/glproc.hpp
+ )
set_target_properties (cgltrace PROPERTIES
# OpenGL framework name
add_library (glxtrace SHARED
${CMAKE_CURRENT_BINARY_DIR}/glproc.hpp
glxtrace.cpp
+ glcaps.cpp
glsnapshot.cpp
trace_writer.cpp
image.cpp
--- /dev/null
+/**************************************************************************
+ *
+ * Copyright 2011 Jose Fonseca
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ **************************************************************************/
+
+
+#include <string.h>
+#include <stdlib.h>
+
+#include <string>
+#include <map>
+
+#include "gltrace.hpp"
+
+
+namespace gltrace {
+
+
+typedef std::map<std::string, const char *> ExtensionsMap;
+
+// Cache of the translated extensions strings
+static ExtensionsMap extensionsMap;
+
+
+// Additional extensions to be advertised
+const char extra_extensions[] =
+ "GL_GREMEDY_string_marker "
+ "GL_GREMEDY_frame_terminator "
+;
+
+
+/**
+ * Translate the GL extensions string, adding new extensions.
+ */
+const char *
+translateExtensionsString(const char *extensions)
+{
+ ExtensionsMap::const_iterator it = extensionsMap.find(extensions);
+ if (it != extensionsMap.end()) {
+ return it->second;
+ }
+
+ size_t extensions_len = strlen(extensions);
+
+ char *new_extensions = (char *)malloc(extensions_len + 1 + sizeof extra_extensions);
+ if (!new_extensions) {
+ return extensions;
+ }
+
+ if (extensions_len) {
+ memcpy(new_extensions, extensions, extensions_len);
+
+ // Add space separator if necessary
+ if (new_extensions[extensions_len - 1] != ' ') {
+ new_extensions[extensions_len++] = ' ';
+ }
+ }
+
+ memcpy(new_extensions + extensions_len, extra_extensions, sizeof extra_extensions);
+
+ extensionsMap[extensions] = new_extensions;
+
+ return new_extensions;
+}
+
+
+} /* namespace gltrace */
+
--- /dev/null
+/**************************************************************************
+ *
+ * Copyright 2011 Jose Fonseca
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ **************************************************************************/
+
+#ifndef _GLTRACE_HPP_
+#define _GLTRACE_HPP_
+
+
+#include "glimports.hpp"
+
+
+namespace gltrace {
+
+
+const char *
+translateExtensionsString(const char *extensions);
+
+
+inline const GLubyte *
+translateExtensionsString(const GLubyte *extensions) {
+ return (const GLubyte *)translateExtensionsString((const char *)extensions);
+}
+
+
+} /* namespace gltrace */
+
+
+#endif /* _GLRETRACE_HPP_ */
def header(self, api):
Tracer.header(self, api)
+ print '#include "gltrace.hpp"'
+ print
print '// Whether user arrays were used'
print 'static bool __user_arrays = false;'
print 'static bool __user_arrays_arb = false;'
# These functions have been dispatched already
return
+ # We implement the GREMEDY extensions, not the driver
+ if function.name in ('glStringMarkerGREMEDY', 'glFrameTerminatorGREMEDY'):
+ return
+
Tracer.dispatch_function(self, function)
def emit_memcpy(self, dest, src, length):
def wrap_ret(self, function, instance):
Tracer.wrap_ret(self, function, instance)
+
+ if function.name == 'glGetString':
+ print ' if (__result) {'
+ print ' switch (name) {'
+ print ' case GL_EXTENSIONS:'
+ print ' __result = gltrace::translateExtensionsString(__result);'
+ print ' break;'
+ print ' default:'
+ print ' break;'
+ print ' }'
+ print ' }'
if function.name in ('glMapBuffer', 'glMapBufferARB'):
print ' struct buffer_mapping *mapping = get_buffer_mapping(target);'