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