3 # Copyright (C) 2006 Thomas Sondergaard
6 # Permission is hereby granted, free of charge, to any person obtaining a
7 # copy of this software and associated documentation files (the "Software"),
8 # to deal in the Software without restriction, including without limitation
9 # on the rights to use, copy, modify, merge, publish, distribute, sub
10 # license, and/or sell copies of the Software, and to permit persons to whom
11 # the Software is furnished to do so, subject to the following conditions:
13 # The above copyright notice and this permission notice (including the next
14 # paragraph) shall be included in all copies or substantial portions of the
17 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 # FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
20 # IBM AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
26 # Thomas Sondergaard <ts@medical-insight.com>
28 usage
="usage: $0 [ -hctev ] [-l LOGFILE] program [args...]\n\t-h\t\thelp (this text)\n\t-c\t\tlog gl calls\n\t-t\t\ttime stamp log entries\n\t-e\t\tcheck for and log errors. errors occurring between\n\t\t\tglBegin() and glEnd() are checked at glEnd()\n\t-v\t\tverbose. Shows configuration settings passed to\n\t\t\tgltrace.so\n\t-l LOGFILE\tlogfile. Default is stderr"
30 # Path to gltrace.so - must not be relative
31 #GLTRACE_SO=/home/ts/Mesa_gltrace/src/mesa/glapi/gltrace.so
33 GLTRACE_SO
=.
/gltrace.so
35 # Set options from command line
40 GLTRACE_CHECK_ERRORS
=0
41 export GLTRACE_LOG_CALLS GLTRACE_LOG_TIME GLTRACE_CHECK_ERRORS
48 while getopts "hctevl:" options
; do
52 c
) GLTRACE_LOG_CALLS
=1;;
53 t
) GLTRACE_LOG_TIME
=1;;
54 e
) GLTRACE_CHECK_ERRORS
=1;;
55 l
) GLTRACE_LOGFILE
=$OPTARG
56 export GLTRACE_LOGFILE
;;
63 # Remove the parsed args
66 if [ ! -r $GLTRACE_SO ]; then
67 echo "Error: The gltrace.so file '$GLTRACE_SO' is missing!"
71 export LD_PRELOAD
=$GLTRACE_SO
73 if [ $VERBOSE -eq 1 ]; then
74 echo GLTRACE_LOG_CALLS
=$GLTRACE_LOG_CALLS
75 echo GLTRACE_LOG_TIME
=$GLTRACE_LOG_TIME
76 echo GLTRACE_CHECK_ERRORS
=$GLTRACE_CHECK_ERRORS
77 echo GLTRACE_LOGFILE
=$GLTRACE_LOGFILE
78 echo LD_PRELOAD
=$LD_PRELOAD