1# Copyright 2013-2021 The Khronos Group Inc. 2# 3# SPDX-License-Identifier: Apache-2.0 4 5# Relax NG schema for Khronos Vulkan API Registry XML 6# 7# See https://www.khronos.org/vulkan/ 8# 9# This definition is subject to change (mostly in the form of additions) 10 11namespace xsd = "http://www.w3.org/2001/XMLSchema-datatypes" 12 13# Toplevel is a <registry> tag. 14# May be led by an optional <comment> tag containing e.g. copyrights. 15start = element registry { 16 ( 17 element comment { text } ? | 18 Platforms * | 19 Tags * | 20 Types * | 21 Enums * | 22 Commands * | 23 Feature * | 24 Extensions * | 25 SpirvExtensions * | 26 SpirvCapabilities * 27 ) * 28} 29 30# <platforms> defines a group of platform names 31Platforms = element platforms { 32 Comment ? , 33 Platform * 34} 35 36# <platform> defines a single platform name. 37# name - string name of the platform, used as part of extension names 38# protect - preprocessor symbol to include platform headers from <vulkan.h> 39# comment - platform description 40Platform = element platform { 41 attribute name { text } , 42 attribute protect { text } , 43 Comment 44} 45 46# <tags> defines a group of author tags 47Tags = element tags { 48 Comment ? , 49 Tag * 50} 51 52# <tag> defines a single author tag. 53# name - name of the tag 54# author - name of the author (usually a company or project name) 55# contact - contact responsible for the tag (name and contact information) 56Tag = element tag { 57 attribute name { text } , 58 attribute author { text } , 59 attribute contact { text } 60} 61 62# <types> defines a group of types 63Types = element types { 64 Comment ? , 65 ( 66 Type | 67 element comment { text } 68 ) * 69} 70 71# <type> defines a single type. It is usually a C typedef but 72# may contain arbitrary C code. 73# name - name of this type, if not present in the <name> tag 74# api - matches a <feature> api attribute, if present 75# alias - name of a type this type aliases 76# requires - name of another type definition required by this one 77# bitvalues - for a *Flags type, name of an enum definition that 78# defines the valid values for parameters of that type 79# name - name of the type being defined 80# category - if present, 'enum' indicates a matching <enums> 81# block to generate an enumerated type for, and 'struct' 82# causes special interpretation of the contents of the type 83# tag including ... TBD ... 84# Other allowed values are 'include', 'define', 'handle' and 'bitmask', 85# which don't change syntactic interpretation but allow organization in 86# the generated header. 87# parent - only applicable if category is 'handle'. Notes another type with 88# the 'handle' category that acts as a parent object for this type. 89# returnedonly - only applicable if category is 'struct'. Notes that this 90# struct is going to be filled in by the API, rather than an application 91# filling it out and passing it to the API. 92# structextends - only applicable if category is 'struct'. Lists parent 93# structures which this structure may extend via the pNext chain 94# of the parent. 95# When present it suppresses generation of automatic validity for the 96# pNext member of that structure, and instead the structure is added 97# to pNext chain validity for the parent structures it extends. 98# allowduplicate - only applicable if category is 'struct'. pNext can include 99# multiple structures of this type. 100# objtypeenum - name of VK_OBJECT_TYPE_* API enumerant which corresponds 101# to this type. Currently only specified for category="handle" types. 102# comment - descriptive text with no semantic meaning 103# For types without a category, contents include 104# <apientry /> - substitutes for an APIENTRY-style macro on output 105# <name> - contains name of the type being defined 106# <type> - contains name of types used to define this type. There 107# may be multiple imbedded <type> tags 108# For types with category 'enum', contents should be empty 109# For types with category 'struct', contents should be one or more 110# <member> - like <param> for a struct or union member 111# len - if the member is an array, len may be one or more of the following 112# things, separated by commas (one for each array indirection): another 113# member of that struct, 'null-terminated' for a string, '1' to indicate it's 114# just a pointer (used for nested pointers), or a latex equation (prefixed with 115# 'latexmath:') 116# altlen - if len has latexmath equations, this contains equivalent C99 117# expressions separated by commas. 118# externsync - denotes that the member should be externally synchronized 119# when accessed by Vulkan 120# optional - whether this value can be omitted by providing NULL (for 121# pointers), VK_NULL_HANDLE (for handles) or 0 (for bitmasks/values) 122# selector - for a union member, identifies a separate enum member that 123# selects which of the union's members are valid 124# selection - for a member of a union, identifies an enum value indicating the member is valid 125# noautovalidity - tag stating that no automatic validity language should be generated 126# values - comma-separated list of legal values, usually used only for sType enums 127# limittype - only applicable for members of VkPhysicalDeviceProperties and 128# VkPhysicalDeviceProperties2, their substrucutres, and extensions. 129# Specifies the type of a device limit. 130# Valid values: 'min', 'max', 'bitmask', 'range', 'struct', 'noauto' 131# objecttype - only applicable for members representing a handle as 132# a uint64_t value. Specifies the name of another member which is 133# a VkObjectType or VkDebugReportObjectTypeEXT value specifying 134# the type of object the handle references. 135# <comment> - containing arbitrary text (unused) 136# 137# *** There's a problem here: I'm not sure how to represent the <type> 138# syntax where it may contain arbitrarily interleaved text, <type>, and 139# <enum> child tags. This allows only the syntax 140# text <type>name</type> text <enum>name</enum> text 141# where <type> and <enum> are both optional and occur in the specified 142# order, which might eventually be a problem. 143Type = element type { 144 attribute api { text } ? , 145 attribute alias { text } ? , 146 attribute requires { text } ? , 147 attribute bitvalues { text } ? , 148 attribute name { TypeName } ? , 149 attribute category { text } ? , 150 attribute parent { TypeName } ? , 151 attribute returnedonly { text } ? , 152 attribute structextends { text } ? , 153 attribute allowduplicate { text } ? , 154 attribute objtypeenum { text } ? , 155 Comment ? , 156 ( 157 ( 158 ( text , 159 element type { text } * 160 ) * , 161 element apientry { text } ? , 162 ( text , 163 element type { text } * 164 ) * , 165 element name { TypeName } ? , 166 ( text , 167 element type { text } * 168 ) * 169 ) | 170 ( 171 element member { 172 attribute len { text } ? , 173 attribute altlen { text } ? , 174 attribute externsync { text } ? , 175 attribute optional { text } ? , 176 attribute selector { text } ? , 177 attribute selection { EnumName } ? , 178 attribute noautovalidity { text } ? , 179 attribute values { text } ? , 180 attribute limittype { text } ? , 181 attribute objecttype { text } ? , 182 mixed { 183 element type { TypeName } ? , 184 element name { text } ? , 185 element enum { EnumName } ? , 186 element comment { text } ? 187 } 188 } | 189 element comment { text } 190 ) * 191 ) 192} 193 194# <enums> defines a group of enumerants 195# name - identifies a type name associated with this group. Should 196# match a <type> name to trigger generation of the type. 197# start, end - beginning and end of a numeric range 198# vendor - owner of the numeric range 199# type - 'enum' or 'bitmask', if present 200# bitwidth - bit width of the enum value type. 201# comment - descriptive text with no semantic meaning 202Enums = element enums { 203 attribute name { text } ? , 204 attribute type { text } ? , 205 attribute start { Integer } ? , 206 attribute end { Integer } ? , 207 attribute bitwidth { Integer } ? , 208 Vendor ? , 209 Comment ? , 210 ( 211 Enum | 212 Unused | 213 element comment { text} 214 ) * 215} 216 217# <enum> defines or references a single enumerant. There are two places it 218# can be used: in an <enums> block, providing a global definition which 219# may later be required by a feature or extension; or in a feature or 220# extension, defining an enumerant specific to that feature. The second 221# form has more possible attributes. Some combinations of attributes are 222# nonsensical in on or the other place, but these are not detected by the 223# validator. 224# 225# Ways to specify the enumerant value: 226# value - integer (including hex) value of the enumerant 227# bitpos - integer bit position of the enumerant in a bitmask 228# [extnumber], offset, [dir] - integer extension number specifying a 229# base block value (inherited from surrounding <extension> if 230# not specified); integer offset in that block; and direction 231# of offset ('-' for negative, positive if not specified). 232# alias - name of another enum this is an alias of 233# 234# value and bitpos allow, and extnumber/offset/dir require: 235# extends - type name of the enumerant being extended 236# 237# Other attributes: 238# api - matches a <feature> api attribute, if present 239# type - 'uint32_t', 'uint64_t', or 'float', if present. There are 240# certain conditions under which the tag must be present, or absent, 241# but they are context-dependent and difficult to express in the 242# RNC syntax. 243# name - enumerant name 244# alias - another enumerant this is semantically identical to 245# protect - additional #ifdef symbol to place around the enum 246# comment - descriptive text with no semantic meaning 247Enum = element enum { 248 ( 249 ( 250 ( 251 attribute value { Integer } & 252 attribute extends { TypeName } ? 253 ) | 254 ( 255 attribute bitpos { Integer } & 256 attribute extends { TypeName } ? 257 ) | 258 ( 259 attribute extnumber { Integer } ? & 260 attribute offset { Integer } & 261 attribute dir { text } ? & 262 attribute extends { TypeName } 263 ) | 264 ( 265 attribute extends { TypeName } ? & 266 attribute alias { TypeName } 267 ) 268 ) ? & 269 attribute protect { text } ? & 270 attribute api { text } ? & 271 attribute type { TypeSuffix } ? & 272 attribute name { text } & 273 Comment ? 274 ) 275} 276 277# <unused> defines a range of enumerants not currently being used 278# start, end - beginning and end of an unused numeric range 279# vendor - unused 280# comment - descriptive text with no semantic meaning 281Unused = element unused { 282 attribute start { Integer } , 283 attribute end { Integer } ? , 284 Vendor ? , 285 Comment ? 286} 287 288# <commands> defines a group of commands 289Commands = element commands { 290 Comment ? , 291 Command * 292} 293 294# <command> defines a single command 295# 296# There are two forms of the tag. 297# 298# The first only has 'name' and 'alias' attributes, and no contents. 299# It defines a command alias. 300# 301# The second fully defines a command, and has the following structure: 302# The possible attributes are not described in this comment block yet, but 303# are in readme.pdf. The "prefix" and "suffix" attributes are currently 304# present only in the OpenCL XML registry, where they are currently unused. 305# 306# <proto> is the C function prototype, including the return type 307# <param> are function parameters, in order 308# len - if the member is an array, len may be one or more of the following 309# things, separated by commas (one for each array indirection): another 310# member of that struct, 'null-terminated' for a string, '1' to indicate it's 311# just a pointer (used for nested pointers), or a latex equation (prefixed with 312# 'latexmath:') 313# altlen - if len has latexmath equations, this contains equivalent C99 314# expressions separated by commas. 315# externsync - denotes that the member should be externally synchronized 316# when accessed by Vulkan 317# optional - whether this value can be omitted by providing NULL (for 318# pointers), VK_NULL_HANDLE (for handles) or 0 (for bitmasks/values) 319# selector - for a union parameter, identifies a separate enum parameter that 320# selects which of the union's members are valid 321# noautovalidity - tag stating that no automatic validity language should be generated 322# objecttype - only applicable for parameters representing a handle as 323# a uint64_t value. Specifies the name of another parameter which is 324# a VkObjectType or VkDebugReportObjectTypeEXT value specifying 325# the type of object the handle references. 326# <type> is a <type> name, if present 327# <name> is the function / parameter name, if present (normally should 328# be, except for void parameters). 329# The textual contents of <proto> and <param> should be legal C 330# for those parts of a function declaration. 331# <alias> - denotes function aliasing, if present 332# name - name of aliased function 333# <description> - unused text 334# <implicitexternsyncparams> are spec-language descriptions of 335# objects that are not parameters of the command, but 336# are related to them and also require external synchronization. 337Command = element command { 338 ( attribute name { text } , 339 attribute alias { text } ) | 340 ( 341 attribute queues { text } ? , 342 attribute successcodes { text } ? , 343 attribute errorcodes { text } ? , 344 attribute renderpass { text } ? , 345 attribute cmdbufferlevel { text } ? , 346 attribute prefix { text } ? , 347 attribute suffix { text } ? , 348 Comment ? , 349 element proto { 350 mixed { 351 element type { TypeName } ? , 352 element name { text } 353 } 354 } , 355 element param { 356 attribute len { text } ? , 357 attribute altlen { text } ? , 358 attribute externsync { text } ? , 359 attribute optional { text } ? , 360 attribute selector { text } ? , 361 attribute noautovalidity { text } ? , 362 attribute objecttype { text } ? , 363 mixed { 364 element type { TypeName } ? , 365 element name { text } ? 366 } 367 } * , 368 ( 369 element alias { 370 Name 371 } ? & 372 element description { 373 text 374 } ? & 375 element implicitexternsyncparams { 376 element param { text } * 377 } ? 378 ) 379 ) 380} 381 382# Each <feature> defines the interface of an API version (e.g. OpenGL 1.2) 383# api - API tag (e.g. 'gl', 'gles2', etc. - used internally, not 384# necessarily an actual API name 385# name - version name (C preprocessor name, e.g. GL_VERSION_4_2) 386# number - version number, e.g. 4.2 387# protect - additional #ifdef symbol to place around the feature 388# sortorder - order relative to other features, default 0 389# <require> / <remove> contains features to require or remove in 390# this version 391# profile - only require/remove when generated profile matches 392# comment - descriptive text with no semantic meaning 393Feature = element feature { 394 attribute api { text } , 395 Name , 396 attribute number { xsd:float } , 397 attribute protect { text } ? , 398 attribute sortorder { xsd:integer } ?, 399 Comment ? , 400 ( 401 element require { 402 ProfileName ? , 403 ExtensionName ? , 404 Comment ? , 405 ( 406 InterfaceElement | 407 element comment { text } 408 ) * 409 } | 410 element remove { 411 ProfileName ? , 412 Comment ? , 413 ( 414 InterfaceElement | 415 element comment { text } 416 ) * 417 } 418 ) * 419} 420 421Extensions = element extensions { 422 Comment ? , 423 Extension * 424} 425 426# Defines the interface of an API <extension>. Like a <feature> 427# tag, but with slightly different attributes: 428# api - regexp pattern matching one or more API tags, indicating 429# which APIs the extension is known to work with. The only 430# syntax supported is <name>{|<name>}* and each name must 431# exactly match an API being generated (implicit ^$ surrounding). 432# name - extension name string 433# number - extension number (positive integer, should be unique) 434# sortorder - order relative to other extensions, default 0 435# protect - C preprocessor symbol to conditionally define the interface 436# platform - should be one of the platform names defined in the 437# <platform> tag. Currently unused. 438# author - name of the author (usually a company or project name) 439# contact - contact responsible for the tag (name and contact information) 440# type - 'device' or 'instance', if present 441# requires - commas-separated list of extension names required by this 442# extension 443# requiresCore - core version of Vulkan required by the extension, e.g. 444# "1.1". Defaults to "1.0". 445# supported - profile name(s) supporting this extension, e.g. 'vulkan' 446# or 'disabled' to never generate output. 447# promotedto - Vulkan version or a name of an extension that this 448# extension was promoted to; e.g. 'VK_VERSION_1_1', or 449# 'VK_KHR_draw_indirect_county' 450# deprecatedby - Vulkan version or a name of an extension that deprecates 451# this extension. It may be empty string. 452# e.g. 'VK_VERSION_1_1', or 'VK_EXT_debug_utils', or '' 453# obsoletedby - Vulkan version or a name of an extension that obsoletes 454# this extension. It may be empty string. 455# e.g. 'VK_VERSION_1_1', or 'VK_EXT_debug_utils', or '' 456# provisional - 'true' if this extension is released provisionally 457# specialuse - contains one or more tokens separated by commas, indicating 458# a special purpose of the extension. Tokens may include 'cadsupport', 459# 'd3demulation', 'devtools', 'debugging', and 'glemulation'. Others 460# may be added in the future. 461# In addition, <require> / <remove> tags also support an api attribute: 462# api - only require/remove these features for the matching API. 463# Not a regular expression. 464Extension = element extension { 465 Name , 466 attribute number { Integer } ? , 467 attribute sortorder { xsd:integer } ?, 468 attribute protect { text } ? , 469 attribute platform { text } ? , 470 attribute author { text } ? , 471 attribute contact { text } ? , 472 attribute type { text } ? , 473 attribute requires { text } ? , 474 attribute requiresCore { text } ? , 475 attribute supported { StringGroup } ? , 476 attribute promotedto { text } ? , 477 attribute deprecatedby { text } ? , 478 attribute obsoletedby { text } ? , 479 attribute provisional { text } ? , 480 attribute specialuse { text } ? , 481 Comment ? , 482 ( 483 element require { 484 attribute api { text } ? , 485 ProfileName ? , 486 ExtensionName ? , 487 FeatureName ? , 488 Comment ? , 489 ( 490 InterfaceElement | 491 element comment { text } 492 ) * 493 } | 494 element remove { 495 attribute api { text } ? , 496 ProfileName ? , 497 Comment ? , 498 ( 499 InterfaceElement | 500 element comment { text } 501 ) * 502 } 503 ) * 504} 505 506# Each <spirvextension> define a SPIR-V extension that can be used in the API. 507# Each <spirvcapability> define a SPIR-V capability that can be used in the API. 508# Contains information to both generate table in spec as well as validation 509# what needs to be enabled be used in Vulkan 510SpirvExtensions = element spirvextensions { 511 Comment ? , 512 SpirvExtension * 513} 514 515SpirvExtension = element spirvextension { 516 Name , 517 Enable * 518} 519 520SpirvCapabilities = element spirvcapabilities { 521 Comment ? , 522 SpirvCapability * 523} 524 525SpirvCapability = element spirvcapability { 526 Name , 527 Enable * 528} 529 530# <enable> defines a way to enable the parent element in the API. 531# If anyone of the <enable> elements are valid then the parent element 532# can be used. 533# 534# There are four forms of the tag. 535# 536# The first only has the minimal version of Vulkan of the application 537# 538# The second only has a single Vulkan extension that must be enabled 539# 540# The third has a single Vulkan feature with the struct where it is from 541# 542# The forth has a property struct, the member field in it, and the value 543# that must be present 544# 545# To make scripting easier, each <enable> has a require attribute to map 546# to the asciidoctor conditional logic in the spec. For version and 547# extension attribute variations, there is no need for the require attribute 548# since it is a redundant 1:1 mapping. 549# 550# The 'alias' attribute is used in cases where the anchor link can't be 551# propertly resolved and needs a manual name to link to 552Enable = element enable { 553 ( 554 attribute version { text } ) | 555 ( 556 attribute extension { text } ) | 557 ( 558 attribute struct { text }, 559 attribute feature { text }, 560 attribute requires { text }, 561 attribute alias { text } ? ) | 562 ( 563 attribute property { text }, 564 attribute member { text }, 565 attribute value { text }, 566 attribute requires { text } ? ) 567} 568 569# Contents of a <require> / <remove> tag, defining a group 570# of features to require or remove. 571# <type> / <enum> / <command> all have attributes 572# name - feature name which must match 573InterfaceElement = 574 element type { 575 Name , 576 Comment ? 577 } | 578 Enum | 579 element command { 580 Name , 581 Comment ? 582 } 583 584# Integers are allowed to be either decimal or C-hex (0x[0-9A-F]+), but 585# XML Schema types don't seem to support hex notation, so we use this 586# as a placeholder. 587Integer = text 588 589# EnumName is an compile-time constant name 590EnumName = text 591 592# TypeName is an argument/return value C type name 593TypeName = text 594 595# TypeSuffix is a C numeric type suffix, e.g. 'u' or 'ull' 596TypeSuffix = text 597 598# StringGroup is a regular expression with an implicit 599# '^(' and ')$' bracketing it. 600StringGroup = text 601 602# Repeatedly used attributes 603ProfileName = attribute profile { text } 604ExtensionName = attribute extension { text } 605FeatureName = attribute feature { text } 606Vendor = attribute vendor { text } 607Comment = attribute comment { text } 608Name = attribute name { text } 609 610 611