-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
util: Fixup and add Layer Dispatch Table header
Fixes the vk_layer_dispatch_table.h header file so that they can be used in other projects. The contents of vk_dispatch_table_helper.h have been moved into vk_layer_dispatch_table.h. The structs VkLayerDispatchTable and VkLayerInstanceDispatchTable struct contain function pointers for the device and instance, respectively. The functions layer_init_device_dispatch_table and layer_init_instance_dispatch_table fill out the aforementioned structs, making the task of setting up the disptach table in a layer much simpler.
- Loading branch information
1 parent
8ea7803
commit 7ccda3a
Showing
15 changed files
with
1,803 additions
and
156 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Copyright 2023 The Khronos Group Inc. | ||
// Copyright 2023 Valve Corporation | ||
// Copyright 2023 LunarG, Inc. | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
#include <vulkan/utility/vk_layer_dispatch_table.h> | ||
|
||
PFN_vkVoidFunction local_vkGetInstanceProcAddr(VkInstance instance, const char *pName) { | ||
(void)instance; | ||
(void)pName; | ||
return nullptr; | ||
} | ||
|
||
PFN_vkVoidFunction local_vkGetDeviceProcAddr(VkDevice device, const char *pName) { | ||
(void)device; | ||
(void)pName; | ||
return nullptr; | ||
} | ||
|
||
void foobar() { | ||
VkLayerDispatchTable dispatch_table; | ||
VkLayerInstanceDispatchTable instance_dispatch_table = {}; | ||
|
||
VkInstance instance = {}; | ||
|
||
layer_init_instance_dispatch_table(instance, &instance_dispatch_table, foobar); | ||
|
||
VkDevice device = {}; | ||
|
||
layer_init_device_dispatch_table(device, &dispatch_table, local_vkGetDeviceProcAddr); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Copyright 2023 The Khronos Group Inc. | ||
# Copyright 2023 Valve Corporation | ||
# Copyright 2023 LunarG, Inc. | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
find_package(GTest REQUIRED CONFIG) | ||
|
||
include(GoogleTest) | ||
|
||
add_executable(test_layer_dispatch_table) | ||
|
||
target_sources(test_layer_dispatch_table PRIVATE | ||
test_c_interface.c | ||
test_cpp_interface.cpp | ||
) | ||
|
||
target_link_libraries(test_layer_dispatch_table PRIVATE | ||
GTest::gtest | ||
GTest::gtest_main | ||
Vulkan::UtilityHeaders | ||
) | ||
|
||
target_include_directories(test_layer_dispatch_table PRIVATE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>) | ||
|
||
add_executable(test_layer_dispatch_table_c_interface) | ||
|
||
target_sources(test_layer_dispatch_table_c_interface PRIVATE | ||
test_c_interface.c) | ||
|
||
target_link_libraries(test_layer_dispatch_table_c_interface PRIVATE | ||
GTest::gtest | ||
GTest::gtest_main | ||
Vulkan::UtilityHeaders) | ||
|
||
target_compile_features(test_layer_dispatch_table_c_interface PRIVATE c_std_99) | ||
|
||
gtest_discover_tests(test_layer_dispatch_table test_layer_dispatch_table_c_interface) |
Oops, something went wrong.