aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorLionel Landwerlin <lionel.g.landwerlin@intel.com>2021-12-09 17:43:51 +0200
committerCharles Giessen <46324611+charles-lunarg@users.noreply.github.com>2021-12-12 15:23:54 -0700
commitd3cdb64f2ef5e806f2b3ac43c5428105514ae838 (patch)
treecf68ffe1d2e2feeaabfbe2384f57ace02ecd504c /scripts
parent08f87babadc491b12f34fe6a8692a97bbabb4b2d (diff)
downloadusermoji-d3cdb64f2ef5e806f2b3ac43c5428105514ae838.tar.xz
scripts: Fix codegen to support VK_KHR_format_feature_flags2
If the implementation reports that it supports this feature, it should fill out VkFormatProperties3KHR properly.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/mock_icd_generator.py6
-rw-r--r--scripts/vulkan_tools_helper_file_generator.py25
2 files changed, 29 insertions, 2 deletions
diff --git a/scripts/mock_icd_generator.py b/scripts/mock_icd_generator.py
index 8cc94621..a2360b5f 100644
--- a/scripts/mock_icd_generator.py
+++ b/scripts/mock_icd_generator.py
@@ -761,6 +761,12 @@ CUSTOM_C_INTERCEPTS = {
''',
'vkGetPhysicalDeviceFormatProperties2KHR': '''
GetPhysicalDeviceFormatProperties(physicalDevice, format, &pFormatProperties->formatProperties);
+ VkFormatProperties3KHR *props_3 = lvl_find_mod_in_chain<VkFormatProperties3KHR>(pFormatProperties->pNext);
+ if (props_3) {
+ props_3->linearTilingFeatures = pFormatProperties->formatProperties.linearTilingFeatures;
+ props_3->optimalTilingFeatures = pFormatProperties->formatProperties.optimalTilingFeatures;
+ props_3->bufferFeatures = pFormatProperties->formatProperties.bufferFeatures;
+ }
''',
'vkGetPhysicalDeviceImageFormatProperties': '''
// A hardcoded unsupported format
diff --git a/scripts/vulkan_tools_helper_file_generator.py b/scripts/vulkan_tools_helper_file_generator.py
index 42ce0199..b0e486ef 100644
--- a/scripts/vulkan_tools_helper_file_generator.py
+++ b/scripts/vulkan_tools_helper_file_generator.py
@@ -1102,9 +1102,11 @@ class HelperFileOutputGenerator(OutputGenerator):
id_member = 'kSType'
id_decl = 'static const VkStructureType '
generic_header = prefix + 'GenericHeader'
+ generic_mod_header = prefix + 'GenericModHeader'
typename_func = fprefix + 'typename'
idname_func = fprefix + 'stype_name'
find_func = fprefix + 'find_in_chain'
+ find_mod_func = fprefix + 'find_mod_in_chain'
init_func = fprefix + 'init_struct'
explanatory_comment = '\n'.join((
@@ -1130,6 +1132,10 @@ class HelperFileOutputGenerator(OutputGenerator):
' VkStructureType sType;',
' const {header} *pNext;',
'}};',
+ 'struct {mod_header} {{',
+ ' VkStructureType sType;',
+ ' {mod_header} *pNext;',
+ '}};',
'',
'// Find an entry of the given type in the pNext chain',
'template <typename T> const T *{find_func}(const void *next) {{',
@@ -1145,6 +1151,20 @@ class HelperFileOutputGenerator(OutputGenerator):
' }}',
' return found;',
'}}',
+ '// Find an entry of the given type in the pNext chain',
+ 'template <typename T> T *{find_mod_func}(void *next) {{',
+ ' {mod_header} *current = reinterpret_cast<{mod_header} *>(next);',
+ ' T *found = nullptr;',
+ ' while (current) {{',
+ ' if ({type_map}<T>::{id_member} == current->sType) {{',
+ ' found = reinterpret_cast<T*>(current);',
+ ' current = nullptr;',
+ ' }} else {{',
+ ' current = current->pNext;',
+ ' }}',
+ ' }}',
+ ' return found;',
+ '}}',
'',
'// Init the header of an sType struct with pNext',
'template <typename T> T {init_func}(void *p_next) {{',
@@ -1194,8 +1214,9 @@ class HelperFileOutputGenerator(OutputGenerator):
# Generate utilities for all types
code.append('\n'.join((
utilities_format.format(id_member=id_member, id_map=idmap, type_map=typemap,
- type_member=type_member, header=generic_header, typename_func=typename_func, idname_func=idname_func,
- find_func=find_func, init_func=init_func), ''
+ type_member=type_member, header=generic_header, mod_header=generic_mod_header,
+ typename_func=typename_func, idname_func=idname_func, find_func=find_func,
+ find_mod_func=find_mod_func, init_func=init_func), ''
)))
return "\n".join(code)