Brian Paul | 0b27ace | 2003-03-08 17:38:57 +0000 | [diff] [blame] | 1 | <HTML> |
| 2 | |
| 3 | <TITLE>Development Notes</TITLE> |
| 4 | |
Brian Paul | 36da045 | 2005-01-20 03:55:10 +0000 | [diff] [blame] | 5 | <link rel="stylesheet" type="text/css" href="mesa.css"></head> |
| 6 | |
| 7 | <BODY> |
Brian Paul | 0b27ace | 2003-03-08 17:38:57 +0000 | [diff] [blame] | 8 | |
| 9 | <H1>Development Notes</H1> |
| 10 | |
| 11 | |
| 12 | <H2>Adding Extentions</H2> |
| 13 | |
| 14 | <p> |
Brian Paul | 5183061 | 2004-08-17 14:08:59 +0000 | [diff] [blame] | 15 | To add a new GL extension to Mesa you have to do at least the following. |
Brian Paul | 0b27ace | 2003-03-08 17:38:57 +0000 | [diff] [blame] | 16 | |
Brian Paul | 5183061 | 2004-08-17 14:08:59 +0000 | [diff] [blame] | 17 | <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 Paul | bb08629 | 2006-09-21 22:53:15 +0000 | [diff] [blame] | 37 | 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 Paul | 5183061 | 2004-08-17 14:08:59 +0000 | [diff] [blame] | 46 | </li> |
| 47 | <li> |
Brian Paul | 65b7905 | 2004-11-22 17:49:15 +0000 | [diff] [blame] | 48 | If the new extension adds new GL state, the functions in get.c, enable.c |
Brian Paul | 5183061 | 2004-08-17 14:08:59 +0000 | [diff] [blame] | 49 | and attrib.c will most likely require new code. |
| 50 | </li> |
| 51 | </ul> |
Brian Paul | 0b27ace | 2003-03-08 17:38:57 +0000 | [diff] [blame] | 52 | |
| 53 | |
| 54 | |
| 55 | <H2>Coding Style</H2> |
| 56 | |
| 57 | <p> |
| 58 | Mesa's code style has changed over the years. Here's the latest. |
| 59 | </p> |
| 60 | |
| 61 | <p> |
| 62 | Comment your code! It's extremely important that open-source code be |
| 63 | well documented. Also, strive to write clean, easily understandable code. |
| 64 | </p> |
| 65 | |
| 66 | <p> |
| 67 | 3-space indentation |
| 68 | </p> |
| 69 | |
| 70 | <p> |
| 71 | If you use tabs, set them to 8 columns |
| 72 | </p> |
| 73 | |
| 74 | <p> |
Paul Berry | 4396826 | 2011-08-16 14:09:32 -0700 | [diff] [blame] | 75 | Line width: the preferred width to fill comments and code in Mesa is 78 |
| 76 | columns. Exceptions are sometimes made for clarity (e.g. tabular data is |
| 77 | sometimes filled to a much larger width so that extraneous carriage returns |
| 78 | don't obscure the table). |
| 79 | </p> |
| 80 | |
| 81 | <p> |
Brian Paul | 0b27ace | 2003-03-08 17:38:57 +0000 | [diff] [blame] | 82 | Brace example: |
| 83 | </p> |
| 84 | <pre> |
| 85 | if (condition) { |
| 86 | foo; |
| 87 | } |
| 88 | else { |
| 89 | bar; |
| 90 | } |
Paul Berry | 4396826 | 2011-08-16 14:09:32 -0700 | [diff] [blame] | 91 | |
| 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 Paul | 0b27ace | 2003-03-08 17:38:57 +0000 | [diff] [blame] | 106 | </pre> |
| 107 | |
| 108 | <p> |
| 109 | Here's the GNU indent command which will best approximate my preferred style: |
Paul Berry | 4396826 | 2011-08-16 14:09:32 -0700 | [diff] [blame] | 110 | (Note that it won't format switch statements in the preferred way) |
Brian Paul | 0b27ace | 2003-03-08 17:38:57 +0000 | [diff] [blame] | 111 | </p> |
| 112 | <pre> |
Brian Paul | e3f41ce | 2006-03-31 23:10:21 +0000 | [diff] [blame] | 113 | indent -br -i3 -npcs --no-tabs infile.c -o outfile.c |
Brian Paul | 0b27ace | 2003-03-08 17:38:57 +0000 | [diff] [blame] | 114 | </pre> |
| 115 | |
| 116 | |
| 117 | <p> |
| 118 | Local variable name example: localVarName (no underscores) |
| 119 | </p> |
| 120 | |
| 121 | <p> |
| 122 | Constants and macros are ALL_UPPERCASE, with _ between words |
| 123 | </p> |
| 124 | |
| 125 | <p> |
Brian Paul | 65b7905 | 2004-11-22 17:49:15 +0000 | [diff] [blame] | 126 | Global variables are not allowed. |
Brian Paul | 0b27ace | 2003-03-08 17:38:57 +0000 | [diff] [blame] | 127 | </p> |
| 128 | |
| 129 | <p> |
| 130 | Function name examples: |
| 131 | </p> |
| 132 | <pre> |
Chia-I Wu | 27d260b4 | 2010-02-24 11:20:14 +0800 | [diff] [blame] | 133 | glFooBar() - a public GL entry point (in glapi_dispatch.c) |
Brian Paul | 0b27ace | 2003-03-08 17:38:57 +0000 | [diff] [blame] | 134 | _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 | |
Kai Wasserbäch | dbec3a5 | 2011-08-23 10:48:58 +0200 | [diff] [blame] | 140 | <p> |
| 141 | Places that are not directly visible to the GL API should prefer the use |
| 142 | of <tt>bool</tt>, <tt>true</tt>, and |
| 143 | <tt>false</tt> over <tt>GLboolean</tt>, <tt>GL_TRUE</tt>, and |
| 144 | <tt>GL_FALSE</tt>. In C code, this may mean that |
Kai Wasserbäch | e106d4c | 2011-08-27 17:51:47 +0200 | [diff] [blame^] | 145 | <tt>#include <stdbool.h></tt> needs to be added. The |
Kai Wasserbäch | dbec3a5 | 2011-08-23 10:48:58 +0200 | [diff] [blame] | 146 | <tt>try_emit_</tt>* methods in src/mesa/program/ir_to_mesa.cpp and |
Kai Wasserbäch | e106d4c | 2011-08-27 17:51:47 +0200 | [diff] [blame^] | 147 | src/mesa/state_tracker/st_glsl_to_tgsi.cpp can serve as examples. |
Kai Wasserbäch | dbec3a5 | 2011-08-23 10:48:58 +0200 | [diff] [blame] | 148 | </p> |
| 149 | |
Brian Paul | 0b27ace | 2003-03-08 17:38:57 +0000 | [diff] [blame] | 150 | |
Brian Paul | 0b27ace | 2003-03-08 17:38:57 +0000 | [diff] [blame] | 151 | <H2>Making a New Mesa Release</H2> |
| 152 | |
| 153 | <p> |
| 154 | These are the instructions for making a new Mesa release. |
| 155 | </p> |
| 156 | |
Brian Paul | 65b7905 | 2004-11-22 17:49:15 +0000 | [diff] [blame] | 157 | <H3>Get latest source files</H3> |
Brian Paul | 0b27ace | 2003-03-08 17:38:57 +0000 | [diff] [blame] | 158 | <p> |
Brian Paul | 84c5e48 | 2009-06-23 19:21:04 -0600 | [diff] [blame] | 159 | Use git to get the latest Mesa files from the git repository, from whatever |
| 160 | branch is relevant. |
Brian Paul | 0b27ace | 2003-03-08 17:38:57 +0000 | [diff] [blame] | 161 | </p> |
| 162 | |
Brian Paul | 0b27ace | 2003-03-08 17:38:57 +0000 | [diff] [blame] | 163 | |
Brian Paul | 65b7905 | 2004-11-22 17:49:15 +0000 | [diff] [blame] | 164 | <H3>Verify and update version info</H3> |
Brian Paul | 0b27ace | 2003-03-08 17:38:57 +0000 | [diff] [blame] | 165 | <p> |
Brian Paul | 84c5e48 | 2009-06-23 19:21:04 -0600 | [diff] [blame] | 166 | Create/edit the docs/relnotes-x.y.html file to document what's new in the release. |
| 167 | Add the new relnotes-x.y.html file to <a href="relnotes.html">relnotes.html</a>. |
Brian Paul | 0b27ace | 2003-03-08 17:38:57 +0000 | [diff] [blame] | 168 | </p> |
| 169 | |
| 170 | <p> |
Brian Paul | 84c5e48 | 2009-06-23 19:21:04 -0600 | [diff] [blame] | 171 | Update the MESA_MAJOR, MESA_MINOR and MESA_TINY version numbers in |
Dan Nicholson | 00994ac | 2008-04-30 15:06:00 -0700 | [diff] [blame] | 172 | configs/default. |
Brian Paul | 84c5e48 | 2009-06-23 19:21:04 -0600 | [diff] [blame] | 173 | Also update the VERSION line in the top-level Makefile. |
Brian Paul | 0b27ace | 2003-03-08 17:38:57 +0000 | [diff] [blame] | 174 | </p> |
| 175 | |
| 176 | <p> |
Dan Nicholson | 00994ac | 2008-04-30 15:06:00 -0700 | [diff] [blame] | 177 | Make sure the values in src/mesa/main/version.h are correct. |
Brian Paul | 65b7905 | 2004-11-22 17:49:15 +0000 | [diff] [blame] | 178 | </p> |
| 179 | |
| 180 | <p> |
Ian Romanick | 13a90e8 | 2010-06-16 14:24:46 -0700 | [diff] [blame] | 181 | Update docs/news.html. |
Brian Paul | 65b7905 | 2004-11-22 17:49:15 +0000 | [diff] [blame] | 182 | </p> |
| 183 | |
| 184 | <p> |
Brian Paul | 84c5e48 | 2009-06-23 19:21:04 -0600 | [diff] [blame] | 185 | Check in all updates to git. |
Brian Paul | 65b7905 | 2004-11-22 17:49:15 +0000 | [diff] [blame] | 186 | </p> |
| 187 | |
| 188 | <p> |
Brian Paul | 84c5e48 | 2009-06-23 19:21:04 -0600 | [diff] [blame] | 189 | Tag the files with the release name (in the form <b>mesa_X_Y</b>) |
| 190 | with: <code>git tag -a mesa_X_Y</code> |
| 191 | Then: <code>git push origin mesa_X_Y</code> |
Brian Paul | 65b7905 | 2004-11-22 17:49:15 +0000 | [diff] [blame] | 192 | </p> |
| 193 | |
| 194 | |
| 195 | <H3>Make the tarballs</H3> |
| 196 | <p> |
Brian Paul | 0b27ace | 2003-03-08 17:38:57 +0000 | [diff] [blame] | 197 | Make the distribution files. From inside the Mesa directory: |
| 198 | <pre> |
Brian Paul | 9cef3ef | 2004-10-02 15:43:14 +0000 | [diff] [blame] | 199 | make tarballs |
Brian Paul | 0b27ace | 2003-03-08 17:38:57 +0000 | [diff] [blame] | 200 | </pre> |
| 201 | |
| 202 | <p> |
Brian Paul | 65b7905 | 2004-11-22 17:49:15 +0000 | [diff] [blame] | 203 | After the tarballs are created, the md5 checksums for the files will |
| 204 | be computed. |
Brian Paul | 84c5e48 | 2009-06-23 19:21:04 -0600 | [diff] [blame] | 205 | Add them to the docs/relnotes-X.Y.html file. |
Brian Paul | 65b7905 | 2004-11-22 17:49:15 +0000 | [diff] [blame] | 206 | </p> |
| 207 | |
| 208 | <p> |
Brian Paul | 0b27ace | 2003-03-08 17:38:57 +0000 | [diff] [blame] | 209 | Copy the distribution files to a temporary directory, unpack them, |
| 210 | compile everything, and run some demos to be sure everything works. |
| 211 | </p> |
| 212 | |
Brian Paul | 65b7905 | 2004-11-22 17:49:15 +0000 | [diff] [blame] | 213 | <H3>Update the website and announce the release</H3> |
Brian Paul | 0b27ace | 2003-03-08 17:38:57 +0000 | [diff] [blame] | 214 | <p> |
Brian Paul | 65b7905 | 2004-11-22 17:49:15 +0000 | [diff] [blame] | 215 | Follow the directions on SourceForge for creating a new "release" and |
| 216 | uploading the tarballs. |
Brian Paul | 0b27ace | 2003-03-08 17:38:57 +0000 | [diff] [blame] | 217 | </p> |
| 218 | |
| 219 | <p> |
Brian Paul | 84c5e48 | 2009-06-23 19:21:04 -0600 | [diff] [blame] | 220 | Basically, to upload the tarball files with: |
| 221 | <br> |
| 222 | <code> |
| 223 | rsync -avP ssh Mesa*-X.Y.* USERNAME@frs.sourceforge.net:uploads/ |
| 224 | </code> |
| 225 | </p> |
| 226 | |
| 227 | <p> |
Brian Paul | 65b7905 | 2004-11-22 17:49:15 +0000 | [diff] [blame] | 228 | Update the web site by copying the docs/ directory's files to |
Brian Paul | 84c5e48 | 2009-06-23 19:21:04 -0600 | [diff] [blame] | 229 | /home/users/b/br/brianp/mesa-www/htdocs/ with: |
| 230 | <br> |
| 231 | <code> |
| 232 | sftp USERNAME,mesa3d@web.sourceforge.net |
| 233 | </code> |
Brian Paul | 0b27ace | 2003-03-08 17:38:57 +0000 | [diff] [blame] | 234 | </p> |
| 235 | |
| 236 | <p> |
Brian Paul | efe5671 | 2003-03-19 19:15:28 +0000 | [diff] [blame] | 237 | Make an announcement on the mailing lists: |
Ian Romanick | 8f32c64 | 2010-06-16 14:28:08 -0700 | [diff] [blame] | 238 | |
| 239 | <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>, |
| 240 | <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 Paul | efe5671 | 2003-03-19 19:15:28 +0000 | [diff] [blame] | 241 | and |
Ian Romanick | 8f32c64 | 2010-06-16 14:28:08 -0700 | [diff] [blame] | 242 | <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 Paul | 0b27ace | 2003-03-08 17:38:57 +0000 | [diff] [blame] | 243 | </p> |
| 244 | |
| 245 | |
Brian Paul | 0b27ace | 2003-03-08 17:38:57 +0000 | [diff] [blame] | 246 | |
| 247 | </body> |
| 248 | </html> |