Erik Faye-Lund | 4d06683 | 2020-06-12 20:09:42 +0200 | [diff] [blame] | 1 | Development Notes |
| 2 | ================= |
| 3 | |
Erik Faye-Lund | 4d06683 | 2020-06-12 20:09:42 +0200 | [diff] [blame] | 4 | Adding Extensions |
| 5 | ----------------- |
| 6 | |
| 7 | To 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-Lund | d6be994 | 2019-06-04 14:14:13 +0200 | [diff] [blame] | 12 | .. code-block:: c |
Erik Faye-Lund | 4d06683 | 2020-06-12 20:09:42 +0200 | [diff] [blame] | 13 | |
| 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``. |