Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/vulkan-sdk-1.3.290' into ubunt…
Browse files Browse the repository at this point in the history
…u/jammy-unstable
  • Loading branch information
johnzupin committed Jul 16, 2024
2 parents 28a9370 + 53a6ba7 commit 04c3bfd
Show file tree
Hide file tree
Showing 9 changed files with 168 additions and 91 deletions.
19 changes: 11 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON)
option(BUILD_CUBE "Build cube" ON)
option(BUILD_VULKANINFO "Build vulkaninfo" ON)
option(BUILD_ICD "Build icd" ON)
option(BUILD_TESTS "Build the tests")
option(BUILD_WERROR "Treat compiler warnings as errors")
# NOTE: Our custom code generation target isn't desirable for system package managers or add_subdirectory users.
# So this target needs to be off by default to avoid obtuse build errors or patches.
option(TOOLS_CODEGEN "Enable helper codegen target")

option(ENABLE_ADDRESS_SANITIZER "Use address sanitization")
if (ENABLE_ADDRESS_SANITIZER)
Expand All @@ -50,13 +55,14 @@ endif()

set_property(GLOBAL PROPERTY USE_FOLDERS ON)

find_package(VulkanHeaders QUIET CONFIG)
find_package(VulkanLoader QUIET CONFIG)
find_package(volk QUIET CONFIG)
find_package(VulkanHeaders QUIET REQUIRED CONFIG)
find_package(volk QUIET REQUIRED CONFIG)
if ((APPLE OR BUILD_TESTS) AND NOT ANDROID)
find_package(VulkanLoader QUIET REQUIRED CONFIG)
endif()

include(GNUInstallDirs)

option(BUILD_WERROR "Treat compiler warnings as errors")
if (BUILD_WERROR)
add_compile_options("$<IF:$<CXX_COMPILER_ID:MSVC>,/WX,-Werror>")
endif()
Expand Down Expand Up @@ -96,9 +102,7 @@ elseif(MSVC)
add_compile_options("/w34245")
endif()

# NOTE: Our custom code generation target isn't desirable for system package managers or add_subdirectory users.
# So this target needs to be off by default to avoid obtuse build errors or patches.
option(TOOLS_CODEGEN "Enable helper codegen target")

