Skip to content

Commit 1139879

Browse files
committed
Merge branch 'main' of github.com:KhronosGroup/Vulkan-Docs into github-main
2 parents 65a8d8f + 76aec26 commit 1139879

File tree

5 files changed

+79
-128
lines changed

5 files changed

+79
-128
lines changed

appendices/boilerplate.adoc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,18 @@ the predefined preprocessor check does not identify the desired
256256
configuration.
257257
====
258258

259+
[NOTE]
260+
.Note
261+
====
262+
This macro was introduced starting with the Vulkan 1.2.174 headers, and its
263+
availability can be checked at compile time by requiring
264+
`dname:VK_HEADER_VERSION >= 174`.
265+
266+
It is not available if you are using older headers, such as may be shipped
267+
with an older Vulkan SDK.
268+
Developers requiring this functionality may wish to include a copy of the
269+
current Vulkan headers with their project in this case.
270+
====
259271
--
260272

261273
[[boilerplate-wsi-header]]

appendices/spirvenv.adoc

Lines changed: 5 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -614,6 +614,10 @@ ifndef::VK_VERSION_1_3,VK_KHR_format_feature_flags2[]
614614
operand of 2 and an "`Image Format`" operand of code:Unknown must: be
615615
decorated with code:NonReadable.
616616
endif::VK_VERSION_1_3,VK_KHR_format_feature_flags2[]
617+
* code:OpImageWrite to any code:Image whose code:Image code:Format is not
618+
code:Unknown must: have the code:Texel operand contain at least
619+
as many components as the corresponding elink:VkFormat as given in the
620+
<<spirvenv-image-formats,SPIR-V Image Format compatibility table>>
617621
* [[VUID-{refpage}-Location-06272]]
618622
The sum of code:Location and the number of locations the variable it
619623
decorates consumes must: be less than or equal to the value for the
@@ -1929,46 +1933,5 @@ values as defined below:
19291933
[cols="2*", options="header"]
19301934
|====
19311935
|SPIR-V Image Format |Compatible Vulkan Format
1932-
|code:Unknown |Any
1933-
|code:Rgba32f |ename:VK_FORMAT_R32G32B32A32_SFLOAT
1934-
|code:Rgba16f |ename:VK_FORMAT_R16G16B16A16_SFLOAT
1935-
|code:R32f |ename:VK_FORMAT_R32_SFLOAT
1936-
|code:Rgba8 |ename:VK_FORMAT_R8G8B8A8_UNORM
1937-
|code:Rgba8Snorm |ename:VK_FORMAT_R8G8B8A8_SNORM
1938-
|code:Rg32f |ename:VK_FORMAT_R32G32_SFLOAT
1939-
|code:Rg16f |ename:VK_FORMAT_R16G16_SFLOAT
1940-
|code:R11fG11fB10f |ename:VK_FORMAT_B10G11R11_UFLOAT_PACK32
1941-
|code:R16f |ename:VK_FORMAT_R16_SFLOAT
1942-
|code:Rgba16 |ename:VK_FORMAT_R16G16B16A16_UNORM
1943-
|code:Rgb10A2 |ename:VK_FORMAT_A2B10G10R10_UNORM_PACK32
1944-
|code:Rg16 |ename:VK_FORMAT_R16G16_UNORM
1945-
|code:Rg8 |ename:VK_FORMAT_R8G8_UNORM
1946-
|code:R16 |ename:VK_FORMAT_R16_UNORM
1947-
|code:R8 |ename:VK_FORMAT_R8_UNORM
1948-
|code:Rgba16Snorm |ename:VK_FORMAT_R16G16B16A16_SNORM
1949-
|code:Rg16Snorm |ename:VK_FORMAT_R16G16_SNORM
1950-
|code:Rg8Snorm |ename:VK_FORMAT_R8G8_SNORM
1951-
|code:R16Snorm |ename:VK_FORMAT_R16_SNORM
1952-
|code:R8Snorm |ename:VK_FORMAT_R8_SNORM
1953-
|code:Rgba32i |ename:VK_FORMAT_R32G32B32A32_SINT
1954-
|code:Rgba16i |ename:VK_FORMAT_R16G16B16A16_SINT
1955-
|code:Rgba8i |ename:VK_FORMAT_R8G8B8A8_SINT
1956-
|code:R32i |ename:VK_FORMAT_R32_SINT
1957-
|code:Rg32i |ename:VK_FORMAT_R32G32_SINT
1958-
|code:Rg16i |ename:VK_FORMAT_R16G16_SINT
1959-
|code:Rg8i |ename:VK_FORMAT_R8G8_SINT
1960-
|code:R16i |ename:VK_FORMAT_R16_SINT
1961-
|code:R8i |ename:VK_FORMAT_R8_SINT
1962-
|code:Rgba32ui |ename:VK_FORMAT_R32G32B32A32_UINT
1963-
|code:Rgba16ui |ename:VK_FORMAT_R16G16B16A16_UINT
1964-
|code:Rgba8ui |ename:VK_FORMAT_R8G8B8A8_UINT
1965-
|code:R32ui |ename:VK_FORMAT_R32_UINT
1966-
|code:Rgb10a2ui |ename:VK_FORMAT_A2B10G10R10_UINT_PACK32
1967-
|code:Rg32ui |ename:VK_FORMAT_R32G32_UINT
1968-
|code:Rg16ui |ename:VK_FORMAT_R16G16_UINT
1969-
|code:Rg8ui |ename:VK_FORMAT_R8G8_UINT
1970-
|code:R16ui |ename:VK_FORMAT_R16_UINT
1971-
|code:R8ui |ename:VK_FORMAT_R8_UINT
1972-
|code:R64i |ename:VK_FORMAT_R64_SINT
1973-
|code:R64ui |ename:VK_FORMAT_R64_UINT
1936+
include::{generated}/formats/spirvimageformat.txt[]
19741937
|====

