blob: c0966480ab7a2fe1f5b4e25aa60474b11c18cb63 [file] [log] [blame]
Brian Paul0b27ace2003-03-08 17:38:57 +00001<HTML>
2
3<TITLE>Development Notes</TITLE>
4
Brian Paul36da0452005-01-20 03:55:10 +00005<link rel="stylesheet" type="text/css" href="mesa.css"></head>
6
7<BODY>
Brian Paul0b27ace2003-03-08 17:38:57 +00008
9<H1>Development Notes</H1>
10
11
12<H2>Adding Extentions</H2>
13
14<p>
Brian Paul51830612004-08-17 14:08:59 +000015To add a new GL extension to Mesa you have to do at least the following.
Brian Paul0b27ace2003-03-08 17:38:57 +000016
Brian Paul51830612004-08-17 14:08:59 +000017<ul>
18<li>
19 If glext.h doesn't define the extension, edit include/GL/gl.h and add
20 code like this:
21 <pre>
22 #ifndef GL_EXT_the_extension_name
23 #define GL_EXT_the_extension_name 1
24 /* declare the new enum tokens */
25 /* prototype the new functions */
26 /* TYPEDEFS for the new functions */
27 #endif
28 </pre>
29</li>
30<li>
31 In the src/mesa/glapi/ directory, add the new extension functions and
32 enums to the gl_API.xml file.
33 Then, a bunch of source files must be regenerated by executing the
34 corresponding Python scripts.
35</li>
36<li>
Brian Paulbb086292006-09-21 22:53:15 +000037 Add a new entry to the <code>gl_extensions</code> struct in mtypes.h
38</li>
39<li>
40 Update the <code>extensions.c</code> file.
41</li>
42<li>
43 From this point, the best way to proceed is to find another extension,
44 similar to the new one, that's already implemented in Mesa and use it
45 as an example.
Brian Paul51830612004-08-17 14:08:59 +000046</li>
47<li>
Brian Paul65b79052004-11-22 17:49:15 +000048 If the new extension adds new GL state, the functions in get.c, enable.c
Brian Paul51830612004-08-17 14:08:59 +000049 and attrib.c will most likely require new code.
50</li>
51</ul>
Brian Paul0b27ace2003-03-08 17:38:57 +000052
53
54
55<H2>Coding Style</H2>
56
57<p>
58Mesa's code style has changed over the years. Here's the latest.
59</p>
60
61<p>
62Comment your code! It's extremely important that open-source code be
63well documented. Also, strive to write clean, easily understandable code.
64</p>
65
66<p>
673-space indentation
68</p>
69
70<p>
71If you use tabs, set them to 8 columns
72</p>
73
74<p>
Paul Berry43968262011-08-16 14:09:32 -070075Line width: the preferred width to fill comments and code in Mesa is 78
76columns. Exceptions are sometimes made for clarity (e.g. tabular data is
77sometimes filled to a much larger width so that extraneous carriage returns
78don't obscure the table).
79</p>
80
81<p>
Brian Paul0b27ace2003-03-08 17:38:57 +000082Brace example:
83</p>
84<pre>
85 if (condition) {
86 foo;
87 }
88 else {
89 bar;
90 }
Paul Berry43968262011-08-16 14:09:32 -070091
92 switch (condition) {
93 case 0:
94 foo();
95 break;
96
97 case 1: {
98 ...
99 break;
100 }
101
102 default:
103 ...
104 break;
105 }
Brian Paul0b27ace2003-03-08 17:38:57 +0000106</pre>
107
108<p>
109Here's the GNU indent command which will best approximate my preferred style:
Paul Berry43968262011-08-16 14:09:32 -0700110(Note that it won't format switch statements in the preferred way)
Brian Paul0b27ace2003-03-08 17:38:57 +0000111</p>
112<pre>
Brian Paule3f41ce2006-03-31 23:10:21 +0000113 indent -br -i3 -npcs --no-tabs infile.c -o outfile.c
Brian Paul0b27ace2003-03-08 17:38:57 +0000114</pre>
115
116
117<p>
118Local variable name example: localVarName (no underscores)
119</p>
120
121<p>
122Constants and macros are ALL_UPPERCASE, with _ between words
123</p>
124
125<p>
Brian Paul65b79052004-11-22 17:49:15 +0000126Global variables are not allowed.
Brian Paul0b27ace2003-03-08 17:38:57 +0000127</p>
128
129<p>
130Function name examples:
131</p>
132<pre>
Chia-I Wu27d260b42010-02-24 11:20:14 +0800133 glFooBar() - a public GL entry point (in glapi_dispatch.c)
Brian Paul0b27ace2003-03-08 17:38:57 +0000134 _mesa_FooBar() - the internal immediate mode function
135 save_FooBar() - retained mode (display list) function in dlist.c
136 foo_bar() - a static (private) function
137 _mesa_foo_bar() - an internal non-static Mesa function
138</pre>
139
140
Brian Paul0b27ace2003-03-08 17:38:57 +0000141<H2>Making a New Mesa Release</H2>
142
143<p>
144These are the instructions for making a new Mesa release.
145</p>
146
Brian Paul65b79052004-11-22 17:49:15 +0000147<H3>Get latest source files</H3>
Brian Paul0b27ace2003-03-08 17:38:57 +0000148<p>
Brian Paul84c5e482009-06-23 19:21:04 -0600149Use git to get the latest Mesa files from the git repository, from whatever
150branch is relevant.
Brian Paul0b27ace2003-03-08 17:38:57 +0000151</p>
152
Brian Paul0b27ace2003-03-08 17:38:57 +0000153
Brian Paul65b79052004-11-22 17:49:15 +0000154<H3>Verify and update version info</H3>
Brian Paul0b27ace2003-03-08 17:38:57 +0000155<p>
Brian Paul84c5e482009-06-23 19:21:04 -0600156Create/edit the docs/relnotes-x.y.html file to document what's new in the release.
157Add the new relnotes-x.y.html file to <a href="relnotes.html">relnotes.html</a>.
Brian Paul0b27ace2003-03-08 17:38:57 +0000158</p>
159
160<p>
Brian Paul84c5e482009-06-23 19:21:04 -0600161Update the MESA_MAJOR, MESA_MINOR and MESA_TINY version numbers in
Dan Nicholson00994ac2008-04-30 15:06:00 -0700162configs/default.
Brian Paul84c5e482009-06-23 19:21:04 -0600163Also update the VERSION line in the top-level Makefile.
Brian Paul0b27ace2003-03-08 17:38:57 +0000164</p>
165
166<p>
Dan Nicholson00994ac2008-04-30 15:06:00 -0700167Make sure the values in src/mesa/main/version.h are correct.
Brian Paul65b79052004-11-22 17:49:15 +0000168</p>
169
170<p>
Ian Romanick13a90e82010-06-16 14:24:46 -0700171Update docs/news.html.
Brian Paul65b79052004-11-22 17:49:15 +0000172</p>
173
174<p>
Brian Paul84c5e482009-06-23 19:21:04 -0600175Check in all updates to git.
Brian Paul65b79052004-11-22 17:49:15 +0000176</p>
177
178<p>
Brian Paul84c5e482009-06-23 19:21:04 -0600179Tag the files with the release name (in the form <b>mesa_X_Y</b>)
180with: <code>git tag -a mesa_X_Y</code>
181Then: <code>git push origin mesa_X_Y</code>
Brian Paul65b79052004-11-22 17:49:15 +0000182</p>
183
184
185<H3>Make the tarballs</H3>
186<p>
Brian Paul0b27ace2003-03-08 17:38:57 +0000187Make the distribution files. From inside the Mesa directory:
188<pre>
Brian Paul9cef3ef2004-10-02 15:43:14 +0000189 make tarballs
Brian Paul0b27ace2003-03-08 17:38:57 +0000190</pre>
191
192<p>
Brian Paul65b79052004-11-22 17:49:15 +0000193After the tarballs are created, the md5 checksums for the files will
194be computed.
Brian Paul84c5e482009-06-23 19:21:04 -0600195Add them to the docs/relnotes-X.Y.html file.
Brian Paul65b79052004-11-22 17:49:15 +0000196</p>
197
198<p>
Brian Paul0b27ace2003-03-08 17:38:57 +0000199Copy the distribution files to a temporary directory, unpack them,
200compile everything, and run some demos to be sure everything works.
201</p>
202
Brian Paul65b79052004-11-22 17:49:15 +0000203<H3>Update the website and announce the release</H3>
Brian Paul0b27ace2003-03-08 17:38:57 +0000204<p>
Brian Paul65b79052004-11-22 17:49:15 +0000205Follow the directions on SourceForge for creating a new "release" and
206uploading the tarballs.
Brian Paul0b27ace2003-03-08 17:38:57 +0000207</p>
208
209<p>
Brian Paul84c5e482009-06-23 19:21:04 -0600210Basically, to upload the tarball files with:
211<br>
212<code>
213rsync -avP ssh Mesa*-X.Y.* USERNAME@frs.sourceforge.net:uploads/
214</code>
215</p>
216
217<p>
Brian Paul65b79052004-11-22 17:49:15 +0000218Update the web site by copying the docs/ directory's files to
Brian Paul84c5e482009-06-23 19:21:04 -0600219/home/users/b/br/brianp/mesa-www/htdocs/ with:
220<br>
221<code>
222sftp USERNAME,mesa3d@web.sourceforge.net
223</code>
Brian Paul0b27ace2003-03-08 17:38:57 +0000224</p>
225
226<p>
Brian Paulefe56712003-03-19 19:15:28 +0000227Make an announcement on the mailing lists:
Ian Romanick8f32c642010-06-16 14:28:08 -0700228
229<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>,
230<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 +0000231and
Ian Romanick8f32c642010-06-16 14:28:08 -0700232<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 +0000233</p>
234
235
Brian Paul0b27ace2003-03-08 17:38:57 +0000236
237</body>
238</html>