if (TOOLS_CODEGEN)
find_package(Python3 REQUIRED QUIET)
add_custom_target(tools_codegen
Expand Down Expand Up @@ -146,7 +150,6 @@ endif()

add_subdirectory(windows-runtime-installer)

option(BUILD_TESTS "Build the tests")
if(BUILD_TESTS)
enable_testing()
add_subdirectory(tests)
Expand Down
2 changes: 1 addition & 1 deletion icd/VkICD_mock_icd.json.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"file_format_version": "1.0.1",
"ICD": {
"library_path": "@JSON_LIBRARY_PATH@",
"api_version": "1.3.289"
"api_version": "1.3.290"
}
}
4 changes: 2 additions & 2 deletions icd/generated/function_declarations.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ static const std::unordered_map<std::string, uint32_t> instance_extension_map =
{"VK_EXT_direct_mode_display", 1},
{"VK_EXT_acquire_xlib_display", 1},
{"VK_EXT_display_surface_counter", 1},
{"VK_EXT_swapchain_colorspace", 4},
{"VK_EXT_swapchain_colorspace", 5},
{"VK_KHR_external_fence_capabilities", 1},
{"VK_KHR_get_surface_capabilities2", 1},
{"VK_KHR_get_display_properties2", 1},
Expand Down Expand Up @@ -140,7 +140,7 @@ static const std::unordered_map<std::string, uint32_t> device_extension_map = {
{"VK_EXT_discard_rectangles", 2},
{"VK_EXT_conservative_rasterization", 1},
{"VK_EXT_depth_clip_enable", 1},
{"VK_EXT_hdr_metadata", 2},
{"VK_EXT_hdr_metadata", 3},
{"VK_KHR_imageless_framebuffer", 1},
{"VK_KHR_create_renderpass2", 1},
{"VK_IMG_relaxed_line_rasterization", 1},
Expand Down
11 changes: 4 additions & 7 deletions scripts/known_good.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@
"sub_dir": "Vulkan-Headers",
"build_dir": "Vulkan-Headers/build",
"install_dir": "Vulkan-Headers/build/install",
"cmake_options": [
"-DVULKAN_HEADERS_ENABLE_MODULE=OFF"
],
"commit": "v1.3.289"
"commit": "v1.3.290"
},
{
"name": "MoltenVK",
Expand Down Expand Up @@ -38,7 +35,7 @@
"cmake_options": [
"-DVOLK_INSTALL=ON"
],
"commit": "vulkan-sdk-1.3.283",
"commit": "vulkan-sdk-1.3.290",
"deps": [
{
"var_name": "VULKAN_HEADERS_INSTALL_DIR",
Expand Down Expand Up @@ -77,7 +74,7 @@
"cmake_options": [
"-DLOADER_USE_UNSAFE_FILE_SEARCH=ON"
],
"commit": "v1.3.289",
"commit": "v1.3.290",
"build_platforms": [
"windows",
"linux",
Expand All @@ -98,4 +95,4 @@
"googletest": "GOOGLETEST_INSTALL_DIR",
"Vulkan-Loader": "VULKAN_LOADER_INSTALL_DIR"
}
}
}
60 changes: 44 additions & 16 deletions scripts/vulkaninfo_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,7 @@
{'extends': 'VkPhysicalDeviceProperties2',
'type': EXTENSION_TYPE_BOTH,
'holder_type': 'VkPhysicalDeviceProperties2',
'print_iterator': True,
'exclude': ['VkPhysicalDeviceHostImageCopyPropertiesEXT', 'VkPhysicalDeviceLayeredApiPropertiesListKHR']}),
'print_iterator': True}),
('phys_device_mem_props2',
{'extends': 'VkPhysicalDeviceMemoryProperties2',
'type': EXTENSION_TYPE_DEVICE,
Expand All @@ -131,7 +130,9 @@
'type': EXTENSION_TYPE_BOTH,
'holder_type': 'VkSurfaceCapabilities2KHR',
'print_iterator': True,
'exclude': ['VkSurfacePresentScalingCapabilitiesEXT', 'VkSurfacePresentModeCompatibilityEXT']}),
'exclude': [# VK_EXT_surface_maintenance1 is difficult to code-gen
'VkSurfacePresentScalingCapabilitiesEXT', 'VkSurfacePresentModeCompatibilityEXT'
]}),
('format_properties2',
{'extends': 'VkFormatProperties2',
'type': EXTENSION_TYPE_DEVICE,
Expand Down Expand Up @@ -318,7 +319,7 @@ def endFile(self):
out += PrintBitMaskToString(bitmask, flag.name, self)

for s in (x for x in self.all_structures if x.name in types_to_gen and x.name not in STRUCT_BLACKLIST):
out += PrintStructure(s, types_to_gen)
out += PrintStructure(s)

for key, value in EXTENSION_CATEGORIES.items():
out += PrintChainStruct(key, self.extension_sets[key], self.all_structures, value, self.extTypes, self.aliases, self.vulkan_versions)
Expand Down Expand Up @@ -600,7 +601,7 @@ def PrintBitMaskToString(bitmask, name, generator):
return out


def PrintStructure(struct, types_to_gen):
def PrintStructure(struct):
if len(struct.members) == 0:
return ''
out = ''
Expand Down Expand Up @@ -655,21 +656,12 @@ def PrintStructure(struct, types_to_gen):
out += f' for (uint32_t i = 0; i < {v.arrayLength}; i++) {{ p.PrintElement(obj.{v.name}[i]); }}\n'
out += ' }\n'
else: # dynamic array length based on other member
out += f' if (obj.{v.arrayLength} == 0) {{\n'
out += f' if (obj.{v.arrayLength} == 0 || obj.{v.name} == nullptr) {{\n'
out += f' p.PrintKeyString("{v.name}", "NULL");\n'
out += ' } else {\n'
out += f' ArrayWrapper arr(p,"{v.name}", obj.{v.arrayLength});\n'
out += f' for (uint32_t i = 0; i < obj.{v.arrayLength}; i++) {{\n'
if v.typeID in types_to_gen:
out += f' if (obj.{v.name} != nullptr) {{\n'
out += ' p.SetElementIndex(i);\n'
out += ' if (p.Type() == OutputType::json)\n'
out += f' p.PrintString(std::string("VK_") + {v.typeID}String(obj.{v.name}[i]));\n'
out += ' else\n'
out += f' p.PrintString({v.typeID}String(obj.{v.name}[i]));\n'
out += ' }\n'
else:
out += f' p.PrintElement(obj.{v.name}[i]);\n'
out += f' Dump{v.typeID}(p, std::to_string(i), obj.{v.name}[i]);\n'
out += ' }\n'
out += ' }\n'
elif v.typeID == 'VkBool32':
Expand Down Expand Up @@ -750,6 +742,10 @@ def PrintChainStruct(listName, structures, all_structures, chain_details, extTyp
# members which don't exist.
if s.name in ['VkPhysicalDeviceShaderIntegerDotProductFeatures', 'VkPhysicalDeviceHostImageCopyFeaturesEXT']:
out += f' char {s.name}_padding[64];\n'
if s.hasLengthmember:
for member in s.members:
if member.lengthMember:
out += f' std::vector<{member.typeID}> {s.name}_{member.name};\n'
out += AddGuardFooter(s)
out += ' void initialize_chain('
if chain_details.get('type') in [EXTENSION_TYPE_INSTANCE, EXTENSION_TYPE_BOTH]:
Expand Down Expand Up @@ -919,6 +915,32 @@ def PrintChainStruct(listName, structures, all_structures, chain_details, extTyp
out += ' }\n'
out += '}\n'

should_print_twocall_func = False
for s in structs_to_print:
if not s.hasLengthmember:
continue
if s.name in STRUCT_BLACKLIST:
continue
should_print_twocall_func = True

if not should_print_twocall_func:
return out

out += '\n'
out += f'void prepare_{listName}_twocall_chain_vectors(std::unique_ptr<{listName}_chain>& chain) {{\n'
for s in structs_to_print:
if not s.hasLengthmember:
continue
if s.name in STRUCT_BLACKLIST:
continue
out += AddGuardHeader(s)
for member in s.members:
if member.lengthMember:
out += f' chain->{s.name}_{member.name}.resize(chain->{s.name[2:]}.{member.arrayLength});\n'
out += f' chain->{s.name[2:]}.{member.name} = chain->{s.name}_{member.name}.data();\n'
out += AddGuardFooter(s)
out += '}\n'

return out


Expand Down Expand Up @@ -1112,12 +1134,18 @@ def __init__(self, name, rootNode, constants, extTypes):
self.guard = None
self.sTypeName = None
self.extendsStruct = rootNode.get('structextends')
self.hasLengthmember = False

for node in rootNode.findall('member'):
if node.get('values') is not None:
self.sTypeName = node.get('values')
self.members.append(VulkanVariable(node, constants))

for member in self.members:
if member.lengthMember:
self.hasLengthmember = True
break

for k, elem in extTypes.items():
if k == self.name:
for e in elem:
Expand Down
Loading

0 comments on commit 04c3bfd

Please sign in to comment.