Skip to content

Commit

Permalink
build: Update to header 1.3.293
Browse files Browse the repository at this point in the history
loader_extension_generator.py needed a tweak to handle boolean logic in
the vk.xml extension dependency attributes.  Now that the dependency is
encoded in vk.xml we don't need to manually turn on device_group for
drivers >= 1.1. We DO need to track the driver api version since the xml
expressions references it.
  • Loading branch information
mikes-lunarg committed Aug 16, 2024
1 parent 83cd92c commit 2804c25
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 13 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# ~~~
cmake_minimum_required(VERSION 3.17.2)

project(VULKAN_LOADER VERSION 1.3.292 LANGUAGES C)
project(VULKAN_LOADER VERSION 1.3.293 LANGUAGES C)

option(CODE_COVERAGE "Enable Code Coverage" OFF)
if (CODE_COVERAGE)
Expand Down
4 changes: 2 additions & 2 deletions loader/generated/vk_loader_extensions.c
Original file line number Diff line number Diff line change
Expand Up @@ -1500,7 +1500,7 @@ void init_extension_device_proc_terminator_dispatch(struct loader_device *dev) {
dispatch->CmdInsertDebugUtilsLabelEXT = (PFN_vkCmdInsertDebugUtilsLabelEXT)gpda(dev->icd_device, "vkCmdInsertDebugUtilsLabelEXT");
#if defined(VK_USE_PLATFORM_WIN32_KHR)
// ---- VK_EXT_full_screen_exclusive extension commands
if (dev->driver_extensions.ext_full_screen_exclusive_enabled && dev->driver_extensions.khr_device_group_enabled)
if (dev->driver_extensions.ext_full_screen_exclusive_enabled && (dev->driver_extensions.khr_device_group_enabled || dev->driver_extensions.version_1_1_enabled))
dispatch->GetDeviceGroupSurfacePresentModes2EXT = (PFN_vkGetDeviceGroupSurfacePresentModes2EXT)gpda(dev->icd_device, "vkGetDeviceGroupSurfacePresentModes2EXT");
#endif // VK_USE_PLATFORM_WIN32_KHR
}
Expand Down Expand Up @@ -11975,7 +11975,7 @@ PFN_vkVoidFunction get_extension_device_proc_terminator(struct loader_device *de
// ---- VK_EXT_full_screen_exclusive extension commands
if (!strcmp(name, "GetDeviceGroupSurfacePresentModes2EXT")) {
*found_name = true;
return dev->driver_extensions.ext_full_screen_exclusive_enabled && dev->driver_extensions.khr_device_group_enabled ?
return (dev->driver_extensions.ext_full_screen_exclusive_enabled && (dev->driver_extensions.khr_device_group_enabled || dev->driver_extensions.version_1_1_enabled)) ?
(PFN_vkVoidFunction)terminator_GetDeviceGroupSurfacePresentModes2EXT : NULL;
}
#endif // VK_USE_PLATFORM_WIN32_KHR
Expand Down
16 changes: 11 additions & 5 deletions loader/loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -5938,8 +5938,10 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDevice(VkPhysicalDevice physical
dev->driver_extensions.khr_device_group_enabled = true;
} else if (!strcmp(localCreateInfo.ppEnabledExtensionNames[i], VK_EXT_DEBUG_MARKER_EXTENSION_NAME)) {
dev->driver_extensions.ext_debug_marker_enabled = true;
} else if (!strcmp(localCreateInfo.ppEnabledExtensionNames[i], "VK_EXT_full_screen_exclusive")) {
#if defined(VK_USE_PLATFORM_WIN32_KHR)
} else if (!strcmp(localCreateInfo.ppEnabledExtensionNames[i], VK_EXT_FULL_SCREEN_EXCLUSIVE_EXTENSION_NAME)) {
dev->driver_extensions.ext_full_screen_exclusive_enabled = true;
#endif
} else if (!strcmp(localCreateInfo.ppEnabledExtensionNames[i], VK_KHR_MAINTENANCE_5_EXTENSION_NAME) &&
maintenance5_feature_enabled) {
dev->should_ignore_device_commands_from_newer_version = true;
Expand All @@ -5950,10 +5952,14 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDevice(VkPhysicalDevice physical

VkPhysicalDeviceProperties properties;
icd_term->dispatch.GetPhysicalDeviceProperties(phys_dev_term->phys_dev, &properties);
if (!dev->driver_extensions.khr_device_group_enabled) {
if (properties.apiVersion >= VK_API_VERSION_1_1) {
dev->driver_extensions.khr_device_group_enabled = true;
}
if (properties.apiVersion >= VK_API_VERSION_1_1) {
dev->driver_extensions.version_1_1_enabled = true;
}
if (properties.apiVersion >= VK_API_VERSION_1_2) {
dev->driver_extensions.version_1_2_enabled = true;
}
if (properties.apiVersion >= VK_API_VERSION_1_3) {
dev->driver_extensions.version_1_3_enabled = true;
}

loader_log(icd_term->this_instance, VULKAN_LOADER_LAYER_BIT | VULKAN_LOADER_DRIVER_BIT, 0,
Expand Down
4 changes: 2 additions & 2 deletions loader/loader.rc
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
#include "winres.h"

// All set through CMake
#define VER_FILE_VERSION 1, 3, 292, 0
#define VER_FILE_DESCRIPTION_STR "1.3.292.Dev Build"
#define VER_FILE_VERSION 1, 3, 293, 0
#define VER_FILE_DESCRIPTION_STR "1.3.293.Dev Build"
#define VER_FILE_VERSION_STR "Vulkan Loader - Dev Build"
#define VER_COPYRIGHT_STR "Copyright (C) 2015-2024"

Expand Down
3 changes: 3 additions & 0 deletions loader/loader_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,9 @@ struct loader_device {
bool ext_debug_marker_enabled;
bool ext_debug_utils_enabled;
bool ext_full_screen_exclusive_enabled;
bool version_1_1_enabled;
bool version_1_2_enabled;
bool version_1_3_enabled;
} driver_extensions;

struct loader_device *next;
Expand Down
2 changes: 1 addition & 1 deletion scripts/known_good.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"sub_dir": "Vulkan-Headers",
"build_dir": "Vulkan-Headers/build",
"install_dir": "Vulkan-Headers/build/install",
"commit": "v1.3.292"
"commit": "v1.3.293"
},
{
"name": "googletest",
Expand Down
16 changes: 14 additions & 2 deletions scripts/loader_extension_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,16 @@ def getTypeNameTuple(self, param):
name = noneStr(elem.text)
return (type, name)

# Convert an XML dependency expression to a C expression, taking a callback to replace extension names
# See https://registry.khronos.org/vulkan/specs/1.3/registry.html#depends-expressions
@staticmethod
def ConvertDependencyExpression(expr, replace_func):
# '(' and ')' can pass through unchanged
expr = re.sub(',', ' || ', expr)
expr = re.sub(r'\+', ' && ', expr)
expr = re.sub(r'\w+', lambda match: replace_func(match.group()), expr)
return expr

def OutputPrototypesInHeader(self):
protos = ''
protos += '// Structures defined externally, but used here\n'
Expand Down Expand Up @@ -1562,7 +1572,8 @@ def DeviceExtensionGetTerminator(self):
term_func += f' if (!strcmp(name, "{ext_cmd.name[2:]}")) {{\n'
term_func += f' *found_name = true;\n'
if ext_cmd.require:
term_func += f' return dev->driver_extensions.{ext_cmd.ext_name[3:].lower()}_enabled && dev->driver_extensions.{ext_cmd.require[3:].lower()}_enabled ?\n'
dep_expr = self.ConvertDependencyExpression(ext_cmd.require, lambda ext_name: f'dev->driver_extensions.{ext_name[3:].lower()}_enabled')
term_func += f' return (dev->driver_extensions.{ext_cmd.ext_name[3:].lower()}_enabled && ({dep_expr})) ?\n'
else:
term_func += f' return dev->driver_extensions.{ext_cmd.ext_name[3:].lower()}_enabled ?\n'
term_func += f' (PFN_vkVoidFunction)terminator_{(ext_cmd.name[2:])} : NULL;\n'
Expand Down Expand Up @@ -1662,7 +1673,8 @@ def InitDeviceFunctionTerminatorDispatchTable(self):


if ext_cmd.require:
term_func += f' if (dev->driver_extensions.{ext_cmd.ext_name[3:].lower()}_enabled && dev->driver_extensions.{ext_cmd.require[3:].lower()}_enabled)\n'
dep_expr = self.ConvertDependencyExpression(ext_cmd.require, lambda ext_name: f'dev->driver_extensions.{ext_name[3:].lower()}_enabled')
term_func += f' if (dev->driver_extensions.{ext_cmd.ext_name[3:].lower()}_enabled && ({dep_expr}))\n'
term_func += f' dispatch->{ext_cmd.name[2:]} = (PFN_{(ext_cmd.name)})gpda(dev->icd_device, "{(ext_cmd.name)}");\n'
else:
term_func += f' if (dev->driver_extensions.{ext_cmd.ext_name[3:].lower()}_enabled)\n'
Expand Down

0 comments on commit 2804c25

Please sign in to comment.