.dir-locals.el | 10 .emacs-dirvars | 14 .gitignore | 6 BUGS.markdown | 84 CMakeLists.txt | 377 DEVELOPMENT.markdown | 80 INSTALL.markdown | 13 NEWS.markdown | 8 README.markdown | 137 TODO.markdown | 80 cgltrace.py | 70 cli/CMakeLists.txt | 18 cli/cli.hpp | 52 cli/cli_diff.cpp | 109 cli/cli_diff_images.cpp | 90 cli/cli_diff_state.cpp | 102 cli/cli_dump.cpp | 206 cli/cli_main.cpp | 191 cli/cli_pager.cpp | 154 cli/cli_pager.hpp | 35 cli/cli_pickle.cpp | 219 cli/cli_repack.cpp | 116 cli/cli_trace.cpp | 121 cli/cli_trim.cpp | 130 common/formatter.hpp | 38 common/image.cpp | 24 common/image.hpp | 4 common/image_bmp.cpp | 4 common/image_png.cpp | 4 common/image_pnm.cpp | 4 common/json.hpp | 5 common/os.hpp | 32 common/os_binary.hpp | 60 common/os_posix.cpp | 188 common/os_process.hpp | 45 common/os_string.hpp | 343 common/os_thread.hpp | 163 common/os_time.hpp | 85 common/os_win32.cpp | 265 common/pickle.hpp | 310 common/trace_api.hpp | 46 common/trace_callset.cpp | 247 common/trace_callset.hpp | 167 common/trace_dump.cpp | 263 common/trace_dump.hpp | 73 common/trace_file.cpp | 130 common/trace_file.hpp | 36 common/trace_file_read.cpp | 59 common/trace_file_snappy.cpp | 423 + common/trace_file_write.cpp | 50 common/trace_file_zlib.cpp | 167 common/trace_format.hpp | 60 common/trace_loader.cpp | 30 common/trace_loader.hpp | 14 common/trace_local_writer.cpp | 158 common/trace_lookup.hpp | 111 common/trace_model.cpp | 202 common/trace_model.hpp | 156 common/trace_model_writer.cpp | 127 common/trace_parser.cpp | 251 common/trace_parser.hpp | 23 common/trace_parser_flags.cpp | 165 common/trace_resource.cpp | 114 common/trace_resource.hpp | 50 common/trace_snappyfile.cpp | 338 common/trace_snappyfile.hpp | 106 common/trace_tools.hpp | 48 common/trace_tools_trace.cpp | 142 common/trace_writer.cpp | 67 common/trace_writer.hpp | 43 common/trace_writer_local.cpp | 196 common/trace_writer_local.hpp | 87 common/trace_writer_model.cpp | 131 compat.h | 26 d3d10trace.py | 6 d3d8trace.py | 12 d3d9imports.hpp | 4 d3d9trace.py | 53 d3dshader.cpp | 2 d3dshader.hpp | 2 ddrawtrace.py | 14 dispatch.py | 29 dlltrace.py | 69 eglimports.hpp | 126 egltrace.py | 190 glcaps.cpp | 16 glimports.hpp | 47 glproc.py | 852 +- glproc_egl.cpp | 101 glproc_gl.cpp | 230 glretrace.hpp | 30 glretrace.py | 139 glretrace_cgl.cpp | 37 glretrace_egl.cpp | 274 glretrace_glx.cpp | 45 glretrace_main.cpp | 212 glretrace_wgl.cpp | 1168 --- glsize.hpp | 179 glsnapshot.cpp | 224 glsnapshot.hpp | 49 glstate.cpp | 149 glstate.hpp | 6 glstate.py | 121 gltrace.py | 283 glws.cpp | 62 glws.hpp | 87 glws_cocoa.mm | 270 glws_egl_xlib.cpp | 441 + glws_glx.cpp | 299 glws_wgl.cpp | 145 glxtrace.py | 94 gui/CMakeLists.txt | 2 gui/apisurface.cpp | 22 gui/apisurface.h | 8 gui/apitrace.cpp | 28 gui/apitrace.h | 2 gui/apitracecall.cpp | 147 gui/apitracecall.h | 60 gui/argumentseditor.cpp | 115 gui/argumentseditor.h | 115 gui/main.cpp | 38 gui/mainwindow.cpp | 24 gui/mainwindow.h | 6 gui/resources/glreference-man.sh | 8 gui/resources/glreference-registry.sh | 30 gui/resources/glreference.tsv | 1269 +++ gui/retracer.cpp | 57 gui/retracer.h | 9 gui/saverthread.cpp | 93 gui/settingsdialog.cpp | 11 gui/settingsdialog.h | 3 gui/traceloader.cpp | 28 gui/traceloader.h | 12 gui/traceprocess.cpp | 68 gui/ui/settings.ui | 23 retrace.cpp | 97 retrace.hpp | 61 retrace.py | 207 retrace_stdc.cpp | 238 scripts/highlight.py | 8 scripts/jsondiff.py | 163 scripts/retracediff.py | 46 scripts/snapdiff.py | 42 scripts/tracediff.sh | 6 scripts/tracerepack.py | 75 scripts/unpickle.py | 88 specs/cglapi.py | 21 specs/d3d.py | 52 specs/d3d10.py | 200 specs/d3d10misc.py | 30 specs/d3d8.py | 26 specs/d3d8types.py | 8 specs/d3d9.py | 58 specs/d3d9types.py | 644 - specs/d3dtypes.py | 4 specs/ddraw.py | 8 specs/dxgi.py | 74 specs/dxgiformat.py | 25 specs/dxgitype.py | 4 specs/eglapi.py | 397 + specs/glapi.py | 1216 +-- specs/glesapi.py | 250 specs/glparams.py | 35 specs/gltypes.py | 45 specs/glxapi.py | 77 specs/scripts/README | 12 specs/scripts/README.markdown | 54 specs/scripts/cdecl.py | 43 specs/scripts/glspec.py | 10 specs/scripts/gltxt.py | 93 specs/scripts/reference-opengl-arb.sh | 30 specs/scripts/reference-opengl-man.sh | 8 specs/stdapi.py | 349 specs/wglapi.py | 12 specs/winapi.py | 34 thirdparty/getopt/CMakeLists.txt | 5 thirdparty/getopt/getopt.h | 82 thirdparty/getopt/getopt_long.c | 511 + thirdparty/glext/GL/Makefile | 11 thirdparty/glext/GL/glext.h |11490 ++++++++++++++++++++++++++++++ thirdparty/glext/GL/glext.sed | 19 thirdparty/glext/GL/glxext.h | 993 ++ thirdparty/glext/GL/wglext.h | 929 ++ thirdparty/glext/Makefile | 8 thirdparty/glext/glext.h |11488 ----------------------------- thirdparty/glext/glxext.h | 993 -- thirdparty/glext/wglext.h | 929 -- thirdparty/khr/EGL/egl.h | 329 thirdparty/khr/EGL/eglext.h | 335 thirdparty/khr/GLES/glext.h | 1073 ++ thirdparty/khr/GLES2/gl2ext.h | 1138 ++ thirdparty/snappy/.gitignore | 1 thirdparty/snappy/CMakeLists.txt | 29 thirdparty/snappy/ChangeLog | 168 thirdparty/snappy/NEWS | 12 thirdparty/snappy/config.h | 136 thirdparty/snappy/config.h.in | 108 thirdparty/snappy/format_description.txt | 8 thirdparty/snappy/snappy-stubs-internal.h | 42 thirdparty/snappy/snappy-stubs-public.h | 2 thirdparty/snappy/snappy.cc | 27 thirdparty/snappy/snappy_unittest.cc | 8 thirdparty/zlib/CMakeLists.txt | 20 thirdparty/zlib/ChangeLog | 355 thirdparty/zlib/README | 86 thirdparty/zlib/adler32.c | 38 thirdparty/zlib/compress.c | 5 thirdparty/zlib/crc32.c | 35 thirdparty/zlib/deflate.c | 268 thirdparty/zlib/deflate.h | 35 thirdparty/zlib/example.c | 4 thirdparty/zlib/gzclose.c | 25 thirdparty/zlib/gzguts.h | 132 thirdparty/zlib/gzio.c | 1026 -- thirdparty/zlib/gzlib.c | 537 + thirdparty/zlib/gzread.c | 659 + thirdparty/zlib/gzwrite.c | 531 + thirdparty/zlib/infback.c | 93 thirdparty/zlib/inffast.c | 80 thirdparty/zlib/inffast.h | 4 thirdparty/zlib/inflate.c | 282 thirdparty/zlib/inflate.h | 31 thirdparty/zlib/inftrees.c | 63 thirdparty/zlib/inftrees.h | 27 thirdparty/zlib/minigzip.c | 134 thirdparty/zlib/trees.c | 93 thirdparty/zlib/trees.h | 4 thirdparty/zlib/uncompr.c | 4 thirdparty/zlib/zconf.h | 190 thirdparty/zlib/zlib.h | 1162 +-- thirdparty/zlib/zutil.c | 32 thirdparty/zlib/zutil.h | 63 trace.py | 598 - tracedump.cpp | 90 wgltrace.py | 37 235 files changed, 36802 insertions(+), 22212 deletions(-)
New commits: commit d8ea58f1e7d2e0dd9cabd085eef6f8b227e88652 Author: José Fonseca <[email protected]> Date: Thu Feb 9 14:35:27 2012 +0000 Allow to specify output file on retracediff diff --git a/scripts/retracediff.py b/scripts/retracediff.py index 3495975..ee5730a 100755 --- a/scripts/retracediff.py +++ b/scripts/retracediff.py @@ -80,16 +80,16 @@ class Setup: p.wait() return state.get('parameters', {}) - def diff_state(self, ref_call_no, src_call_no): + def diff_state(self, ref_call_no, src_call_no, stream): '''Compare the state between two calls.''' ref_state = self.dump_state(ref_call_no) src_state = self.dump_state(src_call_no) - sys.stdout.flush() - differ = jsondiff.Differ(sys.stdout) + stream.flush() + differ = jsondiff.Differ(stream) differ.visit(ref_state, src_state) - sys.stdout.write('\n') + stream.write('\n') def read_pnm(stream): @@ -159,6 +159,10 @@ def main(): '-S', '--snapshot-frequency', metavar='CALLSET', type="string", dest="snapshot_frequency", default='draw', help="calls to compare [default: %default]") + optparser.add_option( + '-o', '--output', metavar='FILE', + type="string", dest="output", + help="output file [default: stdout]") (options, args) = optparser.parse_args(sys.argv[1:]) ref_env = parse_env(optparser, options.ref_env) @@ -169,7 +173,12 @@ def main(): ref_setup = Setup(args, ref_env) src_setup = Setup(args, src_env) - highligher = Highlighter(sys.stdout) + if options.output: + output = open(options.output, 'wt') + else: + output = sys.stdout + + highligher = Highlighter(output) highligher.write('call\tprecision\n') @@ -217,7 +226,7 @@ def main(): src_image.save(prefix + '.src.png') comparer.write_diff(prefix + '.diff.png') if last_bad < last_good: - src_setup.diff_state(last_good, call_no) + src_setup.diff_state(last_good, call_no, output) last_bad = call_no else: last_good = call_no commit 4d73f8586100da4bbf5dcfad94828ae0b227ec05 Author: José Fonseca <[email protected]> Date: Thu Feb 9 14:04:17 2012 +0000 Fix highlight.py on Windows. diff --git a/scripts/highlight.py b/scripts/highlight.py index 986bd1d..db6a37f 100644 --- a/scripts/highlight.py +++ b/scripts/highlight.py @@ -158,12 +158,12 @@ class WindowsConsoleHighlighter(PlainHighlighter): import ctypes self._handle = ctypes.windll.kernel32.GetStdHandle(nStdHandle) else: - self._handle = INVALID_HANDLE_VALUE + self._handle = self.INVALID_HANDLE_VALUE self._attribute = self.white def _setAttribute(self, attr): - if self._handle != INVALID_HANDLE_VALUE: + if self._handle != self.INVALID_HANDLE_VALUE: import ctypes ctypes.windll.kernel32.SetConsoleTextAttribute(self._handle, attr) self._attribute = attr @@ -172,11 +172,11 @@ class WindowsConsoleHighlighter(PlainHighlighter): self._setAttribute(self._normal) def color(self, color): - intensity = self._attribute & FOREGROUND_INTENSITY + intensity = self._attribute & self.FOREGROUND_INTENSITY self._setAttribute(color | intensity) def bold(self): - self._setAttribute(self._attribute | FOREGROUND_INTENSITY) + self._setAttribute(self._attribute | self.FOREGROUND_INTENSITY) def italic(self): pass commit fcab8cb3072724eca6ab8618ec16704451891f69 Author: José Fonseca <[email protected]> Date: Thu Feb 9 14:03:57 2012 +0000 Set binary mode when outputing PNM from glretrace via stdout. diff --git a/cli/cli_pickle.cpp b/cli/cli_pickle.cpp index 6af879f..c37c0f8 100644 --- a/cli/cli_pickle.cpp +++ b/cli/cli_pickle.cpp @@ -26,13 +26,10 @@ #include <string.h> -#ifdef _WIN32 -#include <fcntl.h> -#include <io.h> -#endif - #include "pickle.hpp" +#include "os_binary.hpp" + #include "cli.hpp" #include "cli_pager.hpp" @@ -189,14 +186,7 @@ command(int argc, char *argv[]) } } -#ifdef _WIN32 - // Set stdout in binary mode - fflush(stdout); - int mode = _setmode(_fileno(stdout), _O_BINARY); - if (mode == -1) { - std::cerr << "warning: failed to set stdout in binary mode\n"; - } -#endif + os::setBinaryMode(stdout); for (; i < argc; ++i) { trace::Parser parser; @@ -218,14 +208,6 @@ command(int argc, char *argv[]) } } -#ifdef _WIN32 - std::cout.flush(); - fflush(stdout); - if (mode != -1) { - _setmode(_fileno(stdout), mode); - } -#endif - return 0; } diff --git a/common/os_binary.hpp b/common/os_binary.hpp new file mode 100644 index 0000000..876bdb6 --- /dev/null +++ b/common/os_binary.hpp @@ -0,0 +1,60 @@ +/************************************************************************** + * + * Copyright 2011 VMware, Inc. + * 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. + * + **************************************************************************/ + +/* + * Force binary mode standard files on Windows. + */ + +#ifndef _OS_BINARY_HPP_ +#define _OS_BINARY_HPP_ + + +#include <stdio.h> + +#ifdef _WIN32 +#include <assert.h> + +#include <fcntl.h> +#include <io.h> +#endif + + +namespace os { + + +void setBinaryMode(FILE *fp) { +#ifdef _WIN32 + fflush(fp); + int mode = _setmode(_fileno(fp), _O_BINARY); + assert(mode != -1); +#else + (void)fp; +#endif +} + + +} /* namespace os */ + +#endif /* _OS_BINARY_HPP_ */ diff --git a/glretrace_main.cpp b/glretrace_main.cpp index 785d6fe..11f34ce 100644 --- a/glretrace_main.cpp +++ b/glretrace_main.cpp @@ -26,6 +26,7 @@ #include <string.h> +#include "os_binary.hpp" #include "os_string.hpp" #include "os_time.hpp" #include "image.hpp" @@ -342,6 +343,7 @@ int main(int argc, char **argv) snapshot_frequency = trace::CallSet(trace::FREQUENCY_FRAME); } if (snapshot_prefix[0] == '-' && snapshot_prefix[1] == 0) { + os::setBinaryMode(stdout); retrace::verbosity = -2; } } else if (!strcmp(arg, "-S")) { commit c086f0d24e6ca666a2567c092b2c368d7b683069 Author: José Fonseca <[email protected]> Date: Thu Feb 9 13:15:15 2012 +0000 Allow to specify an alternative opengl32.dll when retracing. diff --git a/glws_wgl.cpp b/glws_wgl.cpp index 59f4786..5fddb79 100644 --- a/glws_wgl.cpp +++ b/glws_wgl.cpp @@ -23,6 +23,8 @@ * **************************************************************************/ +#include <iostream> + #include "glproc.hpp" #include "glws.hpp" @@ -199,7 +201,18 @@ init(void) { /* * OpenGL library must be loaded by the time we call GDI. */ - __libGlHandle = LoadLibraryA("OPENGL32"); + + const char * libgl_filename = getenv("TRACE_LIBGL"); + + if (!libgl_filename) { + libgl_filename = "OPENGL32"; + } + + __libGlHandle = LoadLibraryA(libgl_filename); + if (!__libGlHandle) { + std::cerr << "error: unable to open " << libgl_filename << "\n"; + exit(1); + } } void commit c5c8cf36ddfac2d95dae8df15839abcd32b288d2 Author: José Fonseca <[email protected]> Date: Thu Feb 9 13:14:51 2012 +0000 Remove dead os::getTime() declaration. diff --git a/common/os.hpp b/common/os.hpp index caf9dc3..cc72a0e 100644 --- a/common/os.hpp +++ b/common/os.hpp @@ -70,11 +70,6 @@ void log(const char *format, ...) #endif #endif -/** - * Get the current time in microseconds from an unknown base. - */ -long long getTime(void); - void abort(void); void setExceptionCallback(void (*callback)(void)); commit 49ad1c1df0b6fe277c3bd1c5a4fccc7eefcdcf0d Author: José Fonseca <[email protected]> Date: Wed Feb 8 17:14:40 2012 +0000 Flag a few wgl calls as verbose. Convenient for tracediff diff --git a/common/trace_parser_flags.cpp b/common/trace_parser_flags.cpp index e5dad84..936a891 100644 --- a/common/trace_parser_flags.cpp +++ b/common/trace_parser_flags.cpp @@ -145,6 +145,8 @@ callFlagTable[] = { { "glXQueryExtensionsString", CALL_FLAG_NO_SIDE_EFFECTS | CALL_FLAG_VERBOSE }, { "glXQueryVersion", CALL_FLAG_NO_SIDE_EFFECTS | CALL_FLAG_VERBOSE }, { "glXSwapBuffers", CALL_FLAG_SWAPBUFFERS }, + { "wglGetCurrentContext", CALL_FLAG_NO_SIDE_EFFECTS | CALL_FLAG_VERBOSE }, + { "wglGetCurrentDC", CALL_FLAG_NO_SIDE_EFFECTS | CALL_FLAG_VERBOSE }, { "wglGetDefaultProcAddress", CALL_FLAG_NO_SIDE_EFFECTS | CALL_FLAG_VERBOSE }, { "wglGetProcAddress", CALL_FLAG_NO_SIDE_EFFECTS | CALL_FLAG_VERBOSE }, { "wglSwapBuffers", CALL_FLAG_SWAPBUFFERS }, commit 2b8c45495f537a7033339d2b8812dad3497edee3 Author: José Fonseca <[email protected]> Date: Tue Feb 7 10:36:53 2012 +0000 Ignore glXSwapInterval* when retracing. diff --git a/glretrace_glx.cpp b/glretrace_glx.cpp index a3b80f2..7342908 100644 --- a/glretrace_glx.cpp +++ b/glretrace_glx.cpp @@ -247,8 +247,8 @@ const retrace::Entry glretrace::glx_callbacks[] = { //{"glXSet3DfxModeMESA", &retrace_glXSet3DfxModeMESA}, //{"glXSwapBuffersMscOML", &retrace_glXSwapBuffersMscOML}, {"glXSwapBuffers", &retrace_glXSwapBuffers}, - //{"glXSwapIntervalEXT", &retrace_glXSwapIntervalEXT}, - //{"glXSwapIntervalSGI", &retrace_glXSwapIntervalSGI}, + {"glXSwapIntervalEXT", &retrace::ignore}, + {"glXSwapIntervalSGI", &retrace::ignore}, //{"glXUseXFont", &retrace_glXUseXFont}, {"glXWaitForMscOML", &retrace::ignore}, {"glXWaitForSbcOML", &retrace::ignore}, commit 77892a4faad93dfb4ee280e67124170941eac3a3 Author: José Fonseca <[email protected]> Date: Sat Feb 4 08:56:15 2012 +0000 Fix build with older DXSDK. diff --git a/d3d9imports.hpp b/d3d9imports.hpp index e2e2015..3e5ce39 100644 --- a/d3d9imports.hpp +++ b/d3d9imports.hpp @@ -39,6 +39,10 @@ #include <d3dx9.h> +#ifndef D3DFMT_A2B10G10R10_XR_BIAS +#define D3DFMT_A2B10G10R10_XR_BIAS 119 +#endif + #ifndef D3DFMT_ATI1 #define D3DFMT_ATI1 ((D3DFORMAT)MAKEFOURCC('A','T','I','1')) #endif commit b9ac0583698401a7399a54970f628761f161df73 Author: José Fonseca <[email protected]> Date: Fri Feb 3 19:06:50 2012 +0000 A few additions to win32 api. diff --git a/specs/winapi.py b/specs/winapi.py index 6e3c609..017cf5f 100644 --- a/specs/winapi.py +++ b/specs/winapi.py @@ -150,6 +150,30 @@ HMODULE = Opaque("HMODULE") IUnknown = Interface("IUnknown") +FILETIME = Struct("FILETIME", [ + (DWORD, "dwLowDateTime"), + (DWORD, "dwHighDateTime"), +]) + +COLORREF = Alias("COLORREF", DWORD) + +LOGFONTW = Struct("LOGFONTW", [ + (LONG, "lfHeight"), + (LONG, "lfWidth"), + (LONG, "lfEscapement"), + (LONG, "lfOrientation"), + (LONG, "lfWeight"), + (BYTE, "lfItalic"), + (BYTE, "lfUnderline"), + (BYTE, "lfStrikeOut"), + (BYTE, "lfCharSet"), + (BYTE, "lfOutPrecision"), + (BYTE, "lfClipPrecision"), + (BYTE, "lfQuality"), + (BYTE, "lfPitchAndFamily"), + (WString, "lfFaceName"), +]) + HRESULT_com = FakeEnum(HRESULT, [ "S_OK", "E_NOINTERFACE", commit ccf250c000bc13dd4958e010d6ba0de92c01fe72 Author: José Fonseca <[email protected]> Date: Fri Feb 3 19:06:31 2012 +0000 Try all interfaces when wrapping REFIIDs. diff --git a/d3d8trace.py b/d3d8trace.py index 1da3feb..af87c2d 100644 --- a/d3d8trace.py +++ b/d3d8trace.py @@ -40,6 +40,8 @@ class D3D8Tracer(DllTracer): if __name__ == '__main__': + print '#define INITGUID' + print print '#include <windows.h>' print '#include <d3d8.h>' print '#include "d3dshader.hpp"' diff --git a/d3d9trace.py b/d3d9trace.py index ae4acd0..4f40194 100644 --- a/d3d9trace.py +++ b/d3d9trace.py @@ -70,6 +70,8 @@ class D3D9Tracer(DllTracer): if __name__ == '__main__': + print '#define INITGUID' + print print '#include "trace_writer_local.hpp"' print '#include "os.hpp"' print diff --git a/trace.py b/trace.py index 831af98..bd97772 100644 --- a/trace.py +++ b/trace.py @@ -542,9 +542,11 @@ class Tracer: def wrapIid(self, riid, out): print ' if (%s && *%s) {' % (out.name, out.name) print ' if (*%s == m_pInstance) {' % (out.name,) + print ' AddRef();' + print ' m_pInstance->Release();' print ' *%s = this;' % (out.name,) print ' }' - for iface in self.api.interfaces: + for iface in self.api.getAllInterfaces(): print r' else if (%s == IID_%s) {' % (riid.name, iface.name) print r' *%s = new Wrap%s((%s *) *%s);' % (out.name, iface.name, iface.name, out.name) print r' }' commit 9dbeda6e78adf9d85e67bfa2e29876846038b2fe Author: José Fonseca <[email protected]> Date: Fri Feb 3 19:05:54 2012 +0000 Support const methods. Also several enhancements to C decl parser. diff --git a/specs/scripts/cdecl.py b/specs/scripts/cdecl.py index d6ee058..940ce44 100755 --- a/specs/scripts/cdecl.py +++ b/specs/scripts/cdecl.py @@ -189,6 +189,11 @@ class DeclParser: value = 0 while self.lookahead() != '}': type, name = self.parse_named_type() + + if self.match(':'): + self.consume() + self.consume() + if self.match(','): self.consume(',') self.consume(';') @@ -205,6 +210,8 @@ class DeclParser: if self.match(';'): return self.consume(':') + if self.lookahead() in ('public', 'protected'): + self.consume() base = self.consume() self.consume('{') @@ -225,7 +232,7 @@ class DeclParser: ret = self.parse_type() - if self.match('__stdcall'): + if self.match('__stdcall', 'WINAPI'): self.consume() creator = 'StdFunction' @@ -244,7 +251,10 @@ class DeclParser: args.append(arg) if self.match(','): self.consume() - self.consume() == ')' + self.consume(')') + if self.lookahead() == 'const': + self.consume() + extra = ', const=True' + extra print ' %s(%s, "%s", [%s]%s),' % (creator, ret, name, ', '.join(args), extra) @@ -256,6 +266,12 @@ class DeclParser: arg = '(%s, "%s")' % (type, name) if 'out' in tags: arg = 'Out' + arg + + if self.match('='): + self.consume() + while not self.match(',', ')'): + self.consume() + return arg def parse_tags(self): diff --git a/specs/stdapi.py b/specs/stdapi.py index d9fd545..6aa4089 100644 --- a/specs/stdapi.py +++ b/specs/stdapi.py @@ -361,10 +361,17 @@ class Interface(Type): class Method(Function): - def __init__(self, type, name, args): + def __init__(self, type, name, args, const=False): Function.__init__(self, type, name, args, call = '__stdcall') for index in range(len(self.args)): self.args[index].index = index + 1 + self.const = const + + def prototype(self, name=None): + s = Function.prototype(self, name) + if self.const: + s += ' const' + return s class String(Type): commit 4220b1bd2f3baccc2d4cbb63dda6413e093a2954 Author: José Fonseca <[email protected]> Date: Fri Feb 3 19:05:29 2012 +0000 Be more specific when invoking the interface methods. There may be ambiguities. diff --git a/d3d9trace.py b/d3d9trace.py index c408b49..ae4acd0 100644 --- a/d3d9trace.py +++ b/d3d9trace.py @@ -45,13 +45,13 @@ class D3D9Tracer(DllTracer): print ' UINT m_SizeToLock;' print ' VOID *m_pbData;' - def implementWrapperInterfaceMethodBody(self, interface, method): + def implementWrapperInterfaceMethodBody(self, interface, base, method): if interface.name == 'IDirect3DVertexBuffer9' and method.name == 'Unlock': print ' if (m_pbData) {' self.emit_memcpy('(LPBYTE)m_pbData', '(LPBYTE)m_pbData', 'm_SizeToLock') print ' }' - DllTracer.implementWrapperInterfaceMethodBody(self, interface, method) + DllTracer.implementWrapperInterfaceMethodBody(self, interface, base, method) if interface.name == 'IDirect3DVertexBuffer9' and method.name == 'Lock': # FIXME: handle recursive locks diff --git a/specs/stdapi.py b/specs/stdapi.py index 5ba621f..d9fd545 100644 --- a/specs/stdapi.py +++ b/specs/stdapi.py @@ -350,6 +350,14 @@ class Interface(Type): yield method raise StopIteration + def iterBaseMethods(self): + if self.base is not None: + for iface, method in self.base.iterBaseMethods(): + yield iface, method + for method in self.methods: + yield self, method + raise StopIteration + class Method(Function): diff --git a/trace.py b/trace.py index 8fd5840..831af98 100644 --- a/trace.py +++ b/trace.py @@ -478,23 +478,23 @@ class Tracer: print '%s::~%s() {' % (getWrapperInterfaceName(interface), getWrapperInterfaceName(interface)) print '}' print - for method in interface.iterMethods(): - self.implementWrapperInterfaceMethod(interface, method) + for base, method in interface.iterBaseMethods(): + self.implementWrapperInterfaceMethod(interface, base, method) print - def implementWrapperInterfaceMethod(self, interface, method): + def implementWrapperInterfaceMethod(self, interface, base, method): print method.prototype(getWrapperInterfaceName(interface) + '::' + method.name) + ' {' if method.type is not stdapi.Void: print ' %s __result;' % method.type - self.implementWrapperInterfaceMethodBody(interface, method) + self.implementWrapperInterfaceMethodBody(interface, base, method) if method.type is not stdapi.Void: print ' return __result;' print '}' print - def implementWrapperInterfaceMethodBody(self, interface, method): + def implementWrapperInterfaceMethodBody(self, interface, base, method): print ' static const char * __args[%u] = {%s};' % (len(method.args) + 1, ', '.join(['"this"'] + ['"%s"' % arg.name for arg in method.args])) print ' static const trace::FunctionSig __sig = {%u, "%s", %u, __args};' % (method.id, interface.name + '::' + method.name, len(method.args) + 1) print ' unsigned __call = trace::localWriter.beginEnter(&__sig);' @@ -514,7 +514,7 @@ class Tracer: riid = arg print ' trace::localWriter.endEnter();' - self.invokeMethod(interface, method) + self.invokeMethod(interface, base, method) print ' trace::localWriter.beginLeave(__call);' for arg in method.args: @@ -563,12 +563,12 @@ class Tracer: print r' }' print ' }' - def invokeMethod(self, interface, method): + def invokeMethod(self, interface, base, method): if method.type is stdapi.Void: result = '' else: result = '__result = ' - print ' %sm_pInstance->%s(%s);' % (result, method.name, ', '.join([str(arg.name) for arg in method.args])) + print ' %sstatic_cast<%s *>(m_pInstance)->%s(%s);' % (result, base, method.name, ', '.join([str(arg.name) for arg in method.args])) def emit_memcpy(self, dest, src, length): print ' unsigned __call = trace::localWriter.beginEnter(&trace::memcpy_sig);' commit 2a2096442e6eb586bd39097b582cf54ddcdaaddb Author: José Fonseca <[email protected]> Date: Fri Feb 3 17:46:32 2012 +0000 Recognize D3DUSAGE flags in resource descriptions. diff --git a/specs/d3d9types.py b/specs/d3d9types.py index 235aa16..312eb2a 100644 --- a/specs/d3d9types.py +++ b/specs/d3d9types.py @@ -875,7 +875,7 @@ D3DLOCK = Flags(DWORD, [ D3DVERTEXBUFFER_DESC = Struct("D3DVERTEXBUFFER_DESC", [ (D3DFORMAT, "Format"), (D3DRESOURCETYPE, "Type"), - (DWORD, "Usage"), + (D3DUSAGE, "Usage"), (D3DPOOL, "Pool"), (UINT, "Size"), (DWORD, "FVF"), @@ -884,7 +884,7 @@ D3DVERTEXBUFFER_DESC = Struct("D3DVERTEXBUFFER_DESC", [ D3DINDEXBUFFER_DESC = Struct("D3DINDEXBUFFER_DESC", [ (D3DFORMAT, "Format"), (D3DRESOURCETYPE, "Type"), - (DWORD, "Usage"), + (D3DUSAGE, "Usage"), (D3DPOOL, "Pool"), (UINT, "Size"), ]) @@ -892,7 +892,7 @@ D3DINDEXBUFFER_DESC = Struct("D3DINDEXBUFFER_DESC", [ D3DSURFACE_DESC = Struct("D3DSURFACE_DESC", [ (D3DFORMAT, "Format"), (D3DRESOURCETYPE, "Type"), - (DWORD, "Usage"), + (D3DUSAGE, "Usage"), (D3DPOOL, "Pool"), (D3DMULTISAMPLE_TYPE, "MultiSampleType"), (DWORD, "MultiSampleQuality"), @@ -903,7 +903,7 @@ D3DSURFACE_DESC = Struct("D3DSURFACE_DESC", [ D3DVOLUME_DESC = Struct("D3DVOLUME_DESC", [ (D3DFORMAT, "Format"), (D3DRESOURCETYPE, "Type"), - (DWORD, "Usage"), + (D3DUSAGE, "Usage"), (D3DPOOL, "Pool"), (UINT, "Width"), (UINT, "Height"), commit 22261c1c5747cf48391ac37772edf1144edaa710 Author: José Fonseca <[email protected]> Date: Fri Feb 3 09:56:24 2012 +0000 Recognize D3DFMT_A2B10G10R10_XR_BIAS. diff --git a/specs/d3d9types.py b/specs/d3d9types.py index c5f0724..235aa16 100644 --- a/specs/d3d9types.py +++ b/specs/d3d9types.py @@ -737,6 +737,7 @@ D3DFORMAT = Enum("D3DFORMAT", [ "D3DFMT_A32B32G32R32F", "D3DFMT_CxV8U8", "D3DFMT_A1", + "D3DFMT_A2B10G10R10_XR_BIAS", "D3DFMT_BINARYBUFFER", # Unofficial formats commit ae9c4c1e2ab603a484b5afa50b37e1d7ce95a7b4 Author: José Fonseca <[email protected]> Date: Thu Feb 2 13:59:31 2012 +0000 Warn when calling GL entry points without a current context. diff --git a/glretrace.py b/glretrace.py index e862e25..8dfc340 100644 --- a/glretrace.py +++ b/glretrace.py @@ -230,6 +230,11 @@ class GlRetracer(Retracer): if function.name == "glEnd": print ' glretrace::insideGlBeginEnd = false;' + if function.name.startswith('gl') and not function.name.startswith('glX'): + print r' if (!glretrace::context && !glretrace::benchmark && !retrace::profiling) {' + print r' retrace::warning(call) << "no current context\n";' + print r' }' + if function.name == 'memcpy': print ' if (!dest || !src || !n) return;' commit 95a7a8611c6fa7c4c59797c174764525df4c2311 Author: José Fonseca <[email protected]> Date: Wed Feb 1 20:46:10 2012 +0000 Ensure function default argument matches template type. -- To UNSUBSCRIBE, email to [email protected] with a subject of "unsubscribe". Trouble? Contact [email protected] Archive: http://lists.debian.org/[email protected]

