Clone of mesa.
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

MESA_trace.spec 12KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360
  1. Name
  2. MESA_trace
  3. Name Strings
  4. GL_MESA_TRACE
  5. Contact
  6. Bernd Kreimeier, Loki Entertainment, bk 'at' lokigames.com
  7. Brian Paul, VA Linux Systems, Inc., brianp 'at' valinux.com
  8. Status
  9. XXX - Not complete yet!!!
  10. Version
  11. $Id: MESA_trace.spec,v 1.2 2001/01/29 16:10:18 brianp Exp $
  12. Number
  13. none yet
  14. Dependencies
  15. OpenGL 1.2 is required.
  16. The extension is written against the OpenGL 1.2 Specification
  17. Overview
  18. Provides the application with means to enable and disable logging
  19. of GL calls including parameters as readable text. The verbosity
  20. of the generated log can be controlled. The resulting logs are
  21. valid (but possibly incomplete) C code and can be compiled and
  22. linked for standalone test programs. The set of calls and the
  23. amount of static data that is logged can be controlled at runtime.
  24. The application can add comments and enable or disable tracing of GL
  25. operations at any time. The data flow from the application to GL
  26. and back is unaffected except for timing.
  27. Application-side implementation of these features raises namespace
  28. and linkage issues. In the driver dispatch table a simple
  29. "chain of responsibility" pattern (aka "composable piepline")
  30. can be added.
  31. IP Status
  32. The extension spec is in the public domain. The current implementation
  33. in Mesa is covered by Mesa's XFree86-style copyright by the authors above.
  34. This extension is partially inspired by the Quake2 QGL wrapper.
  35. Issues
  36. (1) Is this Extension obsolete because it can
  37. be implemented as a wrapper DLL?
  38. RESOLVED: No. While certain operating systems (Win32) provide linkers
  39. that facilitate this kind of solution, other operating systems
  40. (Linux) do not support hierarchical linking, so a wrapper solution
  41. would result in symbol collisions.
  42. Further, IHV's might have builtin support for tracing GL execution
  43. that enjoys privileged access, or that they do not wish to separate
  44. the tracing code from their driver code base.
  45. (2) Should the Trace API explicitely support the notion of "frames?
  46. This would require hooking into glXSwapBuffers calls as well.
  47. RESOLVED: No. The application can use NewTraceMESA/EndTraceMESA
  48. and TraceComment along with external parsing tools to split the
  49. trace into frames, in whatever way considered adequate.
  50. (2a) Should GLX calls be traced?
  51. PBuffers and other render-to-texture solutions demonstrate that
  52. context level commands beyond SwapBuffers might have to be
  53. traced. The GL DLL exports the entry points, so this would not
  54. be out of the question.
  55. (3) Should the specification mandate the actual output format?
  56. RESOLVED: No. It is sufficient to guarantee that all data and commands
  57. will be traced as requested by Enable/DisableTraceMESA, in the order
  58. encountered. Whether the resulting trace is available as a readable
  59. text file, binary metafile, compilable source code, much less which
  60. indentation and formatting has been used, is up to the implementation.
  61. For the same reason this specification does not enforce or prohibit
  62. additional information added to the trace (statistics, profiling/timing,
  63. warnings on possible error conditions).
  64. (4) Should the comment strings associated with names and pointer (ranges)
  65. be considered persistent state?
  66. RESOLVED: No. The implementation is not forced to use this information
  67. on subsequent occurences of name/pointer, and is free to consider it
  68. transient state.
  69. (5) Should comment commands be prohibited between Begin/End?
  70. RESOLVED: Yes, with the exception of TraceCommentMESA. TraceCommentMESA
  71. is transient, the other commands might cause storage of persistent
  72. data in the context. There is no need to have the ability mark names
  73. or pointers between Begin and End.
  74. New Procedures and Functions
  75. void NewTraceMESA( bitfield mask, const ubyte * traceName )
  76. void EndTraceMESA( void )
  77. void EnableTraceMESA( bitfield mask )
  78. void DisableTraceMESA( bitfield mask )
  79. void TraceAssertAttribMESA( bitfield attribMask )
  80. void TraceCommentMESA( const ubyte* comment )
  81. void TraceTextureMESA( uint name, const ubyte* comment )
  82. void TraceListMESA( uint name, const ubyte* comment )
  83. void TracePointerMESA( void* pointer, const ubyte* comment )
  84. void TracePointerRangeMESA( const void* first,
  85. const void* last,
  86. const ubyte* comment )
  87. New Tokens
  88. Accepted by the <mask> parameter of EnableTrace and DisableTrace:
  89. TRACE_ALL_BITS_MESA 0xFFFF
  90. TRACE_OPERATIONS_BIT_MESA 0x0001
  91. TRACE_PRIMITIVES_BIT_MESA 0x0002
  92. TRACE_ARRAYS_BIT_MESA 0x0004
  93. TRACE_TEXTURES_BIT_MESA 0x0008
  94. TRACE_PIXELS_BIT_MESA 0x0010
  95. TRACE_ERRORS_BIT_MESA 0x0020
  96. Accepted by the <pname> parameter of GetIntegerv, GetBooleanv,
  97. GetFloatv, and GetDoublev:
  98. TRACE_MASK_MESA 0x8755
  99. Accepted by the <pname> parameter to GetString:
  100. TRACE_NAME_MESA 0x8756
  101. Additions to Chapter 2 of the OpenGL 1.2.1 Specification (OpenGL Operation)
  102. None.
  103. Additions to Chapter 3 of the OpenGL 1.2.1 Specification (OpenGL Operation)
  104. None.
  105. Additions to Chapter 4 of the OpenGL 1.2.1 Specification (OpenGL Operation)
  106. None.
  107. Additions to Chapter 5 of the OpenGL 1.2.1 Specification (Special Functions)
  108. Add a new section:
  109. 5.7 Tracing
  110. The tracing facility is used to record the execution of a GL program
  111. to a human-readable log. The log appears as a sequence of GL commands
  112. using C syntax. The primary intention of tracing is to aid in program
  113. debugging.
  114. A trace is started with the command
  115. void NewTraceMESA( bitfield mask, const GLubyte * traceName )
  116. <mask> may be any value accepted by PushAttrib and specifies a set of
  117. attribute groups. The state values included in those attribute groups
  118. is written to the trace as a sequence of GL commands.
  119. <traceName> specifies a name or label for the trace. It is expected
  120. that <traceName> will be interpreted as a filename in most implementations.
  121. A trace is ended by calling the command
  122. void EndTraceMESA( void )
  123. It is illegal to call NewTraceMESA or EndTraceMESA between Begin and End.
  124. The commands
  125. void EnableTraceMESA( bitfield mask )
  126. void DisableTraceMESA( bitfield mask )
  127. enable or disable tracing of different classes of GL commands.
  128. <mask> may be the union of any of TRACE_OPERATIONS_BIT_MESA,
  129. TRACE_PRIMITIVES_BIT_MESA, TRACE_ARRAYS_BIT_MESA, TRACE_TEXTURES_BIT_MESA,
  130. and TRACE_PIXELS_BIT_MESA. The special token TRACE_ALL_BITS_MESA
  131. indicates all classes of commands are to be logged.
  132. TRACE_OPERATIONS_BIT_MESA controls logging of all commands outside of
  133. Begin/End, including Begin/End.
  134. TRACE_PRIMITIVES_BIT_MESA controls logging of all commands inside of
  135. Begin/End, including Begin/End.
  136. TRACE_ARRAYS_BIT_MESA controls logging of VertexPointer, NormalPointer,
  137. ColorPointer, IndexPointer, TexCoordPointer and EdgeFlagPointer commands.
  138. TRACE_TEXTURES_BIT_MESA controls logging of texture data dereferenced by
  139. TexImage1D, TexImage2D, TexImage3D, TexSubImage1D, TexSubImage2D, and
  140. TexSubImage3D commands.
  141. TRACE_PIXELS_BIT_MESA controls logging of image data dereferenced by
  142. Bitmap and DrawPixels commands.
  143. TRACE_ERRORS_BIT_MESA controls logging of all errors. If this bit is
  144. set, GetError will be executed whereever applicable, and the result will
  145. be added to the trace as a comment. The error returns are cached and
  146. returned to the application on its GetError calls. If the user does not
  147. wish the additional GetError calls to be performed, this bit should not
  148. be set.
  149. The command
  150. void TraceCommentMESA( const ubyte* comment )
  151. immediately adds the <comment> string to the trace output, surrounded
  152. by C-style comment delimiters.
  153. The commands
  154. void TraceTextureMESA( uint name, const ubyte* comment )
  155. void TraceListMESA( uint name, const ubyte* comment )
  156. associates <comment> with the texture object or display list specified
  157. by <name>. Logged commands which reference the named texture object or
  158. display list will be annotated with <comment>. If IsTexture(name) or
  159. IsList(name) fail (respectively) the command is quietly ignored.
  160. The commands
  161. void TracePointerMESA( void* pointer, const ubyte* comment )
  162. void TracePointerRangeMESA( const void* first,
  163. const void* last,
  164. const ubyte* comment )
  165. associate <comment> with the address specified by <pointer> or with
  166. a range of addresses specified by <first> through <last>.
  167. Any logged commands which reference <pointer> or an address between
  168. <first> and <last> will be annotated with <comment>.
  169. The command
  170. void TraceAssertAttribMESA( bitfield attribMask )
  171. will add GL state queries and assertion statements to the log to
  172. confirm that the current state at the time TraceAssertAttrib is
  173. executed matches the current state when the trace log is executed
  174. in the future.
  175. <attribMask> is any value accepted by PushAttrib and specifies
  176. the groups of state variables which are to be asserted.
  177. The commands NewTraceMESA, EndTraceMESA, EnableTraceMESA, DisableTraceMESA,
  178. TraceAssertAttribMESA, TraceCommentMESA, TraceTextureMESA, TraceListMESA,
  179. TracePointerMESA and TracePointerRangeMESA are not compiled into display lists.
  180. Examples:
  181. The command NewTraceMESA(DEPTH_BUFFER_BIT, "log") will query the state
  182. variables DEPTH_TEST, DEPTH_FUNC, DEPTH_WRITEMASK, and DEPTH_CLEAR_VALUE
  183. to get the values <test>, <func>, <mask>, and <clear> respectively.
  184. Statements equivalent to the following will then be logged:
  185. glEnable(GL_DEPTH_TEST); (if <test> is true)
  186. glDisable(GL_DEPTH_TEST); (if <test> is false)
  187. glDepthFunc(<func>);
  188. glDepthMask(<mask>);
  189. glClearDepth(<clear>);
  190. The command TraceAssertAttribMESA(DEPTH_BUFFER_BIT) will query the state
  191. variables DEPTH_TEST, DEPTH_FUNC, DEPTH_WRITEMASK, and DEPTH_CLEAR_VALUE
  192. to get the values <test>, <func>, <mask>, and <clear> respectively.
  193. The resulting trace might then look will like this:
  194. {
  195. GLboolean b;
  196. GLint i;
  197. GLfloat f;
  198. b = glIsEnabled(GL_DEPTH_TEST);
  199. assert(b == <test>);
  200. glGetIntegerv(GL_DEPTH_FUNC, &i);
  201. assert(i == <func>);
  202. glGetIntegerv(GL_DEPTH_MASK, &i);
  203. assert(i == <mask>);
  204. glGetFloatv(GL_DEPTH_CLEAR_VALUE, &f);
  205. assert(f == <clear>);
  206. }
  207. Additions to Chapter 6 of the OpenGL 1.2.1 Specification
  208. (State and State Requests)
  209. Querying TRACE_MASK_MESA with GetIntegerv, GetFloatv, GetBooleanv or
  210. GetDoublev returns the current command class trace mask.
  211. Querying TRACE_NAME_MESA with GetString returns the current trace name.
  212. Additions to Appendix A of the OpenGL 1.2.1 Specification (Invariance)
  213. The MESA_trace extension can be used in a way that does not affect data
  214. flow from application to OpenGL, as well as data flow from OpenGL to
  215. application, except for timing, possible print I/O. TRACE_ERRORS_BIT_MESA
  216. will add additional GetError queries. Setting a trace mask with NewTraceMESA
  217. as well as use of TraceAssertAttribMESA might cause additional state queries.
  218. With the possible exception of performance, OpenGL rendering should not be
  219. affected at all by a properly chosen logging operation.
  220. Additions to the AGL/GLX/WGL Specifications
  221. None.
  222. GLX Protocol
  223. None. The logging operation is carried out client-side, by exporting
  224. entry points to the wrapper functions that execute the logging operation.
  225. Errors
  226. INVALID_OPERATION is generated if any trace command except TraceCommentMESA
  227. is called between Begin and End.
  228. New State
  229. The current trace name and current command class mask are stored
  230. per-context.
  231. New Implementation Dependent State
  232. None.
  233. Revision History
  234. * Revision 0.1 - Initial draft from template (bk000415)
  235. * Revision 0.2 - Draft (bk000906)
  236. * Revision 0.3 - Draft (bk000913)
  237. * Revision 0.4 - Reworked text, fixed typos (bp000914)
  238. * Revision 0.5 - Assigned final GLenum values (bp001103)
  239. * Revision 0.6 - TRACE_ERRORS_BIT_MESA (bk000916)
  240. * Revision 0.7 - Added MESA postfix (bk010126)