$(intermediates)/util/vk_enum_to_str.h: $(intermediates)/util/vk_enum_to_str.c
+$(intermediates)/util/vk_common_entrypoints.c: $(MESA_TOP)/src/vulkan/util/vk_entrypoints_gen.py \
+ $(vulkan_api_xml)
+ @echo "target Generated: $(PRIVATE_MODULE) <= $(notdir $(@))"
+ @mkdir -p $(dir $@)
+ $(hide) $(MESA_PYTHON2) $< \
+ --xml $(vulkan_api_xml) \
+ --proto --weak --prefix vk_common \
+ --out-c $@ --out-h $(dir $@)/vk_common_entrypoints.h
+
+$(intermediates)/util/vk_common_entrypoints.h: $(intermediates)/util/vk_common_entrypoints.c
+
$(intermediates)/util/vk_dispatch_table.c: $(MESA_TOP)/src/vulkan/util/vk_dispatch_table_gen.py \
$(vulkan_api_xml)
@echo "target Generated: $(PRIVATE_MODULE) <= $(notdir $(@))"
VULKAN_UTIL_GENERATED_FILES := \
util/vk_enum_to_str.c \
util/vk_enum_to_str.h \
+ util/vk_common_entrypoints.c \
+ util/vk_common_entrypoints.h \
util/vk_dispatch_table.c \
util/vk_dispatch_table.h \
util/vk_extensions.c \
'vk_util.h',
)
+vk_common_entrypoints = custom_target(
+ 'vk_common_entrypoints',
+ input : [vk_entrypoints_gen, vk_api_xml],
+ output : ['vk_common_entrypoints.h', 'vk_common_entrypoints.c'],
+ command : [
+ prog_python, '@INPUT0@', '--xml', '@INPUT1@', '--proto', '--weak',
+ '--out-h', '@OUTPUT0@', '--out-c', '@OUTPUT1@', '--prefix', 'vk_common',
+ ],
+)
+
vk_dispatch_table = custom_target(
'vk_dispatch_table',
input : ['vk_dispatch_table_gen.py', vk_api_xml],
libvulkan_util = static_library(
'vulkan_util',
- [files_vulkan_util, vk_dispatch_table, vk_enum_to_str, vk_extensions],
+ [files_vulkan_util, vk_common_entrypoints, vk_dispatch_table,
+ vk_enum_to_str, vk_extensions],
include_directories : [inc_include, inc_src, inc_gallium],
dependencies : [vulkan_wsi_deps, idep_mesautil],
c_args : [vulkan_wsi_args],
)
idep_vulkan_util = declare_dependency(
- link_with : libvulkan_util,
+ # Instruct users of this library to link with --whole-archive. Otherwise,
+ # our weak function overloads may not resolve properly.
+ link_whole : libvulkan_util,
dependencies : idep_vulkan_util_headers
)
#include "vk_device.h"
+#include "vk_common_entrypoints.h"
#include "vk_instance.h"
#include "vk_physical_device.h"
#include "util/hash_table.h"
device->physical = physical_device;
- if (dispatch_table != NULL)
+ if (dispatch_table != NULL) {
device->dispatch_table = *dispatch_table;
+ /* Add common entrypoints without overwriting driver-provided ones. */
+ vk_device_dispatch_table_from_entrypoints(
+ &device->dispatch_table, &vk_common_device_entrypoints, false);
+ }
+
if (physical_device != NULL) {
for (uint32_t i = 0; i < pCreateInfo->enabledExtensionCount; i++) {
int idx;
#include "vk_instance.h"
#include "vk_alloc.h"
+#include "vk_common_entrypoints.h"
VkResult
vk_instance_init(struct vk_instance *instance,
}
}
- if (dispatch_table != NULL)
+ if (dispatch_table != NULL) {
instance->dispatch_table = *dispatch_table;
+ /* Add common entrypoints without overwriting driver-provided ones. */
+ vk_instance_dispatch_table_from_entrypoints(
+ &instance->dispatch_table, &vk_common_instance_entrypoints, false);
+ }
+
return VK_SUCCESS;
}
#include "vk_physical_device.h"
+#include "vk_common_entrypoints.h"
+
VkResult
vk_physical_device_init(struct vk_physical_device *pdevice,
struct vk_instance *instance,
if (supported_extensions != NULL)
pdevice->supported_extensions = *supported_extensions;
- if (dispatch_table != NULL)
+ if (dispatch_table != NULL) {
pdevice->dispatch_table = *dispatch_table;
+ /* Add common entrypoints without overwriting driver-provided ones. */
+ vk_physical_device_dispatch_table_from_entrypoints(
+ &pdevice->dispatch_table, &vk_common_physical_device_entrypoints, false);
+ }
+
return VK_SUCCESS;
}