Clone of mesa.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  1. XXX - Not complete yet!!!
  2. Name
  3. MESA_trace
  4. Name Strings
  5. GL_MESA_TRACE
  6. Contact
  7. Bernd Kreimeier, Loki Entertainment, bk 'at' lokigames.com
  8. Brian Paul, VA Linux Systems, Inc., brianp 'at' valinux.com
  9. Status
  10. XXX - Not complete yet!!!
  11. Version
  12. $Id: MESA_trace.spec,v 1.1 2000/11/03 15:10:04 brianp Exp $
  13. Number
  14. ???
  15. Dependencies
  16. OpenGL 1.2 is required.
  17. The extension is written against the OpenGL 1.2 Specification
  18. Overview
  19. Provides the application with means to enable and disable logging
  20. of GL calls including parameters as readable text. The verbosity
  21. of the generated log can be controlled. The resulting logs are
  22. valid (but possibly incomplete) C code and can be compiled and
  23. linked for standalone test programs. The set of calls and the
  24. amount of static data that is logged can be controlled at runtime.
  25. The application can add comments and enable or disable tracing of GL
  26. operations at any time. The data flow from the application to GL
  27. and back is unaffected except for timing.
  28. Application-side implementation of these features raises namespace
  29. and linkage issues. In the driver dispatch table a simple
  30. "chain of responsibility" pattern (aka "composable piepline")
  31. can be added.
  32. IP Status
  33. The extension spec is in the public domain. The current implementation
  34. in Mesa is covered by Mesa's XFree86-style copyright by the authors above.
  35. This extension is partially inspired by the Quake2 QGL wrapper.
  36. Issues
  37. none yet
  38. New Procedures and Functions
  39. void NewTraceMESA( bitfield mask, const ubyte *traceName )
  40. void EndTraceMESA( void )
  41. void EnableTraceMESA( bitfield mask )
  42. void DisableTraceMESA( bitfield mask )
  43. void TraceAssertAttribMESA( bitfield attribMask )
  44. void TraceCommentMESA( const ubyte *comment )
  45. void TraceTextureMESA( uint name, const ubyte *comment )
  46. void TraceListMESA( uint name, const ubyte *comment )
  47. void TracePointerMESA( void *pointer, const ubyte *comment )
  48. void TracePointerRangeMESA( const void *first, const void *last,
  49. const ubyte *comment )
  50. New Tokens
  51. Accepted by the <mask> parameter of EnableTrace and DisableTrace:
  52. TRACE_ALL_BITS_MESA 0x0001
  53. TRACE_OPERATIONS_BIT_MESA 0x0002
  54. TRACE_PRIMITIVES_BIT_MESA 0x0004
  55. TRACE_ARRAYS_BIT_MESA 0x0008
  56. TRACE_TEXTURES_BIT_MESA 0x0010
  57. TRACE_PIXELS_BIT_MESA 0x0020
  58. Accepted by the <pname> parameter of GetIntegerv, GetBooleanv,
  59. GetFloatv, and GetDoublev:
  60. TRACE_MASK_MESA 0x8755
  61. Accepted by the <pname> parameter to GetString:
  62. TRACE_NAME_MESA 0x8756
  63. Additions to Chapter 2 of the OpenGL 1.2.1 Specification (OpenGL Operation)
  64. None.
  65. Additions to Chapter 3 of the OpenGL 1.2.1 Specification (OpenGL Operation)
  66. None.
  67. Additions to Chapter 4 of the OpenGL 1.2.1 Specification (OpenGL Operation)
  68. None.
  69. Additions to Chapter 5 of the OpenGL 1.2.1 Specification (Special Functions)
  70. Add a new section:
  71. 5.7 Tracing
  72. The tracing facility is used to record the execution of a GL program
  73. to a human-readable log. The log appears as a sequence of GL commands
  74. using C syntax. The primary intention of tracing is to aid in program
  75. debugging.
  76. A trace is started with the command
  77. void NewTraceMESA( bitfield mask, const GLubyte * traceName )
  78. <mask> may be any value accepted by PushAttrib and specifies a set of
  79. attribute groups. The state values included in those attribute groups
  80. is written to the trace as a sequence of GL commands.
  81. <traceName> specifies a name or label for the trace. It is expected
  82. that <traceName> will be interpreted as a filename in most implementations.
  83. A trace is ended by calling the command
  84. void EndTraceMESA( void )
  85. It is illegal to call NewTrace or EndTrace between Begin and End.
  86. The commands
  87. void EnableTraceMESA( bitfield mask )
  88. void DisableTraceMESA( bitfield mask )
  89. enable or disable tracing of different classes of GL commands.
  90. <mask> may be the union of any of TRACE_OPERATIONS_BIT_MESA,
  91. TRACE_PRIMITIVES_BIT_MESA, TRACE_ARRAYS_BIT_MESA, TRACE_TEXTURES_BIT_MESA,
  92. and TRACE_PIXELS_BIT_MESA. The special token TRACE_ALL_BITS_MESA
  93. indicates all classes of commands are to be logged.
  94. TRACE_OPERATIONS_BIT_MESA controls logging of all commands outside of
  95. Begin/End, including Begin/End.
  96. TRACE_PRIMITIVES_BIT_MESA controls logging of all commands inside of
  97. Begin/End, including Begin/End.
  98. TRACE_ARRAYS_BIT_MESA controls logging of VertexPointer, NormalPointer,
  99. ColorPointer, IndexPointer, TexCoordPointer and EdgeFlagPointer commands.
  100. TRACE_TEXTURES_BIT_MESA controls logging of texture data dereferenced by
  101. TexImage1D, TexImage2D, TexImage3D, TexSubImage1D, TexSubImage2D, and
  102. TexSubImage3D commands.
  103. TRACE_PIXELS_BIT_MESA controls logging of image data dereferenced by
  104. Bitmap and DrawPixels commands.
  105. The command
  106. void TraceCommentMESA( const ubyte* comment )
  107. immediately adds the <comment> string to the trace output, surrounded
  108. by C-style comment delimiters.
  109. The commands
  110. void TraceTextureMESA( uint name, const ubyte* comment )
  111. void TraceListMESA( uint name, const ubyte* comment )
  112. associates <comment> with the texture object or display list specified
  113. by <name>. Logged commands which reference the named texture object or
  114. display list will be annotated with <comment>. If IsTexture(name) or
  115. IsList(name) fail (respectively) the command is quietly ignored.
  116. The commands
  117. void TracePointerMESA( void* pointer, const ubyte* comment )
  118. void TracePointerRangeMESA( const void* first, const void* last,
  119. const ubyte* comment )
  120. associate <comment> with the address specified by <pointer> or with
  121. a range of addresses specified by <first> through <last>.
  122. Any logged commands which reference <pointer> or an address between
  123. <first> and <last> will be annotated with <comment>.
  124. The command
  125. void TraceAssertAttribMESA( bitfield attribMask )
  126. will add GL state queries and assertion statements to the log to
  127. confirm that the current state at the time TraceAssertAttrib is
  128. executed matches the current state when the trace log is executed
  129. in the future.
  130. <attribMask> is any value accepted by PushAttrib and specifies
  131. the groups of state variables which are to be asserted.
  132. The commands NewTrace, EndTrace, EnableTrace, DisableTrace,
  133. TraceAssertAttrib, TraceComment, TraceTexture, TraceList, TracePointer,
  134. TracePointerRange, GetTraceName and GetTraceMask are not compiled
  135. into display lists.
  136. Examples:
  137. The command NewTrace(DEPTH_BUFFER_BIT, "log") will query the state
  138. variables DEPTH_TEST, DEPTH_FUNC, DEPTH_WRITEMASK, and DEPTH_CLEAR_VALUE
  139. to get the values <test>, <func>, <mask>, and <clear> respectively.
  140. Statements equivalent to the following will then be logged:
  141. glEnable(GL_DEPTH_TEST); (if <test> is true)
  142. glDisable(GL_DEPTH_TEST); (if <test> is false)
  143. glDepthFunc(<func>);
  144. glDepthMask(<mask>);
  145. glClearDepth(<clear>);
  146. The command TraceAssertAttrib(DEPTH_BUFFER_BIT) will query the state
  147. variables DEPTH_TEST, DEPTH_FUNC, DEPTH_WRITEMASK, and DEPTH_CLEAR_VALUE
  148. to get the values <test>, <func>, <mask>, and <clear> respectively.
  149. Statements equivalent to the following will then be logged:
  150. {
  151. GLboolean b;
  152. GLint i;
  153. GLfloat f;
  154. b = glIsEnabled(GL_DEPTH_TEST);
  155. assert(b == <test>);
  156. glGetIntegerv(GL_DEPTH_FUNC, &i);
  157. assert(i == <func>);
  158. glGetIntegerv(GL_DEPTH_MASK, &i);
  159. assert(i == <mask>);
  160. glGetFloatv(GL_DEPTH_CLEAR_VALUE, &f);
  161. assert(f == <clear>);
  162. }
  163. Additions to Chapter 6 of the OpenGL 1.2.1 Specification
  164. (State and State Requests)
  165. Querying TRACE_MASK_MESA with GetIntegerv, GetFloatv, GetBooleanv or
  166. GetDoublev returns the current command class trace mask.
  167. Querying TRACE_NAME_MESA with GetString returns the current trace name.
  168. Additions to Appendix A of the OpenGL 1.2.1 Specification (Invariance)
  169. The MESA_tracelog extension does not affect data flow from application
  170. to OpenGL, as well as data flow from OpenGL to application, except for
  171. timing, possible print I/O, and sequence of GetError queries. With
  172. the possible exception of performance, OpenGL rendering should not be
  173. affect by the logging operation.
  174. Additions to the AGL/GLX/WGL Specifications
  175. None.
  176. ? Hooking into glXSwapBuffers() ?
  177. GLX Protocol
  178. None. The logging operation is carried out client-side, by exporting
  179. entry points to the wrapper functions that execute the logging operation.
  180. Errors
  181. INVALID_OPERATION is generated if any trace command except TraceComment
  182. is called between Begin and End.
  183. New State
  184. The current trace name and current command class mask are stored
  185. per-context.
  186. New Implementation Dependent State
  187. None.
  188. Revision History
  189. * Revision 0.1 - Initial draft from template (bk000415)
  190. * Revision 0.2 - Draft (bk000906)
  191. * Revision 0.3 - Draft (bk000913)
  192. * Revision 0.4 - Added GetTraceName/Mask, fixed typos (bp000914)
  193. * Revision 0.5 - Assigned final GLenum values