Skip to content

Commit 299b11f

Browse files
authored
414 support for 1 4 headers (KomputeProject#415)
* Added guard for vk 1.4 headers Signed-off-by: Alejandro Saucedo <[email protected]> * CI test for 1.4 compatibility Signed-off-by: Alejandro Saucedo <[email protected]> CI test for 1.4 compatibility Signed-off-by: Alejandro Saucedo <[email protected]> CI test for 1.4 compatibility Signed-off-by: Alejandro Saucedo <[email protected]> CI test for 1.4 compatibility Signed-off-by: Alejandro Saucedo <[email protected]> CI test for 1.4 compatibility Signed-off-by: Alejandro Saucedo <[email protected]> CI test for 1.4 compatibility Signed-off-by: Alejandro Saucedo <[email protected]> Updated cast to match vk namespace Signed-off-by: Alejandro Saucedo <[email protected]> Updated cast to match vk namespace Signed-off-by: Alejandro Saucedo <[email protected]> * Updated debugMessageCallback func to vk:: ns Signed-off-by: Alejandro Saucedo <[email protected]> * Updated debugMessageCallback func to vk:: ns Signed-off-by: Alejandro Saucedo <[email protected]> --------- Signed-off-by: Alejandro Saucedo <[email protected]>
1 parent 3495d34 commit 299b11f

File tree

3 files changed

+41
-2
lines changed

3 files changed

+41
-2
lines changed

.github/workflows/cpp_tests.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,30 @@ on:
77
branches: [ master ]
88

99
jobs:
10+
cpp-tests-1-4-debug-with-debug-layers:
11+
runs-on: ubuntu-latest
12+
container: axsauze/kompute-builder:0.4
13+
env:
14+
VK_ICD_FILENAMES: "/swiftshader/vk_swiftshader_icd.json"
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v3
18+
with:
19+
submodules: false
20+
- name: "[Release g++] Build & Test"
21+
uses: KomputeProject/action-cmake-build@master
22+
with:
23+
build-dir: ${{github.workspace}}/build
24+
source-dir: ${{github.workspace}}
25+
cc: gcc
26+
cxx: g++
27+
build-type: Debug
28+
run-test: false
29+
ctest-options: -V
30+
configure-options: -DKOMPUTE_OPT_BUILD_TESTS=ON -DKOMPUTE_OPT_DISABLE_VK_DEBUG_LAYERS=OFF -DKOMPUTE_OPT_USE_BUILT_IN_VULKAN_HEADER=ON -DKOMPUTE_OPT_BUILT_IN_VULKAN_HEADER_TAG=v1.4.304 -DKOMPUTE_OPT_DISABLE_VULKAN_VERSION_CHECK=ON
31+
- name: Run tests
32+
run: make mk_run_tests
33+
1034
cpp-tests-debug-with-debug-layers:
1135
runs-on: ubuntu-latest
1236
container: axsauze/kompute-builder:0.4

src/Manager.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,15 @@
1313
namespace kp {
1414

1515
#ifndef KOMPUTE_DISABLE_VK_DEBUG_LAYERS
16-
static VKAPI_ATTR VkBool32 VKAPI_CALL
16+
#ifdef VK_VERSION_1_4
17+
VKAPI_PTR vk::Bool32 VKAPI_CALL
18+
debugMessageCallback(vk::DebugReportFlagsEXT /*flags*/,
19+
vk::DebugReportObjectTypeEXT /*objectType*/,
20+
#else
21+
static VKAPI_PTR VkBool32 VKAPI_CALL
1722
debugMessageCallback(VkDebugReportFlagsEXT /*flags*/,
1823
VkDebugReportObjectTypeEXT /*objectType*/,
24+
#endif // VK_VERSION_1_4
1925
uint64_t /*object*/,
2026
size_t /*location*/,
2127
int32_t /*messageCode*/,
@@ -274,8 +280,13 @@ Manager::createInstance()
274280
vk::DebugReportFlagBitsEXT::eError |
275281
vk::DebugReportFlagBitsEXT::eWarning;
276282
vk::DebugReportCallbackCreateInfoEXT debugCreateInfo = {};
283+
#ifdef VK_VERSION_1_4
284+
debugCreateInfo.pfnCallback =
285+
(vk::PFN_DebugReportCallbackEXT)debugMessageCallback;
286+
#else
277287
debugCreateInfo.pfnCallback =
278288
(PFN_vkDebugReportCallbackEXT)debugMessageCallback;
289+
#endif
279290
debugCreateInfo.flags = debugFlags;
280291

281292
this->mDebugDispatcher.init(*this->mInstance, &vkGetInstanceProcAddr);

src/include/kompute/Manager.hpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,8 +550,12 @@ class Manager
550550

551551
#ifndef KOMPUTE_DISABLE_VK_DEBUG_LAYERS
552552
vk::DebugReportCallbackEXT mDebugReportCallback;
553+
#ifdef VK_VERSION_1_4
554+
vk::detail::DispatchLoaderDynamic mDebugDispatcher;
555+
#else
553556
vk::DispatchLoaderDynamic mDebugDispatcher;
554-
#endif
557+
#endif // VK_VERSION_1_4
558+
#endif // KOMPUTE_DISABLE_VK_DEBUG_LAYERS
555559

556560
// Create functions
557561
void createInstance();

0 commit comments

Comments
 (0)