chapters/formats.adoc

Lines changed: 1 addition & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -1301,92 +1301,7 @@ Classes>>.
13011301
[width="95%",cols="1,6,3,3",options="header"]
13021302
|====
13031303
^| Plane ^| Compatible format for plane ^| Width relative to the width _w_ of the plane with the largest dimensions ^| Height relative to the height _h_ of the plane with the largest dimensions
1304-
4+| *ename:VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM*
1305-
^| 0 ^| ename:VK_FORMAT_R8_UNORM ^| w ^| h
1306-
^| 1 ^| ename:VK_FORMAT_R8_UNORM ^| w/2 ^| h/2
1307-
^| 2 ^| ename:VK_FORMAT_R8_UNORM ^| w/2 ^| h/2
1308-
4+| *ename:VK_FORMAT_G8_B8R8_2PLANE_420_UNORM*
1309-
^| 0 ^| ename:VK_FORMAT_R8_UNORM ^| w ^| h
1310-
^| 1 ^| ename:VK_FORMAT_R8G8_UNORM ^| w/2 ^| h/2
1311-
4+| *ename:VK_FORMAT_G8_B8_R8_3PLANE_422_UNORM*
1312-
^| 0 ^| ename:VK_FORMAT_R8_UNORM ^| w ^| h
1313-
^| 1 ^| ename:VK_FORMAT_R8_UNORM ^| w/2 ^| h
1314-
^| 2 ^| ename:VK_FORMAT_R8_UNORM ^| w/2 ^| h
1315-
4+| *ename:VK_FORMAT_G8_B8R8_2PLANE_422_UNORM*
1316-
^| 0 ^| ename:VK_FORMAT_R8_UNORM ^| w ^| h
1317-
^| 1 ^| ename:VK_FORMAT_R8G8_UNORM ^| w/2 ^| h
1318-
4+| *ename:VK_FORMAT_G8_B8_R8_3PLANE_444_UNORM*
1319-
^| 0 ^| ename:VK_FORMAT_R8_UNORM ^| w ^| h
1320-
^| 1 ^| ename:VK_FORMAT_R8_UNORM ^| w ^| h
1321-
^| 2 ^| ename:VK_FORMAT_R8_UNORM ^| w ^| h
1322-
4+| *ename:VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_420_UNORM_3PACK16*
1323-
^| 0 ^| ename:VK_FORMAT_R10X6_UNORM_PACK16 ^| w ^| h
1324-
^| 1 ^| ename:VK_FORMAT_R10X6_UNORM_PACK16 ^| w/2 ^| h/2
1325-
^| 2 ^| ename:VK_FORMAT_R10X6_UNORM_PACK16 ^| w/2 ^| h/2
1326-
4+| *ename:VK_FORMAT_G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16*
1327-
^| 0 ^| ename:VK_FORMAT_R10X6_UNORM_PACK16 ^| w ^| h
1328-
^| 1 ^| ename:VK_FORMAT_R10X6G10X6_UNORM_2PACK16 ^| w/2 ^| h/2
1329-
4+| *ename:VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_422_UNORM_3PACK16*
1330-
^| 0 ^| ename:VK_FORMAT_R10X6_UNORM_PACK16 ^| w ^| h
1331-
^| 1 ^| ename:VK_FORMAT_R10X6_UNORM_PACK16 ^| w/2 ^| h
1332-
^| 2 ^| ename:VK_FORMAT_R10X6_UNORM_PACK16 ^| w/2 ^| h
1333-
4+| *ename:VK_FORMAT_G10X6_B10X6R10X6_2PLANE_422_UNORM_3PACK16*
1334-
^| 0 ^| ename:VK_FORMAT_R10X6_UNORM_PACK16 ^| w ^| h
1335-
^| 1 ^| ename:VK_FORMAT_R10X6G10X6_UNORM_2PACK16 ^| w/2 ^| h
1336-
4+| *ename:VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_444_UNORM_3PACK16*
1337-
^| 0 ^| ename:VK_FORMAT_R10X6_UNORM_PACK16 ^| w ^| h
1338-
^| 1 ^| ename:VK_FORMAT_R10X6_UNORM_PACK16 ^| w ^| h
1339-
^| 2 ^| ename:VK_FORMAT_R10X6_UNORM_PACK16 ^| w ^| h
1340-
4+| *ename:VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_420_UNORM_3PACK16*
1341-
^| 0 ^| ename:VK_FORMAT_R12X4_UNORM_PACK16 ^| w ^| h
1342-
^| 1 ^| ename:VK_FORMAT_R12X4_UNORM_PACK16 ^| w/2 ^| h/2
1343-
^| 2 ^| ename:VK_FORMAT_R12X4_UNORM_PACK16 ^| w/2 ^| h/2
1344-
4+| *ename:VK_FORMAT_G12X4_B12X4R12X4_2PLANE_420_UNORM_3PACK16*
1345-
^| 0 ^| ename:VK_FORMAT_R12X4_UNORM_PACK16 ^| w ^| h
1346-
^| 1 ^| ename:VK_FORMAT_R12X4G12X4_UNORM_2PACK16 ^| w/2 ^| h/2
1347-
4+| *ename:VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_422_UNORM_3PACK16*
1348-
^| 0 ^| ename:VK_FORMAT_R12X4_UNORM_PACK16 ^| w ^| h
1349-
^| 1 ^| ename:VK_FORMAT_R12X4_UNORM_PACK16 ^| w/2 ^| h
1350-
^| 2 ^| ename:VK_FORMAT_R12X4_UNORM_PACK16 ^| w/2 ^| h
1351-
4+| *ename:VK_FORMAT_G12X4_B12X4R12X4_2PLANE_422_UNORM_3PACK16*
1352-
^| 0 ^| ename:VK_FORMAT_R12X4_UNORM_PACK16 ^| w ^| h
1353-
^| 1 ^| ename:VK_FORMAT_R12X4G12X4_UNORM_2PACK16 ^| w/2 ^| h
1354-
4+| *ename:VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_444_UNORM_3PACK16*
1355-
^| 0 ^| ename:VK_FORMAT_R12X4_UNORM_PACK16 ^| w ^| h
1356-
^| 1 ^| ename:VK_FORMAT_R12X4_UNORM_PACK16 ^| w ^| h
1357-
^| 2 ^| ename:VK_FORMAT_R12X4_UNORM_PACK16 ^| w ^| h
1358-
4+| *ename:VK_FORMAT_G16_B16_R16_3PLANE_420_UNORM*
1359-
^| 0 ^| ename:VK_FORMAT_R16_UNORM ^| w ^| h
1360-
^| 1 ^| ename:VK_FORMAT_R16_UNORM ^| w/2 ^| h/2
1361-
^| 2 ^| ename:VK_FORMAT_R16_UNORM ^| w/2 ^| h/2
1362-
4+| *ename:VK_FORMAT_G16_B16R16_2PLANE_420_UNORM*
1363-
^| 0 ^| ename:VK_FORMAT_R16_UNORM ^| w ^| h
1364-
^| 1 ^| ename:VK_FORMAT_R16G16_UNORM ^| w/2 ^| h/2
1365-
4+| *ename:VK_FORMAT_G16_B16_R16_3PLANE_422_UNORM*
1366-
^| 0 ^| ename:VK_FORMAT_R16_UNORM ^| w ^| h
1367-
^| 1 ^| ename:VK_FORMAT_R16_UNORM ^| w/2 ^| h
1368-
^| 2 ^| ename:VK_FORMAT_R16_UNORM ^| w/2 ^| h
1369-
4+| *ename:VK_FORMAT_G16_B16R16_2PLANE_422_UNORM*
1370-
^| 0 ^| ename:VK_FORMAT_R16_UNORM ^| w ^| h
1371-
^| 1 ^| ename:VK_FORMAT_R16G16_UNORM ^| w/2 ^| h
1372-
4+| *ename:VK_FORMAT_G16_B16_R16_3PLANE_444_UNORM*
1373-
^| 0 ^| ename:VK_FORMAT_R16_UNORM ^| w ^| h
1374-
^| 1 ^| ename:VK_FORMAT_R16_UNORM ^| w ^| h
1375-
^| 2 ^| ename:VK_FORMAT_R16_UNORM ^| w ^| h
1376-
ifdef::VK_VERSION_1_3,VK_EXT_ycbcr_2plane_444_formats[]
1377-
4+| *ename:VK_FORMAT_G8_B8R8_2PLANE_444_UNORM*
1378-
^| 0 ^| ename:VK_FORMAT_R8_UNORM ^| w ^| h
1379-
^| 1 ^| ename:VK_FORMAT_R8G8_UNORM ^| w ^| h
1380-
4+| *ename:VK_FORMAT_G10X6_B10X6R10X6_2PLANE_444_UNORM_3PACK16*
1381-
^| 0 ^| ename:VK_FORMAT_R10X6_UNORM_PACK16 ^| w ^| h
1382-
^| 1 ^| ename:VK_FORMAT_R10X6G10X6_UNORM_2PACK16 ^| w ^| h
1383-
4+| *ename:VK_FORMAT_G12X4_B12X4R12X4_2PLANE_444_UNORM_3PACK16*
1384-
^| 0 ^| ename:VK_FORMAT_R12X4_UNORM_PACK16 ^| w ^| h
1385-
^| 1 ^| ename:VK_FORMAT_R12X4G12X4_UNORM_2PACK16 ^| w ^| h
1386-
4+| *ename:VK_FORMAT_G16_B16R16_2PLANE_444_UNORM*
1387-
^| 0 ^| ename:VK_FORMAT_R16_UNORM ^| w ^| h
1388-
^| 1 ^| ename:VK_FORMAT_R16G16_UNORM ^| w ^| h
1389-
endif::VK_VERSION_1_3,VK_EXT_ycbcr_2plane_444_formats[]
1304+
include::{generated}/formats/planeformat.txt[]
13901305
|====
13911306

