blob: 0f1d5ac612b6698f53d05d60fc782cb3e0aa3691 [file] [log] [blame]
Andreas Bollecd5c7c2012-06-12 09:05:03 +02001<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2<html lang="en">
3<head>
4 <meta http-equiv="content-type" content="text/html; charset=utf-8">
5 <title>Development Notes</title>
6 <link rel="stylesheet" type="text/css" href="mesa.css">
7</head>
8<body>
Brian Paul0b27ace2003-03-08 17:38:57 +00009
Andreas Bollb5da52a2012-09-18 18:57:02 +020010<div class="header">
Erik Faye-Lundecdab0d2019-05-06 13:26:47 +020011 The Mesa 3D Graphics Library
Andreas Bollb5da52a2012-09-18 18:57:02 +020012</div>
13
14<iframe src="contents.html"></iframe>
15<div class="content">
16
Andreas Bollecd5c7c2012-06-12 09:05:03 +020017<h1>Development Notes</h1>
Brian Paul0b27ace2003-03-08 17:38:57 +000018
19
Brian Paul51830612004-08-17 14:08:59 +000020<ul>
Brian Paul98f2f472015-05-25 09:13:09 -060021<li><a href="#extensions">Adding Extensions</a>
Brian Paul51830612004-08-17 14:08:59 +000022</ul>
Brian Paul0b27ace2003-03-08 17:38:57 +000023
Brian Paul98f2f472015-05-25 09:13:09 -060024<h2 id="extensions">Adding Extensions</h2>
25
26<p>
27To add a new GL extension to Mesa you have to do at least the following.
Erik Faye-Lund92917e82019-04-18 15:38:01 +020028</p>
Brian Paul98f2f472015-05-25 09:13:09 -060029
30<ul>
31<li>
Erik Faye-Lund392c0832019-05-28 13:14:03 +020032 If <code>glext.h</code> doesn't define the extension, edit
33 <code>include/GL/gl.h</code> and add code like this:
Brian Paul98f2f472015-05-25 09:13:09 -060034 <pre>
35 #ifndef GL_EXT_the_extension_name
36 #define GL_EXT_the_extension_name 1
37 /* declare the new enum tokens */
38 /* prototype the new functions */
39 /* TYPEDEFS for the new functions */
40 #endif
41 </pre>
42</li>
43<li>
Erik Faye-Lund392c0832019-05-28 13:14:03 +020044 In the <code>src/mapi/glapi/gen/</code> directory, add the new extension
45 functions and enums to the <code>gl_API.xml</code> file.
Brian Paul98f2f472015-05-25 09:13:09 -060046 Then, a bunch of source files must be regenerated by executing the
47 corresponding Python scripts.
48</li>
49<li>
Erik Faye-Lund392c0832019-05-28 13:14:03 +020050 Add a new entry to the <code>gl_extensions</code> struct in
51 <code>mtypes.h</code> if the extension requires driver capabilities not
52 already exposed by another extension.
Brian Paul98f2f472015-05-25 09:13:09 -060053</li>
54<li>
Erik Faye-Lund392c0832019-05-28 13:14:03 +020055 Add a new entry to the <code>src/mesa/main/extensions_table.h</code> file.
Brian Paul98f2f472015-05-25 09:13:09 -060056</li>
57<li>
58 From this point, the best way to proceed is to find another extension,
59 similar to the new one, that's already implemented in Mesa and use it
60 as an example.
61</li>
62<li>
Erik Faye-Lund205f9602019-06-06 10:16:36 +020063 If the new extension adds new GL state, the functions in
64 <code>get.c</code>, <code>enable.c</code> and <code>attrib.c</code>
65 will most likely require new code.
Brian Paul98f2f472015-05-25 09:13:09 -060066</li>
67<li>
Nanley Cheryb7a0c0e2016-06-03 10:59:18 -070068 To determine if the new extension is active in the current context,
Erik Faye-Lund392c0832019-05-28 13:14:03 +020069 use the auto-generated <code>_mesa_has_##name_str()</code> function
70 defined in <code>src/mesa/main/extensions.h</code>.
Nanley Cheryb7a0c0e2016-06-03 10:59:18 -070071</li>
72<li>
Erik Faye-Lund205f9602019-06-06 10:16:36 +020073 The dispatch tests <code>check_table.cpp</code> and
74 <code>dispatch_sanity.cpp</code> should be updated with details about
75 the new extensions functions. These tests are run using
76 <code>meson test</code>.
Brian Paul98f2f472015-05-25 09:13:09 -060077</li>
78</ul>
79
80
81
82
Andreas Bollb5da52a2012-09-18 18:57:02 +020083</div>
Brian Paul0b27ace2003-03-08 17:38:57 +000084</body>
85</html>