1848b8605Smrg<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2848b8605Smrg<html lang="en">
3848b8605Smrg<head>
4848b8605Smrg  <meta http-equiv="content-type" content="text/html; charset=utf-8">
5848b8605Smrg  <title>Development Notes</title>
6848b8605Smrg  <link rel="stylesheet" type="text/css" href="mesa.css">
7848b8605Smrg</head>
8848b8605Smrg<body>
9848b8605Smrg
10848b8605Smrg<div class="header">
11848b8605Smrg  <h1>The Mesa 3D Graphics Library</h1>
12848b8605Smrg</div>
13848b8605Smrg
14848b8605Smrg<iframe src="contents.html"></iframe>
15848b8605Smrg<div class="content">
16848b8605Smrg
17848b8605Smrg<h1>Development Notes</h1>
18848b8605Smrg
19848b8605Smrg
20b8e80941Smrg<ul>
21b8e80941Smrg<li><a href="#extensions">Adding Extensions</a>
22b8e80941Smrg</ul>
23b8e80941Smrg
24b8e80941Smrg<h2 id="extensions">Adding Extensions</h2>
25848b8605Smrg
26848b8605Smrg<p>
27848b8605SmrgTo add a new GL extension to Mesa you have to do at least the following.
28b8e80941Smrg</p>
29848b8605Smrg
30848b8605Smrg<ul>
31848b8605Smrg<li>
32848b8605Smrg   If glext.h doesn't define the extension, edit include/GL/gl.h and add
33848b8605Smrg   code like this:
34848b8605Smrg   <pre>
35848b8605Smrg     #ifndef GL_EXT_the_extension_name
36848b8605Smrg     #define GL_EXT_the_extension_name 1
37848b8605Smrg     /* declare the new enum tokens */
38848b8605Smrg     /* prototype the new functions */
39848b8605Smrg     /* TYPEDEFS for the new functions */
40848b8605Smrg     #endif
41848b8605Smrg   </pre>
42848b8605Smrg</li>
43848b8605Smrg<li>
44848b8605Smrg   In the src/mapi/glapi/gen/ directory, add the new extension functions and
45848b8605Smrg   enums to the gl_API.xml file.
46848b8605Smrg   Then, a bunch of source files must be regenerated by executing the
47848b8605Smrg   corresponding Python scripts.
48848b8605Smrg</li>
49848b8605Smrg<li>
50848b8605Smrg   Add a new entry to the <code>gl_extensions</code> struct in mtypes.h
51b8e80941Smrg   if the extension requires driver capabilities not already exposed by
52b8e80941Smrg   another extension.
53848b8605Smrg</li>
54848b8605Smrg<li>
55b8e80941Smrg   Add a new entry to the src/mesa/main/extensions_table.h file.
56848b8605Smrg</li>
57848b8605Smrg<li>
58848b8605Smrg   From this point, the best way to proceed is to find another extension,
59848b8605Smrg   similar to the new one, that's already implemented in Mesa and use it
60848b8605Smrg   as an example.
61848b8605Smrg</li>
62848b8605Smrg<li>
63848b8605Smrg   If the new extension adds new GL state, the functions in get.c, enable.c
64848b8605Smrg   and attrib.c will most likely require new code.
65848b8605Smrg</li>
66b8e80941Smrg<li>
67b8e80941Smrg   To determine if the new extension is active in the current context,
68b8e80941Smrg   use the auto-generated _mesa_has_##name_str() function defined in
69b8e80941Smrg   src/mesa/main/extensions.h.
70b8e80941Smrg</li>
71848b8605Smrg<li>
72848b8605Smrg   The dispatch tests check_table.cpp and dispatch_sanity.cpp
73848b8605Smrg   should be updated with details about the new extensions functions. These
74b8e80941Smrg   tests are run using 'meson test'
75848b8605Smrg</li>
76848b8605Smrg</ul>
77848b8605Smrg
78848b8605Smrg
79848b8605Smrg
80848b8605Smrg
81848b8605Smrg</div>
82848b8605Smrg</body>
83848b8605Smrg</html>
84