Name |
Date |
Size |
#Lines |
LOC |
||
---|---|---|---|---|---|---|
.. | - | - | ||||
Genglvnd | D | 12-May-2024 | 122 | 5 | 3 | |
Makefile | D | 12-May-2024 | 1.9 KiB | 75 | 40 | |
README.adoc | D | 12-May-2024 | 1.1 KiB | 26 | 19 | |
README.md | D | 12-May-2024 | 1 KiB | 23 | 17 | |
genglvnd.py | D | 12-May-2024 | 24.2 KiB | 629 | 542 | |
genheaders.py | D | 12-May-2024 | 22.2 KiB | 578 | 491 | |
gl.xml | D | 12-May-2024 | 2.6 MiB | 47,424 | 46,868 | |
glx.xml | D | 12-May-2024 | 112.5 KiB | 2,208 | 2,119 | |
glxproto.reserved.txt | D | 12-May-2024 | 27.4 KiB | 730 | 623 | |
readme.tex | D | 12-May-2024 | 39 KiB | 1,051 | 807 | |
reg.py | D | 12-May-2024 | 52.7 KiB | 1,160 | 665 | |
registry.rnc | D | 12-May-2024 | 8.5 KiB | 290 | 273 | |
testesext.c | D | 12-May-2024 | 460 | 15 | 6 | |
testglext.c | D | 12-May-2024 | 725 | 28 | 17 | |
vendors.txt | D | 12-May-2024 | 2.4 KiB | 57 | 48 | |
wgl.xml | D | 12-May-2024 | 101.9 KiB | 1,989 | 1,931 | |
wgltypes.txt | D | 12-May-2024 | 7.1 KiB | 107 | 102 |
README.adoc
1// Copyright 2017-2021 The Khronos Group Inc. 2// SPDX-License-Identifier: CC-BY-4.0 3 4# OpenGL XML API Registry 5 6This directory contains the OpenGL, GLX, and WGL XML API registries, in 7gl.xml, glx.xml, and wgl.xml respectively. They are used to reserve 8enumerant ranges for vendors working on new extensions, to register 9extension interfaces when an extension is published, and to generate the 10Khronos-supplied header files in ../api . 11 12The canonical versions are always found in the master branch of the github 13repository at https://github.com/KhronosGroup/OpenGL-Registry 14 15The 'validate' Makefile target uses the 'jing' tool to confirm that each XML 16file is structurally valid and conforms to the registry schema in 17registry.rnc. The schema is described in detail in readme.pdf. 18 19The 'default' Makefile target generates updated headers in ../api/ from the 20XML files. 21 22Note that while there are targets for ../api/{gl.h,glx.h,wgl.h} in 23genglvnd.py and genheaders.py, these targets are not generated by default 24and are experimental. At present, you should use the versions of these 25headers shipped with your OS or IHV SDK. 26
README.md
1# OpenGL XML API Registry 2 3This directory contains the OpenGL, GLX, and WGL XML API registries, in 4gl.xml, glx.xml, and wgl.xml respectively. They are used to reserve 5enumerant ranges for vendors working on new extensions, to register 6extension interfaces when an extension is published, and to generate the 7Khronos-supplied header files in ../api . 8 9The canonical versions are always found in the master branch of the github 10repository at https://github.com/KhronosGroup/OpenGL-Registry 11 12The 'validate' Makefile target uses the 'jing' tool to confirm that each XML 13file is structurally valid and conforms to the registry schema in 14registry.rnc. The schema is described in detail in readme.pdf. 15 16The 'default' Makefile target generates updated headers in ../api/ from the 17XML files. 18 19Note that while there are targets for ../api/{gl.h,glx.h,wgl.h} in 20genglvnd.py and genheaders.py, these targets are not generated by default 21and are experimental. At present, you should use the versions of these 22headers shipped with your OS or IHV SDK. 23
readme.tex
1\documentclass{article} 2 3% Various packages of possible use. {index} creates problems for some reason. 4% \usepackage{index} 5\def\specpdftitle{The Khronos OpenGL API Registry Schema} 6\usepackage[pdftex,bookmarksnumbered=true,linktocpage,plainpages=false,pdftitle={\specpdftitle},colorlinks=true]{hyperref} 7\usepackage{amsmath,enumerate,epsfig,framed,mdframed,multicol,longtable,times,url} 8\usepackage[normalem]{ulem} 9% underscore allows use of _ instead of \_ in text. [strings] allows _ in file names 10\usepackage[strings]{underscore} 11\usepackage[breakwords,fit]{truncate} 12 13\makeatletter 14\makeatother 15\makeindex 16 17% Some commonly used abbreviations 18 19\def\code#1{{\tt #1}} 20\def\tag#1{{\tt <#1>\index{<#1>}}} 21\def\attr#1{{\tt #1\index{#1}}} 22 23\begin{document} 24 25\title{The Khronos OpenGL API Registry Schema} 26\author{Jon Leech} 27\date{Last updated 2020-10-27} 28\maketitle 29 30\begin{abstract} 31 32This document describes the Khronos OpenGL API Registry XML schema, and provides 33some additional information about using the registry and scripts to generate 34C header files. The underlying XML files and scripts, as well as headers 35generated from the current authoritative copy of the XML files, can be 36obtained from the OpenGL-Registry github repository at 37 38\begin{center} 39{\bf \href{https://github.com/KhronosGroup/OpenGL-Registry} 40 {https://github.com/KhronosGroup/OpenGL-Registry}} 41\end{center} 42 43\end{abstract} 44 45\tableofcontents 46 47\section{Introduction} 48 49The registry uses an XML representation of the API and a set of Python 3 50scripts to manipulate the XML, based on the lxml Python bindings. It comes 51with an XML schema and validator. Outside users are welcome to submit pull 52requests on github, although the XML schema itself is mature and unlikely to 53change at this point. 54 55Other APIs defined by Khronos, such as Vulkan and OpenXR, use a similar XML 56schema originally based on the OpenGL schema to describe those APIs. 57 58Some groups outside Khronos have their own XML based API descriptions, 59often used for additional purposes such as library code generators or 60extension loaders, and it may be desirable to construct XSLT or other 61translators between the schema. 62 63 64\section{Getting Started} 65 66Once the repository has been downloaded, if you're running 67in a Linux command-line environment and have Python 3, the lxml Python 68bindings, and libxml installed, you should just be able to invoke 69\code{make} and generate C/C++ header files for all the following 70targets: 71 72\begin{itemize} 73\item \code{GL/glext.h} - OpenGL 1.2 (and later) compatibility profile 74 API + extensions 75\item \code{GL/glcorearb.h} - OpenGL core profile API + extensions 76\item \code{GLES/gl.h} - OpenGL compatibility profile API 77\item \code{GLES/glext.h} - OpenGL ES 1.x extensions 78\item \code{GLES2/gl2.h} - OpenGL ES 2.x API 79\item \code{GLES2/gl2ext.h} - OpenGL ES 2.x extensions 80\item \code{GLES3/gl3.h} - OpenGL ES 3.x API 81\item \code{GL/glx.h} - GLX API 82\item \code{GL/glxext.h} - GLX 1.3 (and later) API + extensions 83\item \code{GL/wgl.h} - WGL API 84\item \code{GL/wglext.h} - WGL extensions 85\item \code{EGL/egl.h} - EGL (still being worked on) 86\end{itemize} 87 88Starting with the Makefile rules and inspecting the files \code{gl.xml}, 89\code{genheaders.py}, and \code{reg.py} will be necessary if you want to 90repurpose the registry for reasons other than header file generation, or 91to generate headers for languages other than C. 92 93If you're running in a Microsoft Windows, MaxOS X, or other non-Linux 94environment, there are equivalent versions of Python and GNU Make, although 95we haven't tested this ourselves. Feedback would be helpful. If you're using 96Windows 10, you should probably try to build in the Ubuntu Linux subsystem 97rather than older Unix emulation environments such as Cygwin. 98 99 100\subsection{Header Generation Script - \code{genheaders.py}} 101 102When generating header files using the \code{genheaders.py} script, an 103API name and profile name are required, as shown in the Makefile 104examples. Additionally, specific versions and extensions can be required 105or excluded. Based on this information, the generator script extracts 106the relevant interfaces and creates a C-language header file for them. 107\code{genheaders.py} contains predefined generator options for OpenGL compatibility 108and core profiles, OpenGL ES 1 / 2 / 3, GLX, and WGL headers. 109 110The generator script is intended to be generalizable to other languages 111by writing new generator classes. Such generators would have to rewrite 112the C types and definitions in the XML to something appropriate to their 113language. 114 115\subsection{Registry Processing Script - \code{reg.py}} 116 117Actual XML registry processing is done in \code{reg.py}, which contains 118several objects and methods for loading registries and extracting 119interfaces and extensions for use in header generation. There is some 120internal documentation in the form of comments although nothing more 121extensive exists yet, and it's possible the Python scripts will evolve 122significantly based on public feedback. 123 124 125\section{XML Registry Schema} 126\label{schema} 127 128The format of an XML registry is a top level \tag{registry} tag 129containing \tag{types}, \tag{enums}, \tag{commands}, \tag{feature}, and 130\tag{extension} tags describing the different elements of an API, as 131explained below. This description corresponds to a formal Relax NG 132schema file, \code{registry.rnc}, against which the XML registry files 133can be validated. 134 135At present there are separate registries for: 136 137\begin{itemize} 138\item OpenGL and OpenGL ES - \code{gl.xml} 139\item GLX - \code{glx.xml} 140\item WGL - \code{wgl.xml} 141\item EGL - \code{egl.xml} (still in development) 142\end{itemize} 143 144\subsection{Profiles} 145\label{schema:profile} 146 147Types and enumerants can have different definitions depending on the API 148profile requested, which allows us to accomodate minor incompatibilities 149in the OpenGL and OpenGL ES APIs, for example. Features and extensions 150can include some elements conditionally depending on the API profile 151requested. 152 153\subsection{API Names} 154\label{schema:apiname} 155 156Several tags use a \attr{api} attribute. This is an arbitrary string, 157specified at header generation time, for labelling properties of a 158specific API. The string can be, but is not necessarily, an actual API 159name. As used in \code{genheaders.py} and \code{gl.xml}, the API names 160are \code{gl}, \code{gles1}, and \code{gles2}, corresponding to OpenGL, 161OpenGL ES 1, and OpenGL ES 2/3, respectively. 162 163 164\section{Registry Root (\tag{registry} tag)} 165\label{schema:root} 166 167A \tag{registry} contains the entire definition of one or more related 168APIs. 169 170\subsection{Attributes of \tag{registry} tags} 171 172None. 173 174\subsection{Contents of \tag{registry} tags} 175 176Zero or more of each of the following tags, normally in this order 177(although order shouldn't be important): 178 179\begin{itemize} 180\item \tag{comment} - Contains arbitrary text, such as a copyright 181 statement. Unused. 182\item \tag{types} (see section~\ref{tag:types}) - defines API types. 183 Usually only one tag is used. 184\item \tag{kinds} (see section~\ref{tag:kinds}) - defines tags 185 that can be used for parameter validation and more expressive types 186 in API bindings for languages other than C. 187 One parameter can be of multiple kinds, separated by commas. 188\item \tag{groups} (see section~\ref{tag:groups}) - defines named groups 189 of tokens for possible parameter validation in API bindings for 190 languages other than C. Usually only one tag is used. 191\item \tag{enums} (see section~\ref{tag:enums}) - defines API enumerants 192 (tokens). Usually multiple tags are used. 193\item \tag{commands} (see section~\ref{tag:commands}) - defines API 194 commands (functions). Usually only one tag is used. 195\item \tag{feature} (see section~\ref{tag:feature}) - defines API 196 feature interfaces (API versions, more or less). One tag per 197 feature set. 198\item \tag{extensions} (see section~\ref{tag:extensions}) - defines API 199 extension interfaces. Usually only one tag is used, wrapping many 200 extensions. 201\end{itemize} 202 203 204\section{API types (\tag{types} tag)} 205\label{tag:types} 206 207The \tag{types} tag contains individual \tag{type} tags describing each 208of the derived types used in the API. 209 210Each \tag{type} tag contains legal C code, with attributes or embedded 211tags denoting the type name. 212 213\subsection{Attributes of \tag{type} tags} 214 215\begin{itemize} 216\item \attr{requires} - another type name this type requires to complete 217 its definition. 218\item \attr{name} - name of this type (if not defined in the tag body). 219\item \attr{api} - an API name (see \tag{feature} below) which 220 specializes this definition of the named type, so that the same 221 API types may have different definitions for e.g. GL ES and GL. 222\item \attr{comment} - arbitrary string (unused). 223\end{itemize} 224 225\subsection{Contents of \tag{type} tags} 226 227\tag{type} contains text which is legal C code for a type declaration. 228It may also contain embedded tags: 229 230\begin{itemize} 231\item \tag{apientry/} - insert a platform calling convention macro here 232 during header generation, used mostly for function pointer types. 233\item \tag{name} - contains the name of this type (if not defined in the 234 tag attributes). 235\end{itemize} 236 237\subsection{Example of a \tag{types} tag} 238 239\begin{verbatim} 240<types> 241 <type name="stddef"><![CDATA[#include <stddef.h>]]></type> 242 <type requires="stddef">typedef ptrdiff_t <name>GLintptr</name>;</type> 243</types> 244\end{verbatim} 245 246If the {\tt GLint64} type is required by a command, this will result in 247the following declarations: 248 249\begin{verbatim} 250#include <stddef.h> 251typedef ptrdiff_t GLintptr; 252\end{verbatim} 253 254\section{Kinds (\tag{kinds} tag)} 255\label{tag:kinds} 256 257The \tag{kinds} tag contain individual \tag{kind} tags describing 258some metadata not captured by the \tag{types} tag (see section~\ref{tag:types}) 259or \tag{enums} tag (see section~\ref{tag:groups}). 260 261\subsection{Attributes of (\tag{kinds} tag)} 262 263\begin{itemize} 264\item \attr{name} - the name of the kind. 265\item \attr{desc} - a description of what the kind indicates. 266\end{itemize} 267 268\subsection{Contents of \tag{kinds} tags} 269 270Each \tag{kinds} block contains zero or more \tag{kind} tags, in 271arbitrary order. 272 273\subsection{Example of a \tag{kinds} tag} 274 275\begin{verbatim} 276<kinds> 277 <kind name="Color" desc="This parameter represents part of or a complete color." /> 278 <kind name="Clamped[0; 1]" desc="This parameter will get clamped to the 0 to 1 range." /> 279</kinds> 280\end{verbatim} 281 282\section{Kind (\tag{kind} tag)} 283\label{tag:kind} 284 285Each \{kind} tag defines a single kind annotation. 286 287\subsection{Attributes of \tag{kind} tag} 288 289\begin{itemize} 290\item \attr{name} - kind name, an arbitrary string without commas (',') used 291 to identify this kind. 292\item \attr{desc} - kind description, a description of what it 293 means for a parameter or return value to be annotated with this kind. 294\end{itemize} 295 296\subsection{Contents of \tag{kind} tag} 297 298None. 299 300\subsection{Meaning of \tag{kind} tags} 301\label{tag:kind:meaning} 302 303If a \tag{proto} or \tag{param} tag of a \tag{command} has a 304\attr{kind} attribute defined, and and the comma separated elemenst 305if the attribute matches a \tag{kind} name, 306then the return type or parameter type is considered to be 307further defined by the description provided by the \tag{kind} tags 308with the matching names. C language bindings do not attempt to 309enforce this constraint in any way, but other language bindings 310may try to do so. 311 312\section{Enumerant Groups (\tag{groups} tag)} 313\label{tag:groups} 314 315The \tag{groups} tags contain individual \tag{group} tags describing 316some of the group annotations used for return and parameter types. 317 318\subsection{Attributes of \tag{groups} tags} 319 320None. 321 322\subsection{Contents of \tag{groups} tags} 323 324Each \tag{groups} block contains zero or more \tag{group} tags, in 325arbitrary order (although they are typically ordered by group name, to 326improve human readability). 327 328\subsection{Example of \tag{groups} tags} 329 330\begin{verbatim} 331<groups> 332 <group name="AccumOp"> 333 <enum name="GL_ACCUM"/> 334 </group> 335 336 <group name="AttribMask"> 337 <enum name="GL_ACCUM_BUFFER_BIT"/> 338 <enum name="GL_ALL_ATTRIB_BITS"/> 339 </group> 340</groups> 341\end{verbatim} 342 343 344\section{Enumerant Group (\tag{group} tag)} 345\label{tag:group} 346 347Each \tag{group} tag defines a single group annotation. 348 349\subsection{Attributes of \tag{group} tags} 350 351\begin{itemize} 352\item \attr{name} - group name, an arbitrary string for grouping a set 353 of enums together within a broader namespace. 354\end{itemize} 355 356\subsection{Contents of \tag{group} tags} 357 358\tag{group} tags may contain zero or more \tag{enum} tags. Each 359\tag{enum} tag may contain only a \attr{name} attribute, which should 360correspond to a \tag{enum} definition in an \tag{enums} block. 361 362\subsection{Meaning of \tag{group} tags} 363\label{tag:group:meaning} 364 365If a \tag{proto} or \tag{param} tag of a \tag{command} has a 366\attr{group} attribute defined, and that attribute matches a \tag{group} 367name, then the return type or parameter type is considered to be 368constrained to values defined by the corresponding \tag{group}. C 369language bindings do not attempt to enforce this constraint in any way, 370but other language bindings may try to do so. 371 372 373\section{Enumerant Blocks (\tag{enums} tag)} 374\label{tag:enums} 375 376The \tag{enums} tags contain individual \tag{enum} tags describing each of the 377token (enumerant) names used in the API. 378 379\subsection{Attributes of \tag{enums} tags} 380 381\begin{itemize} 382\item \attr{namespace} - a string for grouping many different enums 383 together, currently unused but typically something like \code{GL} 384 for all enums in the OpenGL / OpenGL ES shared namespace. Multiple 385 \tag{enums} tags can share the same namespace. 386\item \attr{type} - a string describing the data type of the values of 387 this group of enums, currently unused. The only string used at 388 present in the is \code{bitmask}. 389\item \attr{start}, \attr{end} - integers defining the start and end of 390 a reserved range of enumerants for a particular vendor or purpose. 391 \attr{start} must be $\leq$ \attr{end}. These fields define formal 392 enumerant allocations within a namespace, and are made by the 393 Khronos Registrar on request from implementers following the enum 394 allocation policy. 395\item \attr{vendor} - string describing the vendor or purposes to whom a 396 reserved range of enumerants is allocated. 397\item \attr{comment} - arbitrary string (unused) 398\end{itemize} 399 400\subsection{Contents of \tag{enums} tags} 401 402Each \tag{enums} block contains zero or more \tag{enum} and \tag{unused} 403tags, in arbitrary order (although they are typically ordered by sorting 404on enumerant values, to improve human readability). 405 406\subsection{Example of \tag{enums} tags} 407 408\begin{verbatim} 409<enums namespace="AttribMask" type="bitmask"> 410 <enum value="0x00000001" name="GL_CURRENT_BIT" /> 411 <enum value="0x00000002" name="GL_POINT_BIT" /> 412</enums> 413<enums namespace="GL" start="0x80E0" end="0x810F" vendor="MS"> 414 <enum value="0x80E0" name="GL_BGR" /> 415 <unused start="0x80E1" end="0x810F" /> 416</enums> 417\end{verbatim} 418 419When processed into a C header, and assuming all these tokens were 420required, this results in 421 422\begin{verbatim} 423#define GL_CURRENT_BIT 0x00000001 424#define GL_POINT_BIT 0x00000001 425#define GL_BGR 0x80E0 426\end{verbatim} 427 428 429\section{Enumerants (\tag{enum} tag)} 430\label{tag:enum} 431 432Each \tag{enum} tag defines a single GL (or other API) token. 433 434\subsection{Attributes of \tag{enum} tags} 435 436\begin{itemize} 437\item \attr{value} - enumerant value, a legal C constant (usually a 438 hexadecimal integer). 439\item \attr{name} - enumerant name, a legal C preprocessor token name. 440\item \attr{api} - an API name which specializes this definition of the 441 named enum, so that different APIs may have different values for 442 the same token (used to address a few accidental incompatibilities 443 between GL and GL ES). 444\item \attr{type} - legal C suffix for the value to force it to a 445 specific type. Currently only \code{u} and \code{ull} are used, 446 for \code{unsigned} 32- and 64-bit integer values, respectively. 447 Separated from the \attr{value} field since this eases parsing and 448 sorting of values, and is rarely used. 449\item \attr{group} - group name, an arbitrary string for grouping a set of 450 enums together within a broader namespace. 451 \par {\bf Note:} the \tag{group} tag (see section~\ref{tag:group}) 452 serves the same purpose, but is deprecated in favor of this attribute. 453 Eventually all \tag{group} tags will be removed from the XML 454 registries. 455\item \attr{alias} - name of another enumerant this is an alias of, used 456 where token names have been changed as a result of profile changes 457 or for consistency purposes. An enumerant alias is simply a 458 different \attr{name} for the exact same \attr{value}. At present, 459 enumerants which are promoted from extension to core API status 460 are not tagged as aliases - just enumerants tagged as aliases in 461 the {\em Changed Tokens} sections of appendices to the OpenGL 462 Specification. This might change in the future. 463\end{itemize} 464 465\subsection{Contents of \tag{enum} tags} 466 467\tag{enum} tags have no allowed contents. All information is contained 468in the attributes. 469 470 471\section{Unused Enumerants (\tag{unused} tag)} 472\label{tag:unused} 473 474Each \tag{unused} tag defines a range of enumerants which is allocated, 475but not yet assigned to specific enums. This just tracks the unused 476values and is not needed for header generation. 477 478\subsection{Attributes of \tag{unused} tags} 479 480\begin{itemize} 481\item \attr{start}, \attr{end} - integers defining the start and end of 482 an unused range of enumerants. \attr{start} must be $\leq$ 483 \attr{end}. This range should not exceed the range reserved by the 484 surrounding \tag{enums} tag. 485\item \attr{vendor} - string describing the vendor or purposes to whom a 486 reserved range of enumerants is allocated. Usually identical to 487 the \attr{vendor} attribute of the surrounding \attr{enums} block. 488\item \attr{comment} - arbitrary string (unused) 489\end{itemize} 490 491\subsection{Contents of \tag{unused} tags} 492 493None. 494 495 496\section{Command Blocks (\tag{commands} tag)} 497\label{tag:commands} 498 499The \tag{commands} tag contains definitions of each of the functions 500(commands) used in the API. 501 502\subsection{Attributes of \tag{commands} tags} 503 504\begin{itemize} 505\item \attr{namespace} - a string defining the namespace in which 506 commands live, currently unused but typically something like 507 \code{GL}. 508\end{itemize} 509 510\subsection{Contents of \tag{commands} tags} 511 512Each \tag{commands} block contains zero or more \tag{command} tags, in 513arbitrary order (although they are typically ordered by sorting on the 514command name, to improve human readability). 515 516 517\section{Commands (\tag{command} tag)} 518\label{tag:command} 519 520The \tag{command} tag contains a structured definition of a single API 521command (function). 522 523\subsection{Attributes of \tag{command} tags} 524 525\begin{itemize} 526\item \attr{comment} - arbitrary string (unused). 527\end{itemize} 528 529\subsection{Contents of \tag{command} tags} 530 531\begin{itemize} 532\item \tag{proto} must be the first element, and is a tag defining the C 533 function prototype of a command as described below, up to the 534 function name but not including function parameters. 535\item \tag{param} elements for each command parameter follow, defining 536 its name and type, as described below. If a command takes no 537 arguments, it has no \tag{param} tags. 538\end{itemize} 539 540Following these elements, the remaining elements in a \tag{command} 541tag are optional and may be in any order: 542 543\begin{itemize} 544\item \tag{alias} has one attribute, \attr{name}, containing a string which is the 545 name of another command this command is an alias of, used when 546 promoting a function from extension to ARB or ARB to API status. A 547 command alias describes the case where there are two function 548 names which resolve to the {\bf same} client library code, so (for 549 example) the case where a command is promoted but is also given 550 different GLX protocol would {\bf not} be an alias in this sense. 551\item \tag{vecequiv} has one attribute, \attr{name}, containing a string which is 552 the name of another command which is the {\em vector equivalent} 553 of this command. For example, the vector equivalent of 554 \code{glVertex3f} is \code{glVertex3fv}. 555\item \tag{glx} defines GLX protocol information for this command, as 556 described below. Many GL commands don't have GLX protocol defined, 557 and other APIs such as EGL and WGL don't use GLX at all. 558\end{itemize} 559 560 561\subsection{Command prototype (\tag{proto} tags)} 562\label{tag:command:proto} 563 564The \tag{proto} tag defines the return type and name of a command. 565 566\subsubsection{Attributes of \tag{proto} tags} 567 568\begin{itemize} 569\item \attr{group} - group name, an arbitrary string. 570\item \attr{kind} - kind list, a comma separated list of names of 571 previously defined \tag{kind} tags. 572\end{itemize} 573 574If the group name is defined, it may be interpreted as described in 575section~\ref{tag:group:meaning}. 576 577\subsubsection{Contents of \tag{proto} tags} 578 579The text elements of a \tag{proto} tag, with all other tags removed, is 580legal C code describing the return type and name of a command. In addition 581it may contain two semantic tags: 582 583\begin{itemize} 584\item The \tag{ptype} tag is optional, and contains text which is a 585 valid type name found in \tag{type} tag, and indicates that this 586 type must be previously defined for the definition of the command 587 to succeed. Builtin C types, and any derived types which are 588 expected to be found in other header files, should not be wrapped 589 in \tag{ptype} tags. 590\item The \tag{name} tag is required, and contains the command name 591 being described. 592\end{itemize} 593 594\subsection{Command parameter (\tag{param} tags)} 595\label{tag:command:param} 596 597The \tag{param} tag defines the type and name of a parameter. 598 599\subsubsection{Attributes of \tag{param} tags} 600 601\begin{itemize} 602\item \attr{group} - group name, an arbitrary string. 603\item \attr{kind} - kind list, a comma separated list of names of 604 previously defined \tag{kind} tags. 605\item \attr{len} - parameter length, either an integer specifying the 606 number of elements of the parameter \tag{ptype}, or a complex 607 string expression with poorly defined syntax, usually representing 608 a length that is computed as a combination of other command 609 parameter values, and possibly current GL state as well. 610\item \attr{class} - an arbitrary string defining the type of object handles 611 passed in this parameter. Handles with different types are not 612 compatible; for example, handles created with 613 \attr{class}{\tt="buffer"} can not be passed to a parameter with 614 \attr{class}{\tt="shader"}. 615\end{itemize} 616 617If the group name is defined, it may be interpreted as described in 618section~\ref{tag:group:meaning}. 619 620\subsubsection{Contents of \tag{param} tags} 621 622The text elements of a \tag{param} tag, with all other tags removed, is 623legal C code describing the type and name of a function parameter. In 624addition it may contain two semantic tags: 625 626\begin{itemize} 627\item The \tag{ptype} tag is optional, and contains text which is a 628 valid type name found in \tag{type} tag, and indicates that this 629 type must be previously defined for the definition of the command 630 to succeed. Builtin C types, and any derived types which are 631 expected to be found in other header files, should not be wrapped 632 in \tag{ptype} tags. 633\item The \tag{name} tag is required, and contains the command name 634 being described. 635\end{itemize} 636 637\subsection{Example of a \tag{commands} tag} 638 639\begin{verbatim} 640<commands> 641 <command> 642 <proto>void <name>glBeginConditionalRenderNV</name></proto> 643 <param><ptype>GLuint</ptype> <name>id</name></param> 644 <param><ptype>GLenum</ptype> <name>mode</name></param> 645 <alias name="glBeginConditionalRender" /> 646 <glx type="render" opcode="348" /> 647 </command> 648</commands> 649\end{verbatim} 650 651When processed into a C header, this results in 652 653\begin{verbatim} 654void glBeginConditionalRenderNV(GLuint id, GLenum mode); 655\end{verbatim} 656 657 658\section{API Features / Versions (\tag{feature} tag)} 659\label{tag:feature} 660 661API features are described in individual \tag{feature} tags. A feature 662is the set of interfaces (enumerants and commands) defined by a 663particular API and version, such as OpenGL 4.0 or OpenGL ES 3.0, and 664includes all API profiles of that version. 665 666\subsection{Attributes of \tag{feature} tags} 667 668\begin{itemize} 669\item \attr{api} - API name this feature is for (see 670 section~\ref{schema:apiname}), such as \code{gl} or \code{gles2}. 671\item \attr{name} - version name, used as the C preprocessor token under 672 which the version's interfaces are protected against multiple 673 inclusion. Example: \code{GL\_VERSION\_4\_2}. 674\item \attr{protect} - an additional preprocessor token used to protect 675 a feature definition. Usually another feature or extension 676 \attr{name}. Rarely used, for odd circumstances where the 677 definition of a feature or extension requires another to be 678 defined first. 679\item \attr{number} - feature version number, usually a string 680 interpreted as $majorNumber.minorNumber$. Example: \code{4.2}. 681\item \attr{comment} - arbitrary string (unused) 682\end{itemize} 683 684\subsection{Contents of \tag{feature} tags} 685 686Zero or more \tag{require} and \tag{remove} tags (see 687section~\ref{tag:required}), in arbitrary order. Each tag describes a 688set of interfaces that is respectively required for, or removed from, 689this feature, as described below. 690 691\subsection{Example of a \tag{feature} tag} 692 693\begin{verbatim} 694<feature api="gl" name="GL_VERSION_3_0" number="3.0"> 695 <require> 696 <enum name="GL_COMPARE_REF_TO_TEXTURE" /> 697 <enum name="GL_CLIP_DISTANCE0" /> 698 <command name="glEndTransformFeedback" /> 699 </require> 700 <require profile="compatibility"> 701 <enum name="GL_INDEX" /> 702 </require> 703</feature> 704\end{verbatim} 705 706When processed into a C header for the \code{compatibility} profile of 707OpenGL, this results in (assuming the usual definitions of these GL 708interfaces): 709 710\begin{verbatim} 711#ifndef GL_VERSION_3_0 712#define GL_VERSION_3_0 1 713#define GL_COMPARE_REF_TO_TEXTURE 0x884E 714#define GL_CLIP_DISTANCE0 0x3000 715#define GL_INDEX 0x8222 716typedef void (APIENTRYP PFNGLENDTRANSFORMFEEDBACKPROC) (void); 717#ifdef GL_GLEXT_PROTOTYPES 718GLAPI void APIENTRY glEndTransformFeedback (void); 719#endif 720#endif /* GL_VERSION_3_0 */ 721\end{verbatim} 722 723If processed into a header for the \code{core} profile, the definition of 724\code{GL\_INDEX} would not appear. 725 726 727\section{Extension Blocks (\tag{extensions} tag)} 728\label{tag:extensions} 729 730The \tag{extensions} tag contains definitions of each of the extenions 731which are defined for the API. 732 733\subsection{Attributes of \tag{extensions} tags} 734 735None. 736 737\subsection{Contents of \tag{extensions} tags} 738 739Each \tag{extensions} block contains zero or more \tag{extension} tags, 740each describing an API extension, in arbitrary order (although they are 741typically ordered by sorting on the extension name, to improve human 742readability). 743 744 745\section{API Extensions (\tag{extension} tag)} 746\label{tag:extension} 747 748API extensions are described in individual \tag{extension} tags. An 749extension is the set of interfaces defined by a particular API extension 750specification, such as \code{ARB\_multitexture}. \tag{extension} is 751similar to \tag{feature}, but instead of having \attr{version} and 752\attr{profile} attributes, instead has a \attr{supported} attribute, 753which describes the set of API names which the extension can potentially 754be implemented against. 755 756\subsection{Attributes of \tag{extension} tags} 757 758\begin{itemize} 759\item \attr{supported} - a regular expression, with an implicit 760 \code{\^{}} and \code{\$} bracketing it, which should match the 761 \attr{api} tag of a set of \tag{feature} tags. 762\item \attr{protect} - an additional preprocessor token used to protect 763 an extension definition. Usually another feature or extension 764 \attr{name}. Rarely used, for odd circumstances where the 765 definition of an extension requires another to be defined first. 766\item \attr{comment} - arbitrary string (unused) 767\end{itemize} 768 769\subsection{Contents of \tag{extension} tags} 770 771Zero or more \tag{require} and \tag{remove} tags (see 772section~\ref{tag:required}), in arbitrary order. Each tag describes a 773set of interfaces that is respectively required for, or removed from, 774this extension, as described below. 775 776\subsection{Example of an \tag{extensions} tag} 777 778\begin{verbatim} 779<extensions> 780 <extension name="GL_ARB_robustness" supported="gl|glcore" > 781 <require> 782 <enum name="GL_NO_ERROR" /> 783 <command name="glGetGraphicsResetStatusARB" /> 784 </require> 785 <require api="gl" profile="compatibility"> 786 <command name="glGetnMapdvARB" /> 787 </require> 788 </extension> 789</extensions> 790\end{verbatim} 791 792The \attr{supported} attribute says that the extension can be supported for 793either the GL compatibility (\code{gl}) or GL core (\code{glcore}) API 794profiles, but not for other APIs. When processed into a C header for the 795\code{core} profile of OpenGL, this results in (assuming the usual 796definitions of these GL interfaces): 797 798\begin{verbatim} 799#ifndef GL_ARB_robustness 800#define GL_ARB_robustness 1 801#define GL_NO_ERROR 0 802typedef GLenum (APIENTRYP PFNGLGETGRAPHICSRESETSTATUSARBPROC) (void); 803#ifdef GL_GLEXT_PROTOTYPES 804GLAPI GLenum APIENTRY glGetGraphicsResetStatusARB (void); 805#endif 806#endif /* GL_ARB_robustness */ 807\end{verbatim} 808 809 810\section{Required and Removed Interfaces (\tag{require} and \tag{remove} tags)} 811\label{tag:required} 812 813A \tag{require} block defines a set of interfaces (types, enumerants and 814commands) {\em required} by a \tag{feature} or \tag{extension}. A 815\tag{remove} block defines a set of interfaces {\em removed} by a 816\tag{feature} (this is primarily useful for the OpenGL core profile, 817which removed many interfaces - extensions should never remove 818interfaces, although this usage is allowed by the schema). Except for 819the tag name and behavior, the contents of \tag{require} and 820\tag{remove} tags are identical. 821 822\subsection{Attributes of \tag{require} and \tag{remove} tags} 823 824\begin{itemize} 825\item \attr{profile} - string name of an API profile. Interfaces in the 826 tag are only required (or removed) if the specified profile is 827 being generated. If not specified, interfaces are required (or 828 removed) for all API profiles. 829\item \attr{comment} - arbitrary string (unused) 830\item \attr{api} - an API name (see section~\ref{schema:apiname}). Interfaces 831 in the tag are only required (or removed) if the specified API is 832 being generated. If not specified, interfaces are required (or 833 removed) for all APIs. 834 835 {\bf The \attr{api} attribute is only supported inside 836 \tag{extension} tags,} since \tag{feature} tags already define a 837 specific API. 838\end{itemize} 839 840\subsection{Contents of \tag{require} and \tag{remove} tags} 841 842Zero or more of the following tags, in any order: 843 844\begin{itemize} 845\item \tag{command} specifies an required (or removed) command defined 846 in a \tag{commands} block. The tag has no content, but contains 847 elements: 848 849 \begin{itemize} 850 \item \attr{name} - name of the command (required). 851 \item \attr{comment} - arbitrary string (optional and unused). 852 \end{itemize} 853\item \tag{enum} specifies an required (or removed) enumerant defined in 854 a \tag{enums} block. The tag has no content, but contains 855 elements: 856 857 \begin{itemize} 858 \item \attr{name} - name of the enumerant (required). 859 \item \attr{comment} - arbitrary string (optional and unused). 860 \end{itemize} 861\item \tag{type} specifies a required (or removed) type defined in a 862 \tag{types} block. Most types are picked up implicitly by using 863 the \tag{ptype} tags of commands, but in a few cases, additional 864 types need to be specified explicitly (it is unlikely that a type 865 would ever be removed, although this usage is allowed by the 866 schema). The tag has no content, but contains elements: 867 868 \begin{itemize} 869 \item \attr{name} - name of the type (required). 870 \item \attr{comment} - arbitrary string (optional and unused). 871 \end{itemize} 872\end{itemize} 873 874 875\section{General Discussion} 876\label{general} 877 878 879\subsection{Stability of the XML Database and Schema} 880\label{general:stability} 881 882The new registry schema, scripts, and databases are evolving in response 883to feedback and to Khronos' own wishlist. This means the XML schema is 884subject to change, although most such change will probably be confined 885to adding attributes to existing tags. The XML databases such as 886\code{gl.xml} will evolve in response to schema changes, to new 887extensions and API versions, and to general cleanup, such as 888canonicalization of the XML or sorting of \tag{command} and 889\tag{extension} tags by name. Changes to the schema will be described in 890the change log of this document (see section~\ref{changelog}). Changes 891to the \code{.xml} files will be described in Github revision history. 892 893 894\subsection{Feature Enhancements to the Registry} 895\label{general:enhancements} 896 897There are lots of tools and additional tags that would make the XML format 898more expressive and the tools more capable. Khronos is open to hosting 899additional processing scripts for other purposes related to the definition 900of the API and bindings to it. 901 902A partial wishlist follows: 903 904\begin{itemize} 905\item Enhance \tag{command} \tag{alias} tags to describe more relaxed 906 sorts of aliases, such as commands equivalent in behavior and 907 interface, but using different GLX protocol (this might be called 908 a {\em client-side alias} or something of the sort). 909\end{itemize} 910 911\subsection{Type Annotations and Relationship to \code{.spec} Files} 912\label{general:annotations} 913 914The initial releases of the XML Registry did not include type annotation 915and array length information from the old \code{.spec} files, which 916generated a number of complaints from people writing bindings of OpenGL 917to languages other than C. The majority of these annotations have now 918been added to the XML, in the form of \tag{group} tags (see 919section~\ref{tag:group}) defining groups of related enumerants, 920\attr{group} attributes on \tag{proto} and \tag{param} tags specifying 921that the corresponding return type belongs to a group, and \attr{len} 922attributes on \tag{param} tags specifying the array length of the 923corresponding parameter. 924 925There are many caveats regarding these annotations. For the most part 926they date from SGI's OpenGL 1.1 implementation, and have not been 927updated. The defined \tag{group}s therefore do not cover many API 928parameters which {\bf could} be given a group, and in many cases, the 929defined \tag{group}s have not been updated to add new enumerants from 930later versions of OpenGL and OpenGL extensions. The group names are 931often somewhat misleading (with imbedded vendor extension tags, while 932the corresponding features have been promoted). 933 934The \tag{group}s added to \code{gl.xml} are the enumerant groups defined 935in \code{enum.spec}, and \code{enumext.spec}. Many additional group 936names were used in the annotations in \code{gl.spec}, and they 937fall in several categories discussed below. 938 939 940\subsubsection{Simple API Type Aliases} 941 942Group names that were simply an alias for a GL type have been left 943entirely out of \code{gl.xml}, since they offer no useful additional 944information. 945 946For example, a parameter described as \code{UInt32} in \code{gl.spec} is 947not annotated with \code{group="UInt32"} in \code{gl.xml}, because this 948offers no information about the parameter not already present in its 949declaration as \code{<ptype>GLuint</ptype>}. 950 951A few examples of such groups are \code{cl\_context}, 952\code{handleARB}, \code{Int32}, and \code{sync}. 953 954 955\subsubsection{Numeric Constraints} 956 957Group names representing some type of numerical constraint on a value 958are retained in \tag{proto} and \tag{param} \attr{group} attributes, but 959no definition exists. This is because the existing \tag{group} mechanism 960can only describe constraints to specific enumerant names. 961 962This is not a regression relative to the \code{.spec} files, which also 963did not describe the meaning of these groups. 964 965A few examples of such groups are \code{CheckedFloat32}, 966\code{ClampedFixed}, and \code{CoordD}. 967 968 969\subsubsection{GL Object Names} 970 971Group names representing an object name obtained from e.g. a 972\code{glGen*} command, such as a display list name, are retained in in 973\tag{proto} and \tag{param} \attr{group} attributes, but no definition 974exists. This is because the existing \tag{group} mechanism can only 975describe constraints to specific enumerant names. 976 977This is not a regression relative to the \code{.spec} files, which also 978did not describe the meaning of these groups. 979 980A few examples of such groups are \code{List} and \code{Path}. 981 982 983\subsubsection{Groups Not Defined Yet} 984 985Group names representing enumerant groups which were not defined in 986\code{enum.spec} and \code{enumext.spec} are retained in \tag{proto} and 987\tag{param} \attr{group} attributes, but no definition exists. Such 988groups usually are a result of vendors contributing \code{gl.spec} 989entries for an extension without contributing corresponding 990\code{enum.spec} entries. 991 992This is not a regression relative to the \code{.spec} files, which also 993did not describe the meaning of these groups. 994 995A few examples of such groups are \code{ArrayObjectPNameATI}, 996\code{BinormalPointerTypeEXT}, and \code{SpriteParameterNameSGIX}. 997 998 999\subsubsection{Other Groups} 1000 1001There are probably a few groups which are present in \code{gl.xml} but 1002should not be. These can be gradually cleaned up over time. 1003 1004 1005\subsubsection{Validating Groups} 1006 1007The \code{genheaders.py} script has been enhanced to allow validating 1008groups during header generation. Invoking it with the 1009\code{-validate} option, for example via: 1010 1011\code{\$ genheaders.py -validate -registry gl.xml} 1012 1013\noindent will generate a text dump on standard output showing all 1014parameter type \attr{group} attributes which do {\bf not} have 1015corresponding \tag{group} tags. 1016 1017 1018\section{Change Log} 1019\label{changelog} 1020 1021\begin{itemize} 1022\item 2020-10-27 - Add \attr{class} attribute to \tag{param} tags (github 1023 pull request 428), update document title and make minor tweaks to 1024 reflect this not being the only Khronos XML API schema in use, and 1025 having migrated from Subversion to Github. 1026\item 2020-01-11 - Add \attr{group} attribute to \tag{enum} tags, and 1027 deprecate \tag{group} tags (github issue 335). 1028\item 2017-01-20 - Update for the move to the new github repository. 1029\item 2014-06-16 - Add \tag{vendor} attribute to \tag{unused} tags. 1030\item 2013-09-17 - Add \tag{comment} attribute to \tag{command} tags 1031 within \tag{commands}. 1032\item 2013-06-24 - Add \tag{groups} and \tag{group} tags, renamed 1033 \tag{enums} attribute \attr{class} to \attr{group}, and add 1034 parameter type annotation attributes \attr{group} and \attr{len} 1035 to both \tag{proto} and \tag{param}. Add 1036 section~\ref{general:annotations} discussing limitations of these 1037 annotations. Still need to add examples of the annotation 1038 attributes. 1039\item 2013-06-19 - Added \tag{extensions} tag block as a wrapper around 1040 groups of \tag{extension} tags, to ease XML transformations such 1041 as sorting extensions by name. 1042\item 2013-06-14 - Expanded description of tags, better formatting 1043\item 2013-06-12 - First release, text file format 1044\end{itemize} 1045 1046\input{readme.ind} 1047 1048% \printindex 1049 1050\end{document} 1051