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