4e06bbf7e79728b538628240d07ddb9e32f21080
[mesa.git] / docs / devinfo.rst
1 Development Notes
2 =================
3
4 - `Adding Extensions <#extensions>`__
5
6 .. _extensions:
7
8 Adding Extensions
9 -----------------
10
11 To add a new GL extension to Mesa you have to do at least the following.
12
13 - If ``glext.h`` doesn't define the extension, edit ``include/GL/gl.h``
14 and add code like this:
15
16 ::
17
18 #ifndef GL_EXT_the_extension_name
19 #define GL_EXT_the_extension_name 1
20 /* declare the new enum tokens */
21 /* prototype the new functions */
22 /* TYPEDEFS for the new functions */
23 #endif
24
25
26 - In the ``src/mapi/glapi/gen/`` directory, add the new extension
27 functions and enums to the ``gl_API.xml`` file. Then, a bunch of
28 source files must be regenerated by executing the corresponding
29 Python scripts.
30 - Add a new entry to the ``gl_extensions`` struct in ``mtypes.h`` if
31 the extension requires driver capabilities not already exposed by
32 another extension.
33 - Add a new entry to the ``src/mesa/main/extensions_table.h`` file.
34 - From this point, the best way to proceed is to find another
35 extension, similar to the new one, that's already implemented in Mesa
36 and use it as an example.
37 - If the new extension adds new GL state, the functions in ``get.c``,
38 ``enable.c`` and ``attrib.c`` will most likely require new code.
39 - To determine if the new extension is active in the current context,
40 use the auto-generated ``_mesa_has_##name_str()`` function defined in
41 ``src/mesa/main/extensions.h``.
42 - The dispatch tests ``check_table.cpp`` and ``dispatch_sanity.cpp``
43 should be updated with details about the new extensions functions.
44 These tests are run using ``meson test``.