13921307
endif::VK_VERSION_1_1,VK_KHR_sampler_ycbcr_conversion[]

scripts/formatsgenerator.py

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ def beginFile(self, genOpts):
3535
self.format_classes = dict()
3636
# {'packedSize' : ['format', 'format', ...]}
3737
self.packed_info = dict()
38+
# {VkFormat : SpirvFormat}
39+
self.spirv_image_format = dict()
40+
# <format, [{plane_info}, ...]>
41+
self.plane_format = dict()
3842

3943
def endFile(self):
4044

@@ -107,6 +111,41 @@ def endFile(self):
107111
packed_table.append('endif::{}[]'.format(condition))
108112
self.writeBlock(f'packed{self.file_suffix}', packed_table)
109113

114+
# Generate SPIR-V Image Format Compatibility
115+
spirv_image_format_table = []
116+
spirv_image_format_table.append('|code:Unknown|Any')
117+
for vk_format, spirv_format in self.spirv_image_format.items():
118+
spirv_image_format_table.append('|code:{}|ename:{}'.format(spirv_format, vk_format))
119+
self.writeBlock('spirvimageformat.txt', spirv_image_format_table)
120+
121+
# Generate Plane Format Compatibility Table
122+
plane_format_table = []
123+
for format_name, plane_infos in self.plane_format.items():
124+
format_condition = self.format_conditions[format_name]
125+
# The table is already in a ifdef::VK_VERSION_1_1,VK_KHR_sampler_ycbcr_conversion[]
126+
# so no need to duplicate the condition
127+
add_condition = False if format_condition == 'None' or format_condition == 'VK_VERSION_1_1,VK_KHR_sampler_ycbcr_conversion' else True
128+
129+
if add_condition:
130+
plane_format_table.append('ifdef::{}[]'.format(format_condition))
131+
132+
plane_format_table.append('4+| *ename:{}*'.format(format_name))
133+
for plane_info in plane_infos:
134+
width_divisor = 'w'
135+
height_divisor = 'h'
136+
if plane_info['widthDivisor'] != 1:
137+
width_divisor += '/{}'.format(plane_info['widthDivisor'])
138+
if plane_info['heightDivisor'] != 1:
139+
height_divisor += '/{}'.format(plane_info['heightDivisor'])
140+
141+
plane_format_table.append('^| {} ^| ename:{} ^| {} ^| {}'.format(plane_info['index'],
142+
plane_info['compatible'],
143+
width_divisor,
144+
height_divisor))
145+
if add_condition:
146+
plane_format_table.append('endif::{}[]'.format(format_condition))
147+
self.writeBlock('planeformat.txt', plane_format_table)
148+
110149
# Finish processing in superclass
111150
OutputGenerator.endFile(self)
112151

