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