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.

devinfo.html 7.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html lang="en">
  3. <head>
  4. <meta http-equiv="content-type" content="text/html; charset=utf-8">
  5. <title>Development Notes</title>
  6. <link rel="stylesheet" type="text/css" href="mesa.css">
  7. </head>
  8. <body>
  9. <div class="header">
  10. <h1>The Mesa 3D Graphics Library</h1>
  11. </div>
  12. <iframe src="contents.html"></iframe>
  13. <div class="content">
  14. <h1>Development Notes</h1>
  15. <h2>Adding Extentions</h2>
  16. <p>
  17. To add a new GL extension to Mesa you have to do at least the following.
  18. <ul>
  19. <li>
  20. If glext.h doesn't define the extension, edit include/GL/gl.h and add
  21. code like this:
  22. <pre>
  23. #ifndef GL_EXT_the_extension_name
  24. #define GL_EXT_the_extension_name 1
  25. /* declare the new enum tokens */
  26. /* prototype the new functions */
  27. /* TYPEDEFS for the new functions */
  28. #endif
  29. </pre>
  30. </li>
  31. <li>
  32. In the src/mesa/glapi/ directory, add the new extension functions and
  33. enums to the gl_API.xml file.
  34. Then, a bunch of source files must be regenerated by executing the
  35. corresponding Python scripts.
  36. </li>
  37. <li>
  38. Add a new entry to the <code>gl_extensions</code> struct in mtypes.h
  39. </li>
  40. <li>
  41. Update the <code>extensions.c</code> file.
  42. </li>
  43. <li>
  44. From this point, the best way to proceed is to find another extension,
  45. similar to the new one, that's already implemented in Mesa and use it
  46. as an example.
  47. </li>
  48. <li>
  49. If the new extension adds new GL state, the functions in get.c, enable.c
  50. and attrib.c will most likely require new code.
  51. </li>
  52. </ul>
  53. <h2>Coding Style</h2>
  54. <p>
  55. Mesa's code style has changed over the years. Here's the latest.
  56. </p>
  57. <p>
  58. Comment your code! It's extremely important that open-source code be
  59. well documented. Also, strive to write clean, easily understandable code.
  60. </p>
  61. <p>
  62. 3-space indentation
  63. </p>
  64. <p>
  65. If you use tabs, set them to 8 columns
  66. </p>
  67. <p>
  68. Line width: the preferred width to fill comments and code in Mesa is 78
  69. columns. Exceptions are sometimes made for clarity (e.g. tabular data is
  70. sometimes filled to a much larger width so that extraneous carriage returns
  71. don't obscure the table).
  72. </p>
  73. <p>
  74. Brace example:
  75. </p>
  76. <pre>
  77. if (condition) {
  78. foo;
  79. }
  80. else {
  81. bar;
  82. }
  83. switch (condition) {
  84. case 0:
  85. foo();
  86. break;
  87. case 1: {
  88. ...
  89. break;
  90. }
  91. default:
  92. ...
  93. break;
  94. }
  95. </pre>
  96. <p>
  97. Here's the GNU indent command which will best approximate my preferred style:
  98. (Note that it won't format switch statements in the preferred way)
  99. </p>
  100. <pre>
  101. indent -br -i3 -npcs --no-tabs infile.c -o outfile.c
  102. </pre>
  103. <p>
  104. Local variable name example: localVarName (no underscores)
  105. </p>
  106. <p>
  107. Constants and macros are ALL_UPPERCASE, with _ between words
  108. </p>
  109. <p>
  110. Global variables are not allowed.
  111. </p>
  112. <p>
  113. Function name examples:
  114. </p>
  115. <pre>
  116. glFooBar() - a public GL entry point (in glapi_dispatch.c)
  117. _mesa_FooBar() - the internal immediate mode function
  118. save_FooBar() - retained mode (display list) function in dlist.c
  119. foo_bar() - a static (private) function
  120. _mesa_foo_bar() - an internal non-static Mesa function
  121. </pre>
  122. <p>
  123. Places that are not directly visible to the GL API should prefer the use
  124. of <tt>bool</tt>, <tt>true</tt>, and
  125. <tt>false</tt> over <tt>GLboolean</tt>, <tt>GL_TRUE</tt>, and
  126. <tt>GL_FALSE</tt>. In C code, this may mean that
  127. <tt>#include &lt;stdbool.h&gt;</tt> needs to be added. The
  128. <tt>try_emit_</tt>* methods in src/mesa/program/ir_to_mesa.cpp and
  129. src/mesa/state_tracker/st_glsl_to_tgsi.cpp can serve as examples.
  130. </p>
  131. <h2>Marking a commit as a candidate for a stable branch</h2>
  132. <p>
  133. If you want a commit to be applied to a stable branch,
  134. you should add an appropriate note to the commit message.
  135. </p>
  136. <p>
  137. Here are some examples of such a note:
  138. </p>
  139. <ul>
  140. <li>NOTE: This is a candidate for the 9.0 branch.</li>
  141. <li>NOTE: This is a candidate for the 8.0 and 9.0 branches.</li>
  142. <li>NOTE: This is a candidate for the stable branches.</li>
  143. </ul>
  144. <h2>Cherry-picking candidates for a stable branch</h2>
  145. <p>
  146. Please use <code>git cherry-pick -x &lt;commit&gt;</code> for cherry-picking a commit
  147. from master to a stable branch.
  148. </p>
  149. <h2>Making a New Mesa Release</h2>
  150. <p>
  151. These are the instructions for making a new Mesa release.
  152. </p>
  153. <h3>Get latest source files</h3>
  154. <p>
  155. Use git to get the latest Mesa files from the git repository, from whatever
  156. branch is relevant.
  157. </p>
  158. <h3>Verify and update version info</h3>
  159. <dl>
  160. <dt>Makefile.am</dt>
  161. <dt>SConstruct</dt>
  162. <dt>Android.common.mk</dt>
  163. <dd>PACKAGE_VERSION</dd>
  164. <dt>configure.ac</dt>
  165. <dd>AC_INIT</dd>
  166. </dl>
  167. <p>
  168. Create a docs/relnotes/x.y.z.html file.
  169. The bin/shortlog_mesa.sh script can be used to create a HTML-formatted list
  170. of changes to include in the file.
  171. Link the new docs/relnotes/x.y.z.html file into the main <a href="relnotes.html">relnotes.html</a> file.
  172. </p>
  173. <p>
  174. Update <a href="index.html">docs/index.html</a>.
  175. </p>
  176. <p>
  177. Tag the files with the release name (in the form <b>mesa-x.y</b>)
  178. with: <code>git tag -s mesa-x.y -m "Mesa x.y Release"</code>
  179. Then: <code>git push origin mesa-x.y</code>
  180. </p>
  181. <h3>Make the tarballs</h3>
  182. <p>
  183. Make the distribution files. From inside the Mesa directory:
  184. <pre>
  185. ./autogen.sh
  186. make tarballs
  187. </pre>
  188. <p>
  189. After the tarballs are created, the md5 checksums for the files will
  190. be computed.
  191. Add them to the docs/relnotes/x.y.html file.
  192. </p>
  193. <p>
  194. Copy the distribution files to a temporary directory, unpack them,
  195. compile everything, and run some demos to be sure everything works.
  196. </p>
  197. <h3>Update the website and announce the release</h3>
  198. <p>
  199. Make a new directory for the release on annarchy.freedesktop.org with:
  200. <br>
  201. <code>
  202. mkdir /srv/ftp.freedesktop.org/pub/mesa/x.y
  203. </code>
  204. </p>
  205. <p>
  206. Basically, to upload the tarball files with:
  207. <br>
  208. <code>
  209. rsync -avP -e ssh MesaLib-x.y.* USERNAME@annarchy.freedesktop.org:/srv/ftp.freedesktop.org/pub/mesa/x.y/
  210. </code>
  211. </p>
  212. <p>
  213. Update the web site by copying the docs/ directory's files to
  214. /home/users/b/br/brianp/mesa-www/htdocs/ with:
  215. <br>
  216. <code>
  217. sftp USERNAME,mesa3d@web.sourceforge.net
  218. </code>
  219. </p>
  220. <p>
  221. Make an announcement on the mailing lists:
  222. <em>m</em><em>e</em><em>s</em><em>a</em><em>-</em><em>d</em><em>e</em><em>v</em><em>@</em><em>l</em><em>i</em><em>s</em><em>t</em><em>s</em><em>.</em><em>f</em><em>r</em><em>e</em><em>e</em><em>d</em><em>e</em><em>s</em><em>k</em><em>t</em><em>o</em><em>p</em><em>.</em><em>o</em><em>r</em><em>g</em>,
  223. <em>m</em><em>e</em><em>s</em><em>a</em><em>-</em><em>u</em><em>s</em><em>e</em><em>r</em><em>s</em><em>@</em><em>l</em><em>i</em><em>s</em><em>t</em><em>s</em><em>.</em><em>f</em><em>r</em><em>e</em><em>e</em><em>d</em><em>e</em><em>s</em><em>k</em><em>t</em><em>o</em><em>p</em><em>.</em><em>o</em><em>r</em><em>g</em>
  224. and
  225. <em>m</em><em>e</em><em>s</em><em>a</em><em>-</em><em>a</em><em>n</em><em>n</em><em>o</em><em>u</em><em>n</em><em>c</em><em>e</em><em>@</em><em>l</em><em>i</em><em>s</em><em>t</em><em>s</em><em>.</em><em>f</em><em>r</em><em>e</em><em>e</em><em>d</em><em>e</em><em>s</em><em>k</em><em>t</em><em>o</em><em>p</em><em>.</em><em>o</em><em>r</em><em>g</em>
  226. </p>
  227. </div>
  228. </body>
  229. </html>