@@ -167,3 +206,19 @@ def genFormat(self, format, formatinfo, alias):
167206
if packed not in self.packed_info:
168207
self.packed_info[packed] = []
169208
self.packed_info[packed].append(format_name)
209+
210+
# Currently there is only at most one <spirvimageformat>
211+
spirv_image_format = elem.find('spirvimageformat')
212+
if (spirv_image_format is not None):
213+
self.spirv_image_format[format_name] = spirv_image_format.get('name')
214+
215+
for plane in elem.iterfind('plane'):
216+
if format_name not in self.plane_format:
217+
# create list if first time
218+
self.plane_format[format_name] = []
219+
self.plane_format[format_name].append({
220+
'index' : int(plane.get('index')),
221+
'widthDivisor' : int(plane.get('widthDivisor')),
222+
'heightDivisor' : int(plane.get('heightDivisor')),
223+
'compatible' : plane.get('compatible'),
224+
})

scripts/xml_consistency.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -575,6 +575,12 @@ def check_format(self):
575575
if info.elem.get('chroma') and info.elem.get('chroma') not in valid_chroma:
576576
self.record_error('The <format> has chroma is not a valid value for', name)
577577

578+
# The formatsgenerator.py assumes only 1 <spirvimageformat> tag.
579+
# If this changes in the future, remove this warning and update generator script
580+
spirv_image_format = info.elem.findall('spirvimageformat')
581+
if len(spirv_image_format) > 1:
582+
self.record_error('More than 1 <spirvimageformat> but formatsgenerator.py is not updated, for format', name)
583+
578584
# Re-loop to check the other way if the <format> is missing
579585
for enum in self.reg.groupdict['VkFormat'].elem:
580586
name = enum.get('name')

0 commit comments

Comments
 (0)