blob: 4828cc61d6c22eaec43c70477f3f59c6dd901850 [file] [log] [blame]
Andreas Bollecd5c7c2012-06-12 09:05:03 +02001<!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>
Brian Paul0b27ace2003-03-08 17:38:57 +00009
Andreas Bollecd5c7c2012-06-12 09:05:03 +020010<h1>Development Notes</h1>
Brian Paul0b27ace2003-03-08 17:38:57 +000011
12
Andreas Bollecd5c7c2012-06-12 09:05:03 +020013<h2>Adding Extentions</h2>
Brian Paul0b27ace2003-03-08 17:38:57 +000014
15<p>
Brian Paul51830612004-08-17 14:08:59 +000016To add a new GL extension to Mesa you have to do at least the following.
Brian Paul0b27ace2003-03-08 17:38:57 +000017
Brian Paul51830612004-08-17 14:08:59 +000018<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>
Brian Paulbb086292006-09-21 22:53:15 +000038 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.
Brian Paul51830612004-08-17 14:08:59 +000047</li>
48<li>
Brian Paul65b79052004-11-22 17:49:15 +000049 If the new extension adds new GL state, the functions in get.c, enable.c
Brian Paul51830612004-08-17 14:08:59 +000050 and attrib.c will most likely require new code.
51</li>
52</ul>
Brian Paul0b27ace2003-03-08 17:38:57 +000053
54
55
Andreas Boll210a27d2012-06-12 09:05:36 +020056<h2>Coding Style</h2>
Brian Paul0b27ace2003-03-08 17:38:57 +000057
58<p>
59Mesa's code style has changed over the years. Here's the latest.
60</p>
61
62<p>
63Comment your code! It's extremely important that open-source code be
64well documented. Also, strive to write clean, easily understandable code.
65</p>
66
67<p>
683-space indentation
69</p>
70
71<p>
72If you use tabs, set them to 8 columns
73</p>
74
75<p>
Paul Berry43968262011-08-16 14:09:32 -070076Line width: the preferred width to fill comments and code in Mesa is 78
77columns. Exceptions are sometimes made for clarity (e.g. tabular data is
78sometimes filled to a much larger width so that extraneous carriage returns
79don't obscure the table).
80</p>
81
82<p>
Brian Paul0b27ace2003-03-08 17:38:57 +000083Brace example:
84</p>
85<pre>
86 if (condition) {
87 foo;
88 }
89 else {
90 bar;
91 }
Paul Berry43968262011-08-16 14:09:32 -070092
93 switch (condition) {
94 case 0:
95 foo();
96 break;
97
98 case 1: {
99 ...
100 break;
101 }
102
103 default:
104 ...
105 break;
106 }
Brian Paul0b27ace2003-03-08 17:38:57 +0000107</pre>
108
109<p>
110Here's the GNU indent command which will best approximate my preferred style:
Paul Berry43968262011-08-16 14:09:32 -0700111(Note that it won't format switch statements in the preferred way)
Brian Paul0b27ace2003-03-08 17:38:57 +0000112</p>
113<pre>
Brian Paule3f41ce2006-03-31 23:10:21 +0000114 indent -br -i3 -npcs --no-tabs infile.c -o outfile.c
Brian Paul0b27ace2003-03-08 17:38:57 +0000115</pre>
116
117
118<p>
119Local variable name example: localVarName (no underscores)
120</p>
121
122<p>
123Constants and macros are ALL_UPPERCASE, with _ between words
124</p>
125
126<p>
Brian Paul65b79052004-11-22 17:49:15 +0000127Global variables are not allowed.
Brian Paul0b27ace2003-03-08 17:38:57 +0000128</p>
129
130<p>
131Function name examples:
132</p>
133<pre>
Chia-I Wu27d260b42010-02-24 11:20:14 +0800134 glFooBar() - a public GL entry point (in glapi_dispatch.c)
Brian Paul0b27ace2003-03-08 17:38:57 +0000135 _mesa_FooBar() - the internal immediate mode function
136 save_FooBar() - retained mode (display list) function in dlist.c
137 foo_bar() - a static (private) function
138 _mesa_foo_bar() - an internal non-static Mesa function
139</pre>
140
Kai Wasserbächdbec3a52011-08-23 10:48:58 +0200141<p>
142Places that are not directly visible to the GL API should prefer the use
143of <tt>bool</tt>, <tt>true</tt>, and
144<tt>false</tt> over <tt>GLboolean</tt>, <tt>GL_TRUE</tt>, and
145<tt>GL_FALSE</tt>. In C code, this may mean that
Kai Wasserbäche106d4c2011-08-27 17:51:47 +0200146<tt>#include &lt;stdbool.h&gt;</tt> needs to be added. The
Kai Wasserbächdbec3a52011-08-23 10:48:58 +0200147<tt>try_emit_</tt>* methods in src/mesa/program/ir_to_mesa.cpp and
Kai Wasserbäche106d4c2011-08-27 17:51:47 +0200148src/mesa/state_tracker/st_glsl_to_tgsi.cpp can serve as examples.
Kai Wasserbächdbec3a52011-08-23 10:48:58 +0200149</p>
150
Brian Paul0b27ace2003-03-08 17:38:57 +0000151
Andreas Boll210a27d2012-06-12 09:05:36 +0200152<h2>Making a New Mesa Release</h2>
Brian Paul0b27ace2003-03-08 17:38:57 +0000153
154<p>
155These are the instructions for making a new Mesa release.
156</p>
157
Andreas Boll210a27d2012-06-12 09:05:36 +0200158<h3>Get latest source files</h3>
Brian Paul0b27ace2003-03-08 17:38:57 +0000159<p>
Brian Paul84c5e482009-06-23 19:21:04 -0600160Use git to get the latest Mesa files from the git repository, from whatever
161branch is relevant.
Brian Paul0b27ace2003-03-08 17:38:57 +0000162</p>
163
Brian Paul0b27ace2003-03-08 17:38:57 +0000164
Andreas Boll210a27d2012-06-12 09:05:36 +0200165<h3>Verify and update version info</h3>
Brian Paul0b27ace2003-03-08 17:38:57 +0000166<p>
Brian Paul84c5e482009-06-23 19:21:04 -0600167Create/edit the docs/relnotes-x.y.html file to document what's new in the release.
168Add the new relnotes-x.y.html file to <a href="relnotes.html">relnotes.html</a>.
Brian Paul0b27ace2003-03-08 17:38:57 +0000169</p>
170
171<p>
Brian Paul84c5e482009-06-23 19:21:04 -0600172Update the MESA_MAJOR, MESA_MINOR and MESA_TINY version numbers in
Dan Nicholson00994ac2008-04-30 15:06:00 -0700173configs/default.
Brian Paul84c5e482009-06-23 19:21:04 -0600174Also update the VERSION line in the top-level Makefile.
Brian Paul0b27ace2003-03-08 17:38:57 +0000175</p>
176
177<p>
Dan Nicholson00994ac2008-04-30 15:06:00 -0700178Make sure the values in src/mesa/main/version.h are correct.
Brian Paul65b79052004-11-22 17:49:15 +0000179</p>
180
181<p>
Ian Romanick13a90e82010-06-16 14:24:46 -0700182Update docs/news.html.
Brian Paul65b79052004-11-22 17:49:15 +0000183</p>
184
185<p>
Brian Paul8031aa12012-06-14 12:17:31 -0600186Create a docs/relnotes-x.y.z.html file.
187The bin/shortlog_mesa.sh script can be used to create a HTML-formatted list
188of changes to include in the file.
189Link the new docs/relnotes-x.y.z.html file into the main relnotes.html file.
Brian Paul65b79052004-11-22 17:49:15 +0000190</p>
191
192<p>
Brian Paul84c5e482009-06-23 19:21:04 -0600193Tag the files with the release name (in the form <b>mesa_X_Y</b>)
194with: <code>git tag -a mesa_X_Y</code>
195Then: <code>git push origin mesa_X_Y</code>
Brian Paul65b79052004-11-22 17:49:15 +0000196</p>
197
198
Andreas Boll210a27d2012-06-12 09:05:36 +0200199<h3>Make the tarballs</h3>
Brian Paul65b79052004-11-22 17:49:15 +0000200<p>
Brian Paul0b27ace2003-03-08 17:38:57 +0000201Make the distribution files. From inside the Mesa directory:
202<pre>
Brian Paul9cef3ef2004-10-02 15:43:14 +0000203 make tarballs
Brian Paul0b27ace2003-03-08 17:38:57 +0000204</pre>
205
206<p>
Brian Paul65b79052004-11-22 17:49:15 +0000207After the tarballs are created, the md5 checksums for the files will
208be computed.
Brian Paul84c5e482009-06-23 19:21:04 -0600209Add them to the docs/relnotes-X.Y.html file.
Brian Paul65b79052004-11-22 17:49:15 +0000210</p>
211
212<p>
Brian Paul0b27ace2003-03-08 17:38:57 +0000213Copy the distribution files to a temporary directory, unpack them,
214compile everything, and run some demos to be sure everything works.
215</p>
216
Andreas Boll210a27d2012-06-12 09:05:36 +0200217<h3>Update the website and announce the release</h3>
Brian Paul0b27ace2003-03-08 17:38:57 +0000218<p>
Brian Paul65b79052004-11-22 17:49:15 +0000219Follow the directions on SourceForge for creating a new "release" and
220uploading the tarballs.
Brian Paul0b27ace2003-03-08 17:38:57 +0000221</p>
222
223<p>
Brian Paul84c5e482009-06-23 19:21:04 -0600224Basically, to upload the tarball files with:
225<br>
226<code>
227rsync -avP ssh Mesa*-X.Y.* USERNAME@frs.sourceforge.net:uploads/
228</code>
229</p>
230
231<p>
Brian Paul65b79052004-11-22 17:49:15 +0000232Update the web site by copying the docs/ directory's files to
Brian Paul84c5e482009-06-23 19:21:04 -0600233/home/users/b/br/brianp/mesa-www/htdocs/ with:
234<br>
235<code>
236sftp USERNAME,mesa3d@web.sourceforge.net
237</code>
Brian Paul0b27ace2003-03-08 17:38:57 +0000238</p>
239
240<p>
Brian Paulefe56712003-03-19 19:15:28 +0000241Make an announcement on the mailing lists:
Ian Romanick8f32c642010-06-16 14:28:08 -0700242
243<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>,
244<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>
Brian Paulefe56712003-03-19 19:15:28 +0000245and
Ian Romanick8f32c642010-06-16 14:28:08 -0700246<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>
Brian Paul0b27ace2003-03-08 17:38:57 +0000247</p>
248
Brian Paul0b27ace2003-03-08 17:38:57 +0000249</body>
250</html>