From de89a25b9d901243f0164fa2afa0d021c0d1e3dd Mon Sep 17 00:00:00 2001 From: YasInvolved Date: Sun, 28 Sep 2025 17:57:10 +0200 Subject: [PATCH 01/36] add a structure that holds information about vulkan devices --- include/nbl/video/CVulkanConnection.h | 3 +++ src/nbl/video/CVulkanConnection.cpp | 2 ++ 2 files changed, 5 insertions(+) diff --git a/include/nbl/video/CVulkanConnection.h b/include/nbl/video/CVulkanConnection.h index c8d3882c50..619d57bd50 100644 --- a/include/nbl/video/CVulkanConnection.h +++ b/include/nbl/video/CVulkanConnection.h @@ -26,6 +26,8 @@ class NBL_API2 CVulkanConnection final : public IAPIConnection inline E_API_TYPE getAPIType() const override {return EAT_VULKAN;} inline IDebugCallback* getDebugCallback() const override {return m_debugCallback.get();} + + inline const core::vector& getVulkanDevicesInfo() const { return m_vulkanDevicesInfo; } bool startCapture() override; bool endCapture() override; @@ -44,6 +46,7 @@ class NBL_API2 CVulkanConnection final : public IAPIConnection const VkDebugUtilsMessengerEXT m_vkDebugUtilsMessengerEXT; const std::unique_ptr m_debugCallback; // this needs to live longer than VkDebugUtilsMessengerEXT handle above std::atomic_flag flag; + core::vector m_vulkanDevicesInfo; }; } diff --git a/src/nbl/video/CVulkanConnection.cpp b/src/nbl/video/CVulkanConnection.cpp index 3f1cb68380..8cd36bebbb 100644 --- a/src/nbl/video/CVulkanConnection.cpp +++ b/src/nbl/video/CVulkanConnection.cpp @@ -297,6 +297,7 @@ core::smart_refctd_ptr CVulkanConnection::create(core::smart_ core::smart_refctd_ptr api(new CVulkanConnection(vk_instance,enabledFeatures,std::move(debugCallback),vk_debugMessenger),core::dont_grab); api->m_physicalDevices.reserve(vk_physicalDevices.size()); + api->m_vulkanDevicesInfo.reserve(vk_physicalDevices.size()); for (auto vk_physicalDevice : vk_physicalDevices) { auto device = CVulkanPhysicalDevice::create(core::smart_refctd_ptr(sys),api.get(),api->m_rdoc_api,vk_physicalDevice); @@ -306,6 +307,7 @@ core::smart_refctd_ptr CVulkanConnection::create(core::smart_ continue; } api->m_physicalDevices.emplace_back(std::move(device)); + // device enumeration } #undef LOF From 92fd0f0696419b61e95de6c5a5fe191bac4bd4f7 Mon Sep 17 00:00:00 2001 From: YasInvolved Date: Tue, 30 Sep 2025 13:17:01 +0200 Subject: [PATCH 02/36] small change in naming --- include/nbl/video/CVulkanConnection.h | 4 ++-- src/nbl/video/CVulkanConnection.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/nbl/video/CVulkanConnection.h b/include/nbl/video/CVulkanConnection.h index 619d57bd50..dc063eab40 100644 --- a/include/nbl/video/CVulkanConnection.h +++ b/include/nbl/video/CVulkanConnection.h @@ -27,7 +27,7 @@ class NBL_API2 CVulkanConnection final : public IAPIConnection inline IDebugCallback* getDebugCallback() const override {return m_debugCallback.get();} - inline const core::vector& getVulkanDevicesInfo() const { return m_vulkanDevicesInfo; } + inline const core::vector& getVulkanProfiles() const { return m_vulkanProfiles; } bool startCapture() override; bool endCapture() override; @@ -46,7 +46,7 @@ class NBL_API2 CVulkanConnection final : public IAPIConnection const VkDebugUtilsMessengerEXT m_vkDebugUtilsMessengerEXT; const std::unique_ptr m_debugCallback; // this needs to live longer than VkDebugUtilsMessengerEXT handle above std::atomic_flag flag; - core::vector m_vulkanDevicesInfo; + core::vector m_vulkanProfiles; }; } diff --git a/src/nbl/video/CVulkanConnection.cpp b/src/nbl/video/CVulkanConnection.cpp index 8cd36bebbb..8cdb33316e 100644 --- a/src/nbl/video/CVulkanConnection.cpp +++ b/src/nbl/video/CVulkanConnection.cpp @@ -297,7 +297,7 @@ core::smart_refctd_ptr CVulkanConnection::create(core::smart_ core::smart_refctd_ptr api(new CVulkanConnection(vk_instance,enabledFeatures,std::move(debugCallback),vk_debugMessenger),core::dont_grab); api->m_physicalDevices.reserve(vk_physicalDevices.size()); - api->m_vulkanDevicesInfo.reserve(vk_physicalDevices.size()); + api->m_vulkanProfiles.reserve(vk_physicalDevices.size()); for (auto vk_physicalDevice : vk_physicalDevices) { auto device = CVulkanPhysicalDevice::create(core::smart_refctd_ptr(sys),api.get(),api->m_rdoc_api,vk_physicalDevice); From a8f4dbba7f7197120b1900b2caa91fd7f051c817 Mon Sep 17 00:00:00 2001 From: YasInvolved Date: Tue, 30 Sep 2025 13:39:48 +0200 Subject: [PATCH 03/36] store a reference to a coresponding profile in CVulkanPhysicalDevice, write information about available extensions --- src/nbl/video/CVulkanConnection.cpp | 3 ++- src/nbl/video/CVulkanPhysicalDevice.cpp | 13 +++++++++++-- src/nbl/video/CVulkanPhysicalDevice.h | 9 ++++++--- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/nbl/video/CVulkanConnection.cpp b/src/nbl/video/CVulkanConnection.cpp index 8cdb33316e..8306984df7 100644 --- a/src/nbl/video/CVulkanConnection.cpp +++ b/src/nbl/video/CVulkanConnection.cpp @@ -300,7 +300,8 @@ core::smart_refctd_ptr CVulkanConnection::create(core::smart_ api->m_vulkanProfiles.reserve(vk_physicalDevices.size()); for (auto vk_physicalDevice : vk_physicalDevices) { - auto device = CVulkanPhysicalDevice::create(core::smart_refctd_ptr(sys),api.get(),api->m_rdoc_api,vk_physicalDevice); + auto& profile = api->m_vulkanProfiles.emplace_back(); + auto device = CVulkanPhysicalDevice::create(core::smart_refctd_ptr(sys),api.get(),api->m_rdoc_api,vk_physicalDevice, profile); if (!device) { LOG(api->getDebugCallback()->getLogger(), "Vulkan device %p found but doesn't meet minimum Nabla requirements. Skipping!", system::ILogger::ELL_WARNING, vk_physicalDevice); diff --git a/src/nbl/video/CVulkanPhysicalDevice.cpp b/src/nbl/video/CVulkanPhysicalDevice.cpp index 256b717f52..58db6c1d10 100644 --- a/src/nbl/video/CVulkanPhysicalDevice.cpp +++ b/src/nbl/video/CVulkanPhysicalDevice.cpp @@ -1,6 +1,8 @@ #include "nbl/video/CVulkanPhysicalDevice.h" #include "nbl/video/CVulkanLogicalDevice.h" +#include "nlohmann/json.hpp" // TODO/FIXME: this is probably a mess making, consult someone how to do it better. + namespace nbl::video { @@ -10,7 +12,7 @@ do { \ return nullptr; \ } while(0) -std::unique_ptr CVulkanPhysicalDevice::create(core::smart_refctd_ptr&& sys, IAPIConnection* const api, renderdoc_api_t* const rdoc, const VkPhysicalDevice vk_physicalDevice) +std::unique_ptr CVulkanPhysicalDevice::create(core::smart_refctd_ptr&& sys, IAPIConnection* const api, renderdoc_api_t* const rdoc, const VkPhysicalDevice vk_physicalDevice, core::string& profile) { system::logger_opt_ptr logger = api->getDebugCallback()->getLogger(); @@ -25,6 +27,8 @@ std::unique_ptr CVulkanPhysicalDevice::create(core::smart } }); + using json = nlohmann::json; + json profileObject = { {"$schema", "https://schema.khronos.org/vulkan/profiles-0.8-latest.json"} }; auto& properties = initData.properties; auto& features = initData.features; @@ -263,7 +267,10 @@ std::unique_ptr CVulkanPhysicalDevice::create(core::smart assert(VK_SUCCESS==res); for (const auto& vk_extension : vk_extensions) + { + profileObject["capabilities"]["device"]["extensions"][vk_extension.extensionName] = vk_extension.specVersion; availableFeatureSet.insert(vk_extension.extensionName); + } } auto isExtensionSupported = [&availableFeatureSet](const char* name)->bool { @@ -1366,8 +1373,10 @@ std::unique_ptr CVulkanPhysicalDevice::create(core::smart // bufferUsages.opticalFlowCost = anyFlag(bufferFeatures,VK_FORMAT_FEATURE_2_OPTICAL_FLOW_COST_BIT_NV); } + profile = profileObject.dump(4); // nicely indented json + success = true; - return std::unique_ptr(new CVulkanPhysicalDevice(std::move(initData),rdoc,vk_physicalDevice,std::move(availableFeatureSet))); + return std::unique_ptr(new CVulkanPhysicalDevice(std::move(initData),rdoc,vk_physicalDevice,std::move(availableFeatureSet),profile)); } #undef RETURN_NULL_PHYSICAL_DEVICE diff --git a/src/nbl/video/CVulkanPhysicalDevice.h b/src/nbl/video/CVulkanPhysicalDevice.h index c1552c88f1..c94a4325d3 100644 --- a/src/nbl/video/CVulkanPhysicalDevice.h +++ b/src/nbl/video/CVulkanPhysicalDevice.h @@ -12,15 +12,17 @@ namespace nbl::video class CVulkanPhysicalDevice final : public IPhysicalDevice { public: - static std::unique_ptr create(core::smart_refctd_ptr&& sys, IAPIConnection* const api, renderdoc_api_t* const rdoc, const VkPhysicalDevice vk_physicalDevice); + static std::unique_ptr create(core::smart_refctd_ptr&& sys, IAPIConnection* const api, renderdoc_api_t* const rdoc, const VkPhysicalDevice vk_physicalDevice, core::string& profile); inline VkPhysicalDevice getInternalObject() const { return m_vkPhysicalDevice; } inline E_API_TYPE getAPIType() const override { return EAT_VULKAN; } + inline const core::string& getProfile() const { return m_profile; } + protected: - inline CVulkanPhysicalDevice(IPhysicalDevice::SInitData&& _initData, renderdoc_api_t* const rdoc, const VkPhysicalDevice vk_physicalDevice, core::unordered_set&& _extensions) - : IPhysicalDevice(std::move(_initData)), m_rdoc_api(rdoc), m_vkPhysicalDevice(vk_physicalDevice), m_extensions(std::move(_extensions)) {} + inline CVulkanPhysicalDevice(IPhysicalDevice::SInitData&& _initData, renderdoc_api_t* const rdoc, const VkPhysicalDevice vk_physicalDevice, core::unordered_set&& _extensions, core::string& profile) + : IPhysicalDevice(std::move(_initData)), m_rdoc_api(rdoc), m_vkPhysicalDevice(vk_physicalDevice), m_extensions(std::move(_extensions)), m_profile(profile) {} //! This function makes sure requirements of a requested feature is also set to `true` in SPhysicalDeviceFeatures //! Note that this will only fix what is exposed, some may require extensions not exposed currently, that will happen later on. @@ -115,6 +117,7 @@ class CVulkanPhysicalDevice final : public IPhysicalDevice renderdoc_api_t* const m_rdoc_api; const VkPhysicalDevice m_vkPhysicalDevice; + core::string& m_profile; const core::unordered_set m_extensions; }; From a8d9ea34737c7741fcc0d86fe5178cf918059f94 Mon Sep 17 00:00:00 2001 From: YasInvolved Date: Mon, 6 Oct 2025 15:17:09 +0200 Subject: [PATCH 04/36] add vulkan-tools submodule and include it in nabla --- .gitmodules | 3 +++ 3rdparty/CMakeLists.txt | 4 ++++ 3rdparty/Vulkan-Tools | 1 + 3 files changed, 8 insertions(+) create mode 160000 3rdparty/Vulkan-Tools diff --git a/.gitmodules b/.gitmodules index c3667f0301..74d12b8c6e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -121,3 +121,6 @@ [submodule "3rdparty/gtl"] path = 3rdparty/gtl url = https://github.com/greg7mdp/gtl.git +[submodule "3rdparty/Vulkan-Tools"] + path = 3rdparty/Vulkan-Tools + url = git@github.com:Devsh-Graphics-Programming/Vulkan-Tools.git diff --git a/3rdparty/CMakeLists.txt b/3rdparty/CMakeLists.txt index a83dc936ca..2014495b2e 100755 --- a/3rdparty/CMakeLists.txt +++ b/3rdparty/CMakeLists.txt @@ -451,6 +451,9 @@ if (NBL_BUILD_BULLET) set(BULLET_INCLUDE_PATH ${BULLET_INCLUDE_PATH} PARENT_SCOPE) endif() +add_library(Vulkan-Tools OBJECT "Vulkan-Tools/vulkaninfo/vulkaninfo.cpp") +target_include_directories(Vulkan-Tools INTERFACE "Vulkan-Tools/vulkaninfo") + # Final gather set(NBL_3RDPARTY_TARGETS lzma @@ -472,6 +475,7 @@ set(NBL_3RDPARTY_TARGETS SPIRV SPIRV-Tools-static # SPIRV-Tools-shared in case of SHARED lib SPIRV-Tools-opt + Vulkan-Tools Imath freetype ${NBL_MSDFGEN_TARGETS} diff --git a/3rdparty/Vulkan-Tools b/3rdparty/Vulkan-Tools new file mode 160000 index 0000000000..5568ce1470 --- /dev/null +++ b/3rdparty/Vulkan-Tools @@ -0,0 +1 @@ +Subproject commit 5568ce14705e512113df5b459fc86d857b3d7789 From 67ee1639f77cea8745fafd004811d962b167fbc5 Mon Sep 17 00:00:00 2001 From: YasInvolved Date: Wed, 8 Oct 2025 22:07:00 +0200 Subject: [PATCH 05/36] update vulkan headers, link vulkaninfo to nabla --- 3rdparty/CMakeLists.txt | 8 +++++--- 3rdparty/Vulkan-Headers | 2 +- src/nbl/CMakeLists.txt | 1 + 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/3rdparty/CMakeLists.txt b/3rdparty/CMakeLists.txt index 2014495b2e..050fb39cc3 100755 --- a/3rdparty/CMakeLists.txt +++ b/3rdparty/CMakeLists.txt @@ -451,8 +451,10 @@ if (NBL_BUILD_BULLET) set(BULLET_INCLUDE_PATH ${BULLET_INCLUDE_PATH} PARENT_SCOPE) endif() -add_library(Vulkan-Tools OBJECT "Vulkan-Tools/vulkaninfo/vulkaninfo.cpp") -target_include_directories(Vulkan-Tools INTERFACE "Vulkan-Tools/vulkaninfo") +set(_VULKANINFO_PREFIX "Vulkan-Tools/vulkaninfo") +add_library(vulkaninfo OBJECT "${_VULKANINFO_PREFIX}/vulkaninfo.cpp") +target_include_directories(vulkaninfo PRIVATE "${_VULKANINFO_PREFIX}" "${_VULKANINFO_PREFIX}/generated") +target_link_libraries(vulkaninfo PRIVATE Vulkan::Headers) # Final gather set(NBL_3RDPARTY_TARGETS @@ -475,7 +477,7 @@ set(NBL_3RDPARTY_TARGETS SPIRV SPIRV-Tools-static # SPIRV-Tools-shared in case of SHARED lib SPIRV-Tools-opt - Vulkan-Tools + vulkaninfo Imath freetype ${NBL_MSDFGEN_TARGETS} diff --git a/3rdparty/Vulkan-Headers b/3rdparty/Vulkan-Headers index 234c4b7370..f5fad0a209 160000 --- a/3rdparty/Vulkan-Headers +++ b/3rdparty/Vulkan-Headers @@ -1 +1 @@ -Subproject commit 234c4b7370a8ea3239a214c9e871e4b17c89f4ab +Subproject commit f5fad0a209a2e09eb5e622d930d5eade1a235b13 diff --git a/src/nbl/CMakeLists.txt b/src/nbl/CMakeLists.txt index 935beffe2c..8437b5c90c 100755 --- a/src/nbl/CMakeLists.txt +++ b/src/nbl/CMakeLists.txt @@ -329,6 +329,7 @@ set(NBL_LIBRARY_CREATION_SOURCES $ $ $ + $ ) if(NBL_STATIC_BUILD) From e4207b8ff025ef85fd27382793421d88e1f27f05 Mon Sep 17 00:00:00 2001 From: YasInvolved Date: Fri, 10 Oct 2025 16:01:13 +0200 Subject: [PATCH 06/36] link vulkaninfo as static library --- 3rdparty/CMakeLists.txt | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/3rdparty/CMakeLists.txt b/3rdparty/CMakeLists.txt index 050fb39cc3..dcfdb55ad8 100755 --- a/3rdparty/CMakeLists.txt +++ b/3rdparty/CMakeLists.txt @@ -451,10 +451,7 @@ if (NBL_BUILD_BULLET) set(BULLET_INCLUDE_PATH ${BULLET_INCLUDE_PATH} PARENT_SCOPE) endif() -set(_VULKANINFO_PREFIX "Vulkan-Tools/vulkaninfo") -add_library(vulkaninfo OBJECT "${_VULKANINFO_PREFIX}/vulkaninfo.cpp") -target_include_directories(vulkaninfo PRIVATE "${_VULKANINFO_PREFIX}" "${_VULKANINFO_PREFIX}/generated") -target_link_libraries(vulkaninfo PRIVATE Vulkan::Headers) +add_subdirectory(Vulkan-Tools/vulkaninfo vulkaninfo EXCLUDE_FROM_ALL) # Final gather set(NBL_3RDPARTY_TARGETS From dd4c7fd69c8472807d3c0f70ecda090bef0e49d6 Mon Sep 17 00:00:00 2001 From: YasInvolved Date: Fri, 10 Oct 2025 16:12:06 +0200 Subject: [PATCH 07/36] update vulkan-tools --- 3rdparty/Vulkan-Tools | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/3rdparty/Vulkan-Tools b/3rdparty/Vulkan-Tools index 5568ce1470..1fb52d6ed4 160000 --- a/3rdparty/Vulkan-Tools +++ b/3rdparty/Vulkan-Tools @@ -1 +1 @@ -Subproject commit 5568ce14705e512113df5b459fc86d857b3d7789 +Subproject commit 1fb52d6ed449d70d4e0c3cfae5cf0893778b69aa From e645f4f5f650601ef9c88b5d2bfb6c6e65e29b4f Mon Sep 17 00:00:00 2001 From: YasInvolved Date: Fri, 10 Oct 2025 17:03:22 +0200 Subject: [PATCH 08/36] update vulkan-headers --- 3rdparty/Vulkan-Headers | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/3rdparty/Vulkan-Headers b/3rdparty/Vulkan-Headers index f5fad0a209..33d7f51258 160000 --- a/3rdparty/Vulkan-Headers +++ b/3rdparty/Vulkan-Headers @@ -1 +1 @@ -Subproject commit f5fad0a209a2e09eb5e622d930d5eade1a235b13 +Subproject commit 33d7f512583b8de44d1b6384aa1cf482f92e53e9 From 824662aa68cf33edb3e060d09c61e4c2a11b78f5 Mon Sep 17 00:00:00 2001 From: YasInvolved Date: Fri, 10 Oct 2025 17:52:05 +0200 Subject: [PATCH 09/36] fixed silly mistake in Vulkan-Tools, mimic headers from vulkansdk for vulkaninfo --- 3rdparty/CMakeLists.txt | 3 +++ 3rdparty/Vulkan-Tools | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/3rdparty/CMakeLists.txt b/3rdparty/CMakeLists.txt index dcfdb55ad8..a3bf95ce53 100755 --- a/3rdparty/CMakeLists.txt +++ b/3rdparty/CMakeLists.txt @@ -451,6 +451,9 @@ if (NBL_BUILD_BULLET) set(BULLET_INCLUDE_PATH ${BULLET_INCLUDE_PATH} PARENT_SCOPE) endif() +add_library(Vulkan-Headers INTERFACE) +target_include_directories(Vulkan-Headers INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/Vulkan-Headers/include") +add_library(Vulkan::Headers ALIAS Vulkan-Headers) add_subdirectory(Vulkan-Tools/vulkaninfo vulkaninfo EXCLUDE_FROM_ALL) # Final gather diff --git a/3rdparty/Vulkan-Tools b/3rdparty/Vulkan-Tools index 1fb52d6ed4..f3fc824f10 160000 --- a/3rdparty/Vulkan-Tools +++ b/3rdparty/Vulkan-Tools @@ -1 +1 @@ -Subproject commit 1fb52d6ed449d70d4e0c3cfae5cf0893778b69aa +Subproject commit f3fc824f10d68b4d61398404403956d67c5c3e7e From 0002aef0069e538deb504958f0db941bda33e5aa Mon Sep 17 00:00:00 2001 From: YasInvolved Date: Sun, 12 Oct 2025 17:52:19 +0200 Subject: [PATCH 10/36] remove unused stuff --- include/nbl/video/CVulkanConnection.h | 3 --- src/nbl/video/CVulkanConnection.cpp | 4 +--- src/nbl/video/CVulkanPhysicalDevice.cpp | 12 ++---------- src/nbl/video/CVulkanPhysicalDevice.h | 9 +++------ 4 files changed, 6 insertions(+), 22 deletions(-) diff --git a/include/nbl/video/CVulkanConnection.h b/include/nbl/video/CVulkanConnection.h index dc063eab40..c8d3882c50 100644 --- a/include/nbl/video/CVulkanConnection.h +++ b/include/nbl/video/CVulkanConnection.h @@ -26,8 +26,6 @@ class NBL_API2 CVulkanConnection final : public IAPIConnection inline E_API_TYPE getAPIType() const override {return EAT_VULKAN;} inline IDebugCallback* getDebugCallback() const override {return m_debugCallback.get();} - - inline const core::vector& getVulkanProfiles() const { return m_vulkanProfiles; } bool startCapture() override; bool endCapture() override; @@ -46,7 +44,6 @@ class NBL_API2 CVulkanConnection final : public IAPIConnection const VkDebugUtilsMessengerEXT m_vkDebugUtilsMessengerEXT; const std::unique_ptr m_debugCallback; // this needs to live longer than VkDebugUtilsMessengerEXT handle above std::atomic_flag flag; - core::vector m_vulkanProfiles; }; } diff --git a/src/nbl/video/CVulkanConnection.cpp b/src/nbl/video/CVulkanConnection.cpp index 8306984df7..1ff55f8edf 100644 --- a/src/nbl/video/CVulkanConnection.cpp +++ b/src/nbl/video/CVulkanConnection.cpp @@ -297,11 +297,9 @@ core::smart_refctd_ptr CVulkanConnection::create(core::smart_ core::smart_refctd_ptr api(new CVulkanConnection(vk_instance,enabledFeatures,std::move(debugCallback),vk_debugMessenger),core::dont_grab); api->m_physicalDevices.reserve(vk_physicalDevices.size()); - api->m_vulkanProfiles.reserve(vk_physicalDevices.size()); for (auto vk_physicalDevice : vk_physicalDevices) { - auto& profile = api->m_vulkanProfiles.emplace_back(); - auto device = CVulkanPhysicalDevice::create(core::smart_refctd_ptr(sys),api.get(),api->m_rdoc_api,vk_physicalDevice, profile); + auto device = CVulkanPhysicalDevice::create(core::smart_refctd_ptr(sys),api.get(),api->m_rdoc_api,vk_physicalDevice); if (!device) { LOG(api->getDebugCallback()->getLogger(), "Vulkan device %p found but doesn't meet minimum Nabla requirements. Skipping!", system::ILogger::ELL_WARNING, vk_physicalDevice); diff --git a/src/nbl/video/CVulkanPhysicalDevice.cpp b/src/nbl/video/CVulkanPhysicalDevice.cpp index 58db6c1d10..e0dad4039e 100644 --- a/src/nbl/video/CVulkanPhysicalDevice.cpp +++ b/src/nbl/video/CVulkanPhysicalDevice.cpp @@ -12,7 +12,7 @@ do { \ return nullptr; \ } while(0) -std::unique_ptr CVulkanPhysicalDevice::create(core::smart_refctd_ptr&& sys, IAPIConnection* const api, renderdoc_api_t* const rdoc, const VkPhysicalDevice vk_physicalDevice, core::string& profile) +std::unique_ptr CVulkanPhysicalDevice::create(core::smart_refctd_ptr&& sys, IAPIConnection* const api, renderdoc_api_t* const rdoc, const VkPhysicalDevice vk_physicalDevice) { system::logger_opt_ptr logger = api->getDebugCallback()->getLogger(); @@ -27,9 +27,6 @@ std::unique_ptr CVulkanPhysicalDevice::create(core::smart } }); - using json = nlohmann::json; - json profileObject = { {"$schema", "https://schema.khronos.org/vulkan/profiles-0.8-latest.json"} }; - auto& properties = initData.properties; auto& features = initData.features; // First call just with Vulkan 1.0 API because: @@ -267,10 +264,7 @@ std::unique_ptr CVulkanPhysicalDevice::create(core::smart assert(VK_SUCCESS==res); for (const auto& vk_extension : vk_extensions) - { - profileObject["capabilities"]["device"]["extensions"][vk_extension.extensionName] = vk_extension.specVersion; availableFeatureSet.insert(vk_extension.extensionName); - } } auto isExtensionSupported = [&availableFeatureSet](const char* name)->bool { @@ -1372,11 +1366,9 @@ std::unique_ptr CVulkanPhysicalDevice::create(core::smart // bufferUsages.opticalFlowVector = anyFlag(bufferFeatures,VK_FORMAT_FEATURE_2_OPTICAL_FLOW_VECTOR_BIT_NV); // bufferUsages.opticalFlowCost = anyFlag(bufferFeatures,VK_FORMAT_FEATURE_2_OPTICAL_FLOW_COST_BIT_NV); } - - profile = profileObject.dump(4); // nicely indented json success = true; - return std::unique_ptr(new CVulkanPhysicalDevice(std::move(initData),rdoc,vk_physicalDevice,std::move(availableFeatureSet),profile)); + return std::unique_ptr(new CVulkanPhysicalDevice(std::move(initData),rdoc,vk_physicalDevice,std::move(availableFeatureSet))); } #undef RETURN_NULL_PHYSICAL_DEVICE diff --git a/src/nbl/video/CVulkanPhysicalDevice.h b/src/nbl/video/CVulkanPhysicalDevice.h index c94a4325d3..c1552c88f1 100644 --- a/src/nbl/video/CVulkanPhysicalDevice.h +++ b/src/nbl/video/CVulkanPhysicalDevice.h @@ -12,17 +12,15 @@ namespace nbl::video class CVulkanPhysicalDevice final : public IPhysicalDevice { public: - static std::unique_ptr create(core::smart_refctd_ptr&& sys, IAPIConnection* const api, renderdoc_api_t* const rdoc, const VkPhysicalDevice vk_physicalDevice, core::string& profile); + static std::unique_ptr create(core::smart_refctd_ptr&& sys, IAPIConnection* const api, renderdoc_api_t* const rdoc, const VkPhysicalDevice vk_physicalDevice); inline VkPhysicalDevice getInternalObject() const { return m_vkPhysicalDevice; } inline E_API_TYPE getAPIType() const override { return EAT_VULKAN; } - inline const core::string& getProfile() const { return m_profile; } - protected: - inline CVulkanPhysicalDevice(IPhysicalDevice::SInitData&& _initData, renderdoc_api_t* const rdoc, const VkPhysicalDevice vk_physicalDevice, core::unordered_set&& _extensions, core::string& profile) - : IPhysicalDevice(std::move(_initData)), m_rdoc_api(rdoc), m_vkPhysicalDevice(vk_physicalDevice), m_extensions(std::move(_extensions)), m_profile(profile) {} + inline CVulkanPhysicalDevice(IPhysicalDevice::SInitData&& _initData, renderdoc_api_t* const rdoc, const VkPhysicalDevice vk_physicalDevice, core::unordered_set&& _extensions) + : IPhysicalDevice(std::move(_initData)), m_rdoc_api(rdoc), m_vkPhysicalDevice(vk_physicalDevice), m_extensions(std::move(_extensions)) {} //! This function makes sure requirements of a requested feature is also set to `true` in SPhysicalDeviceFeatures //! Note that this will only fix what is exposed, some may require extensions not exposed currently, that will happen later on. @@ -117,7 +115,6 @@ class CVulkanPhysicalDevice final : public IPhysicalDevice renderdoc_api_t* const m_rdoc_api; const VkPhysicalDevice m_vkPhysicalDevice; - core::string& m_profile; const core::unordered_set m_extensions; }; From 13617172aec088be4fbab3fcdea9651df2394dbf Mon Sep 17 00:00:00 2001 From: YasInvolved Date: Sun, 12 Oct 2025 18:29:34 +0200 Subject: [PATCH 11/36] make vulkaninfo "callable" from nabla --- include/nbl/video/CVulkanConnection.h | 2 ++ src/nbl/CMakeLists.txt | 6 +++++- src/nbl/video/CVulkanConnection.cpp | 9 +++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/include/nbl/video/CVulkanConnection.h b/include/nbl/video/CVulkanConnection.h index c8d3882c50..d7177096ef 100644 --- a/include/nbl/video/CVulkanConnection.h +++ b/include/nbl/video/CVulkanConnection.h @@ -27,6 +27,8 @@ class NBL_API2 CVulkanConnection final : public IAPIConnection inline IDebugCallback* getDebugCallback() const override {return m_debugCallback.get();} + void exportGpuProfile() const; + bool startCapture() override; bool endCapture() override; diff --git a/src/nbl/CMakeLists.txt b/src/nbl/CMakeLists.txt index 8437b5c90c..b4f70e9015 100755 --- a/src/nbl/CMakeLists.txt +++ b/src/nbl/CMakeLists.txt @@ -329,7 +329,6 @@ set(NBL_LIBRARY_CREATION_SOURCES $ $ $ - $ ) if(NBL_STATIC_BUILD) @@ -602,6 +601,11 @@ if (NBL_COMPILE_WITH_CUDA) target_include_directories(Nabla PUBLIC ${CUDAToolkit_INCLUDE_DIRS}) endif() +# vulkaninfo +if (NOT VULKANINFO_BUILD_EXECUTABLE) + target_link_libraries(Nabla PRIVATE vulkaninfo) +endif() + # Include dirs for self target_include_directories(Nabla PUBLIC "${CMAKE_CURRENT_BINARY_DIR}/include" diff --git a/src/nbl/video/CVulkanConnection.cpp b/src/nbl/video/CVulkanConnection.cpp index 1ff55f8edf..d19d8d5b43 100644 --- a/src/nbl/video/CVulkanConnection.cpp +++ b/src/nbl/video/CVulkanConnection.cpp @@ -4,6 +4,8 @@ #include "nbl/video/CVulkanCommon.h" #include "nbl/video/debug/CVulkanDebugCallback.h" +#include "vulkaninfo/vulkaninfo.h" + // TODO: move inside `create` and call it LOG_FAIL and return nullptr #define LOG(logger, ...) if (logger) {logger->log(__VA_ARGS__);} @@ -322,6 +324,13 @@ CVulkanConnection::~CVulkanConnection() vkDestroyInstance(m_vkInstance,nullptr); } +void CVulkanConnection::exportGpuProfile() const +{ + constexpr char arg1[] = "--json"; + char* argv = const_cast(arg1); + vulkaninfo(1, &argv); +} + bool CVulkanConnection::startCapture() { if (flag.test_and_set()) From 6f6420b489c2cfaa154c46c282ab35a6227f0e79 Mon Sep 17 00:00:00 2001 From: YasInvolved Date: Wed, 15 Oct 2025 19:17:24 +0200 Subject: [PATCH 12/36] link vulkaninfo to nabla again --- 3rdparty/dxc/dxc | 2 +- 3rdparty/git-version-tracking | 2 +- src/nbl/CMakeLists.txt | 7 +++++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/3rdparty/dxc/dxc b/3rdparty/dxc/dxc index 44f3ed7a12..6682612e3a 160000 --- a/3rdparty/dxc/dxc +++ b/3rdparty/dxc/dxc @@ -1 +1 @@ -Subproject commit 44f3ed7a12adfcf85779c8b679820467b85a5603 +Subproject commit 6682612e3ac7ab76c162111bb4f483accdbd3fb7 diff --git a/3rdparty/git-version-tracking b/3rdparty/git-version-tracking index 6c3ecac5f0..65a43dc5f5 160000 --- a/3rdparty/git-version-tracking +++ b/3rdparty/git-version-tracking @@ -1 +1 @@ -Subproject commit 6c3ecac5f0297877d1573ef4e3cdb537c5feeb62 +Subproject commit 65a43dc5f5db0833177b788d21df1e38080371b2 diff --git a/src/nbl/CMakeLists.txt b/src/nbl/CMakeLists.txt index 6bf9e9abdd..d932715fe4 100644 --- a/src/nbl/CMakeLists.txt +++ b/src/nbl/CMakeLists.txt @@ -753,6 +753,13 @@ list(APPEND INTERFACE_BUILD_DEFINITIONS # TODO: private target_link_libraries(Nabla PUBLIC $) +# vulkaninfo +if (NBL_STATIC_BUILD) + target_link_libraries(Nabla PUBLIC $) +else() + target_link_libraries(Nabla PRIVATE $) +endif() + # NGFX if(TARGET ngfx) if(NBL_STATIC_BUILD) From 471d128a886a28e823ebb54d7ea7c2f1c04fc1e3 Mon Sep 17 00:00:00 2001 From: YasInvolved Date: Wed, 15 Oct 2025 19:33:34 +0200 Subject: [PATCH 13/36] make exportGpuProfile function in CVulkanConnection static --- include/nbl/video/CVulkanConnection.h | 3 ++- src/nbl/video/CVulkanConnection.cpp | 14 +++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/include/nbl/video/CVulkanConnection.h b/include/nbl/video/CVulkanConnection.h index d7177096ef..a99f8aa858 100644 --- a/include/nbl/video/CVulkanConnection.h +++ b/include/nbl/video/CVulkanConnection.h @@ -21,13 +21,14 @@ class NBL_API2 CVulkanConnection final : public IAPIConnection core::smart_refctd_ptr&& logger, const SFeatures& featuresToEnable ); + static void exportGpuProfile(); + inline VkInstance getInternalObject() const {return m_vkInstance;} inline E_API_TYPE getAPIType() const override {return EAT_VULKAN;} inline IDebugCallback* getDebugCallback() const override {return m_debugCallback.get();} - void exportGpuProfile() const; bool startCapture() override; bool endCapture() override; diff --git a/src/nbl/video/CVulkanConnection.cpp b/src/nbl/video/CVulkanConnection.cpp index d19d8d5b43..b56acad95d 100644 --- a/src/nbl/video/CVulkanConnection.cpp +++ b/src/nbl/video/CVulkanConnection.cpp @@ -316,6 +316,13 @@ core::smart_refctd_ptr CVulkanConnection::create(core::smart_ return api; } +void CVulkanConnection::exportGpuProfile() +{ + constexpr char arg1[] = "--json"; + char* argv = const_cast(arg1); + vulkaninfo(1, &argv); +} + CVulkanConnection::~CVulkanConnection() { if (m_vkDebugUtilsMessengerEXT!=VK_NULL_HANDLE) @@ -324,13 +331,6 @@ CVulkanConnection::~CVulkanConnection() vkDestroyInstance(m_vkInstance,nullptr); } -void CVulkanConnection::exportGpuProfile() const -{ - constexpr char arg1[] = "--json"; - char* argv = const_cast(arg1); - vulkaninfo(1, &argv); -} - bool CVulkanConnection::startCapture() { if (flag.test_and_set()) From 6e15b42a8a1d3e450a8dc0296be857e4800d0984 Mon Sep 17 00:00:00 2001 From: YasInvolved Date: Wed, 15 Oct 2025 19:35:18 +0200 Subject: [PATCH 14/36] call exportGpuProfile in smoke --- smoke/main.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/smoke/main.cpp b/smoke/main.cpp index efb09712a1..e03c077ae6 100644 --- a/smoke/main.cpp +++ b/smoke/main.cpp @@ -36,11 +36,16 @@ class Smoke final : public system::IApplicationFramework return false; } + CVulkanConnection::exportGpuProfile(); + return true; } void workLoopBody() override {} bool keepRunning() override { return false; } + +private: + smart_refctd_ptr m_api; }; NBL_MAIN_FUNC(Smoke) From e2bb3cc10ec76a4432f7a0187f446b47677bf216 Mon Sep 17 00:00:00 2001 From: YasInvolved Date: Thu, 16 Oct 2025 21:34:26 +0200 Subject: [PATCH 15/36] fix nonexistent vulkan-headers library --- 3rdparty/CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/3rdparty/CMakeLists.txt b/3rdparty/CMakeLists.txt index c492b6eca5..99c966f1ac 100755 --- a/3rdparty/CMakeLists.txt +++ b/3rdparty/CMakeLists.txt @@ -454,6 +454,11 @@ if (NBL_BUILD_BULLET) set(BULLET_INCLUDE_PATH ${BULLET_INCLUDE_PATH} PARENT_SCOPE) endif() +if (NOT TARGET Vulkan::Headers) + add_library(Vulkan-Headers INTERFACE) + add_library(Vulkan::Headers ALIAS Vulkan-Headers) +endif() + target_include_directories(Vulkan::Headers INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/Vulkan-Headers/include") add_subdirectory(Vulkan-Tools/vulkaninfo vulkaninfo EXCLUDE_FROM_ALL) From e3c34aa9dc7793028762ae692ae223a42b3bba35 Mon Sep 17 00:00:00 2001 From: YasInvolved Date: Sat, 18 Oct 2025 14:59:45 +0200 Subject: [PATCH 16/36] do vulkan-headers stuff as it should be done from the beginning --- 3rdparty/CMakeLists.txt | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/3rdparty/CMakeLists.txt b/3rdparty/CMakeLists.txt index 99c966f1ac..4ee86dcfcd 100755 --- a/3rdparty/CMakeLists.txt +++ b/3rdparty/CMakeLists.txt @@ -454,12 +454,8 @@ if (NBL_BUILD_BULLET) set(BULLET_INCLUDE_PATH ${BULLET_INCLUDE_PATH} PARENT_SCOPE) endif() -if (NOT TARGET Vulkan::Headers) - add_library(Vulkan-Headers INTERFACE) - add_library(Vulkan::Headers ALIAS Vulkan-Headers) -endif() - -target_include_directories(Vulkan::Headers INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/Vulkan-Headers/include") +add_library(Vulkan-Headers INTERFACE) +target_include_directories(Vulkan-Headers INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/Vulkan-Headers/include") add_subdirectory(Vulkan-Tools/vulkaninfo vulkaninfo EXCLUDE_FROM_ALL) # Final gather From 2725307e2fa9c7c9d5e6b4f2a59fab752de4b1ba Mon Sep 17 00:00:00 2001 From: YasInvolved Date: Sat, 18 Oct 2025 15:06:36 +0200 Subject: [PATCH 17/36] update vulkan-tools --- 3rdparty/Vulkan-Tools | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/3rdparty/Vulkan-Tools b/3rdparty/Vulkan-Tools index f3fc824f10..00e1c9bc35 160000 --- a/3rdparty/Vulkan-Tools +++ b/3rdparty/Vulkan-Tools @@ -1 +1 @@ -Subproject commit f3fc824f10d68b4d61398404403956d67c5c3e7e +Subproject commit 00e1c9bc35231bbd78cdc30db831279e10c8a697 From 4c7386bc2b3113dc28eeee4c30db2a26f8a3f562 Mon Sep 17 00:00:00 2001 From: YasInvolved Date: Sun, 19 Oct 2025 18:03:15 +0200 Subject: [PATCH 18/36] make vulkaninfo a standalone function and export a profile for all gpus in the system --- 3rdparty/Vulkan-Tools | 2 +- include/nbl/video/CVulkanConnection.h | 3 ++- smoke/main.cpp | 2 +- src/nbl/video/CVulkanConnection.cpp | 20 +++++++++++--------- 4 files changed, 15 insertions(+), 12 deletions(-) diff --git a/3rdparty/Vulkan-Tools b/3rdparty/Vulkan-Tools index 00e1c9bc35..b59aec23d1 160000 --- a/3rdparty/Vulkan-Tools +++ b/3rdparty/Vulkan-Tools @@ -1 +1 @@ -Subproject commit 00e1c9bc35231bbd78cdc30db831279e10c8a697 +Subproject commit b59aec23d153a32bdbacf7fff6ee6ca86371de76 diff --git a/include/nbl/video/CVulkanConnection.h b/include/nbl/video/CVulkanConnection.h index a99f8aa858..461a29cc85 100644 --- a/include/nbl/video/CVulkanConnection.h +++ b/include/nbl/video/CVulkanConnection.h @@ -21,7 +21,6 @@ class NBL_API2 CVulkanConnection final : public IAPIConnection core::smart_refctd_ptr&& logger, const SFeatures& featuresToEnable ); - static void exportGpuProfile(); inline VkInstance getInternalObject() const {return m_vkInstance;} @@ -49,6 +48,8 @@ class NBL_API2 CVulkanConnection final : public IAPIConnection std::atomic_flag flag; }; +NBL_API2 void vulkaninfo(); + } #endif diff --git a/smoke/main.cpp b/smoke/main.cpp index e03c077ae6..6fb0cb30b6 100644 --- a/smoke/main.cpp +++ b/smoke/main.cpp @@ -36,7 +36,7 @@ class Smoke final : public system::IApplicationFramework return false; } - CVulkanConnection::exportGpuProfile(); + nbl::video::vulkaninfo(); return true; } diff --git a/src/nbl/video/CVulkanConnection.cpp b/src/nbl/video/CVulkanConnection.cpp index b56acad95d..062aea9d5e 100644 --- a/src/nbl/video/CVulkanConnection.cpp +++ b/src/nbl/video/CVulkanConnection.cpp @@ -4,11 +4,11 @@ #include "nbl/video/CVulkanCommon.h" #include "nbl/video/debug/CVulkanDebugCallback.h" -#include "vulkaninfo/vulkaninfo.h" - // TODO: move inside `create` and call it LOG_FAIL and return nullptr #define LOG(logger, ...) if (logger) {logger->log(__VA_ARGS__);} +extern int vulkaninfo(const std::span); + namespace nbl::video { @@ -316,13 +316,6 @@ core::smart_refctd_ptr CVulkanConnection::create(core::smart_ return api; } -void CVulkanConnection::exportGpuProfile() -{ - constexpr char arg1[] = "--json"; - char* argv = const_cast(arg1); - vulkaninfo(1, &argv); -} - CVulkanConnection::~CVulkanConnection() { if (m_vkDebugUtilsMessengerEXT!=VK_NULL_HANDLE) @@ -382,4 +375,13 @@ bool CVulkanConnection::endCapture() return true; } +NBL_API2 void vulkaninfo() { + uint32_t gpuIndex = 0; + std::string jsonArg = "--json=" + std::to_string(gpuIndex); + std::array args = { "", jsonArg }; + + while (::vulkaninfo(args) == 0) + jsonArg = "--json=" + std::to_string(++gpuIndex); +} + } From e956dcaf540e0d6a3cdd4dec3a01dba804b9b1c4 Mon Sep 17 00:00:00 2001 From: YasInvolved Date: Sun, 19 Oct 2025 18:24:05 +0200 Subject: [PATCH 19/36] fix broken submodule --- 3rdparty/Vulkan-Tools | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/3rdparty/Vulkan-Tools b/3rdparty/Vulkan-Tools index b59aec23d1..096ed3c365 160000 --- a/3rdparty/Vulkan-Tools +++ b/3rdparty/Vulkan-Tools @@ -1 +1 @@ -Subproject commit b59aec23d153a32bdbacf7fff6ee6ca86371de76 +Subproject commit 096ed3c3650f5968825c8fb768aa1680a63cc612 From 58bceda4b4508896452deb931090303584305e59 Mon Sep 17 00:00:00 2001 From: YasInvolved Date: Sun, 19 Oct 2025 20:19:12 +0200 Subject: [PATCH 20/36] fix git-version-tracking --- 3rdparty/git-version-tracking | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/3rdparty/git-version-tracking b/3rdparty/git-version-tracking index 65a43dc5f5..6c3ecac5f0 160000 --- a/3rdparty/git-version-tracking +++ b/3rdparty/git-version-tracking @@ -1 +1 @@ -Subproject commit 65a43dc5f5db0833177b788d21df1e38080371b2 +Subproject commit 6c3ecac5f0297877d1573ef4e3cdb537c5feeb62 From 211ad296da7941b74317d13532e5fe56f27c1f23 Mon Sep 17 00:00:00 2001 From: YasInvolved Date: Sun, 19 Oct 2025 20:31:04 +0200 Subject: [PATCH 21/36] fix dxc submodule --- 3rdparty/dxc/dxc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/3rdparty/dxc/dxc b/3rdparty/dxc/dxc index 6682612e3a..44f3ed7a12 160000 --- a/3rdparty/dxc/dxc +++ b/3rdparty/dxc/dxc @@ -1 +1 @@ -Subproject commit 6682612e3ac7ab76c162111bb4f483accdbd3fb7 +Subproject commit 44f3ed7a12adfcf85779c8b679820467b85a5603 From 1c1b9c75fd16d6af831be4025dec0ba5fbf75afa Mon Sep 17 00:00:00 2001 From: YasInvolved Date: Thu, 23 Oct 2025 21:41:07 +0200 Subject: [PATCH 22/36] expose vulkaninfo to clients and parse args properly --- 3rdparty/Vulkan-Tools | 2 +- include/nbl/video/CVulkanConnection.h | 5 +++-- src/nbl/video/CVulkanConnection.cpp | 18 +++++++++++------- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/3rdparty/Vulkan-Tools b/3rdparty/Vulkan-Tools index 096ed3c365..fc7c26a55f 160000 --- a/3rdparty/Vulkan-Tools +++ b/3rdparty/Vulkan-Tools @@ -1 +1 @@ -Subproject commit 096ed3c3650f5968825c8fb768aa1680a63cc612 +Subproject commit fc7c26a55f5bfe5a182cd9e333f470cf028a92cb diff --git a/include/nbl/video/CVulkanConnection.h b/include/nbl/video/CVulkanConnection.h index 461a29cc85..376000bb13 100644 --- a/include/nbl/video/CVulkanConnection.h +++ b/include/nbl/video/CVulkanConnection.h @@ -13,6 +13,8 @@ namespace nbl::video { +NBL_API2 int vulkaninfo(const std::span args); + class NBL_API2 CVulkanConnection final : public IAPIConnection { public: @@ -21,6 +23,7 @@ class NBL_API2 CVulkanConnection final : public IAPIConnection core::smart_refctd_ptr&& logger, const SFeatures& featuresToEnable ); + static void exportGpuProfiles(); inline VkInstance getInternalObject() const {return m_vkInstance;} @@ -48,8 +51,6 @@ class NBL_API2 CVulkanConnection final : public IAPIConnection std::atomic_flag flag; }; -NBL_API2 void vulkaninfo(); - } #endif diff --git a/src/nbl/video/CVulkanConnection.cpp b/src/nbl/video/CVulkanConnection.cpp index 062aea9d5e..2f5baf5ab6 100644 --- a/src/nbl/video/CVulkanConnection.cpp +++ b/src/nbl/video/CVulkanConnection.cpp @@ -375,13 +375,17 @@ bool CVulkanConnection::endCapture() return true; } -NBL_API2 void vulkaninfo() { - uint32_t gpuIndex = 0; - std::string jsonArg = "--json=" + std::to_string(gpuIndex); - std::array args = { "", jsonArg }; - - while (::vulkaninfo(args) == 0) - jsonArg = "--json=" + std::to_string(++gpuIndex); +void CVulkanConnection::exportGpuProfiles() +{ + for (size_t i = 0;; i++) + { + auto arg = "--json=" + std::to_string(i); + int code = ::vulkaninfo(std::array{ arg }); + if (code != 0) + break; + } } +NBL_API2 int vulkaninfo(const std::span args) { return ::vulkaninfo(args); } + } From 1c0664910c7154de57be7a246e16bb4367296314 Mon Sep 17 00:00:00 2001 From: YasInvolved Date: Fri, 24 Oct 2025 15:06:16 +0200 Subject: [PATCH 23/36] remove NBL_API2 from the cpp, use argc/argv in vulkaninfo --- 3rdparty/Vulkan-Tools | 2 +- include/nbl/video/CVulkanConnection.h | 4 +--- smoke/main.cpp | 15 +++++++++++++-- src/nbl/video/CVulkanConnection.cpp | 14 +++----------- 4 files changed, 18 insertions(+), 17 deletions(-) diff --git a/3rdparty/Vulkan-Tools b/3rdparty/Vulkan-Tools index fc7c26a55f..650a4db9fc 160000 --- a/3rdparty/Vulkan-Tools +++ b/3rdparty/Vulkan-Tools @@ -1 +1 @@ -Subproject commit fc7c26a55f5bfe5a182cd9e333f470cf028a92cb +Subproject commit 650a4db9fc6c45e9ae9523ea2af3a5931194b807 diff --git a/include/nbl/video/CVulkanConnection.h b/include/nbl/video/CVulkanConnection.h index 376000bb13..b02f12f1de 100644 --- a/include/nbl/video/CVulkanConnection.h +++ b/include/nbl/video/CVulkanConnection.h @@ -13,7 +13,7 @@ namespace nbl::video { -NBL_API2 int vulkaninfo(const std::span args); +NBL_API2 int vulkaninfo(const std::span args); class NBL_API2 CVulkanConnection final : public IAPIConnection { @@ -23,8 +23,6 @@ class NBL_API2 CVulkanConnection final : public IAPIConnection core::smart_refctd_ptr&& logger, const SFeatures& featuresToEnable ); - static void exportGpuProfiles(); - inline VkInstance getInternalObject() const {return m_vkInstance;} inline E_API_TYPE getAPIType() const override {return EAT_VULKAN;} diff --git a/smoke/main.cpp b/smoke/main.cpp index 6fb0cb30b6..0ef42a05a9 100644 --- a/smoke/main.cpp +++ b/smoke/main.cpp @@ -36,7 +36,7 @@ class Smoke final : public system::IApplicationFramework return false; } - nbl::video::vulkaninfo(); + exportGpuProfiles(); return true; } @@ -45,7 +45,18 @@ class Smoke final : public system::IApplicationFramework bool keepRunning() override { return false; } private: - smart_refctd_ptr m_api; + static void exportGpuProfiles() + { + for (size_t i = 0;; i++) + { + auto stringifiedIndex = std::to_string(i); + std::array args = { ("--json=" + stringifiedIndex).data(), ("-o device_" + stringifiedIndex + ".json").data() }; + int code = nbl::video::vulkaninfo(args); + + if (code != 0) + break; + } + } }; NBL_MAIN_FUNC(Smoke) diff --git a/src/nbl/video/CVulkanConnection.cpp b/src/nbl/video/CVulkanConnection.cpp index 2f5baf5ab6..5f58eaae93 100644 --- a/src/nbl/video/CVulkanConnection.cpp +++ b/src/nbl/video/CVulkanConnection.cpp @@ -7,7 +7,7 @@ // TODO: move inside `create` and call it LOG_FAIL and return nullptr #define LOG(logger, ...) if (logger) {logger->log(__VA_ARGS__);} -extern int vulkaninfo(const std::span); +extern int vulkaninfo(int, char**); namespace nbl::video { @@ -375,17 +375,9 @@ bool CVulkanConnection::endCapture() return true; } -void CVulkanConnection::exportGpuProfiles() +int vulkaninfo(const std::span args) { - for (size_t i = 0;; i++) - { - auto arg = "--json=" + std::to_string(i); - int code = ::vulkaninfo(std::array{ arg }); - if (code != 0) - break; - } + return ::vulkaninfo(args.size(), args.data()); } -NBL_API2 int vulkaninfo(const std::span args) { return ::vulkaninfo(args); } - } From cd267ad395f35052897ee38c970970307e821296 Mon Sep 17 00:00:00 2001 From: YasInvolved Date: Sun, 26 Oct 2025 18:22:08 +0100 Subject: [PATCH 24/36] print out file contents --- smoke/main.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/smoke/main.cpp b/smoke/main.cpp index 0ef42a05a9..b38c306f53 100644 --- a/smoke/main.cpp +++ b/smoke/main.cpp @@ -17,6 +17,7 @@ class Smoke final : public system::IApplicationFramework bool onAppInitialized(smart_refctd_ptr&& system) override { const char* sdk = std::getenv("NBL_INSTALL_DIRECTORY"); + //const char* sdk = "D:\\Nabla\\smoke\\build-ct\\install"; if (sdk) { @@ -47,14 +48,28 @@ class Smoke final : public system::IApplicationFramework private: static void exportGpuProfiles() { + std::string buf; + for (size_t i = 0;; i++) { auto stringifiedIndex = std::to_string(i); - std::array args = { ("--json=" + stringifiedIndex).data(), ("-o device_" + stringifiedIndex + ".json").data() }; + auto outFile = "device_" + stringifiedIndex + ".json"; + std::array args = { ("--json=" + stringifiedIndex).data(), ("-o " + outFile).data() }; + int code = nbl::video::vulkaninfo(args); if (code != 0) break; + + // print out file content + std::ifstream output(outFile); + + while (output >> buf) + { + std::cout << buf; + } + + std::cout << "\n\n"; } } }; From 8ab07a1e6859659dea9d644b724f28483581a70f Mon Sep 17 00:00:00 2001 From: YasInvolved Date: Sun, 26 Oct 2025 21:57:17 +0100 Subject: [PATCH 25/36] remove testing line --- smoke/main.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/smoke/main.cpp b/smoke/main.cpp index b38c306f53..abeb032a54 100644 --- a/smoke/main.cpp +++ b/smoke/main.cpp @@ -17,7 +17,6 @@ class Smoke final : public system::IApplicationFramework bool onAppInitialized(smart_refctd_ptr&& system) override { const char* sdk = std::getenv("NBL_INSTALL_DIRECTORY"); - //const char* sdk = "D:\\Nabla\\smoke\\build-ct\\install"; if (sdk) { From 4147b99a0e4b599a77d6e07ab58bf6d0526f97e6 Mon Sep 17 00:00:00 2001 From: YasInvolved Date: Mon, 27 Oct 2025 19:50:43 +0100 Subject: [PATCH 26/36] add verbose flag to the smoke test --- .github/workflows/build-nabla.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-nabla.yml b/.github/workflows/build-nabla.yml index e0447edfb0..10172c4e15 100644 --- a/.github/workflows/build-nabla.yml +++ b/.github/workflows/build-nabla.yml @@ -385,4 +385,4 @@ jobs: run: cmake --build smoke/out --config ${{ matrix.config }} - name: CTest Smoke - run: ctest --test-dir smoke/out --force-new-ctest-process --output-on-failure --no-tests=error -C ${{ matrix.config }} \ No newline at end of file + run: ctest --verbose --test-dir smoke/out --force-new-ctest-process --output-on-failure --no-tests=error -C ${{ matrix.config }} \ No newline at end of file From f4ff861549118815b0e836e2c4eede0c4f5ca981 Mon Sep 17 00:00:00 2001 From: YasInvolved Date: Mon, 27 Oct 2025 21:08:44 +0100 Subject: [PATCH 27/36] update vulkaninfo submodule --- 3rdparty/Vulkan-Tools | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/3rdparty/Vulkan-Tools b/3rdparty/Vulkan-Tools index 650a4db9fc..8e754cb05e 160000 --- a/3rdparty/Vulkan-Tools +++ b/3rdparty/Vulkan-Tools @@ -1 +1 @@ -Subproject commit 650a4db9fc6c45e9ae9523ea2af3a5931194b807 +Subproject commit 8e754cb05e5429c9d5d2307aee86a3d805664ba8 From c4ba936dd97a536dc0138f0c6c1b5a87b9c3c57e Mon Sep 17 00:00:00 2001 From: YasInvolved Date: Mon, 27 Oct 2025 23:06:20 +0100 Subject: [PATCH 28/36] fixed arguments, tiny bug, variable naming --- 3rdparty/Vulkan-Tools | 2 +- smoke/main.cpp | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/3rdparty/Vulkan-Tools b/3rdparty/Vulkan-Tools index 8e754cb05e..fe3336cb12 160000 --- a/3rdparty/Vulkan-Tools +++ b/3rdparty/Vulkan-Tools @@ -1 +1 @@ -Subproject commit 8e754cb05e5429c9d5d2307aee86a3d805664ba8 +Subproject commit fe3336cb12dff04bd0cb2c494bb884346b0e2d59 diff --git a/smoke/main.cpp b/smoke/main.cpp index abeb032a54..c1be36b8e1 100644 --- a/smoke/main.cpp +++ b/smoke/main.cpp @@ -47,23 +47,26 @@ class Smoke final : public system::IApplicationFramework private: static void exportGpuProfiles() { + std::string arg2 = "-o"; std::string buf; + std::string arg1; + std::string arg3; for (size_t i = 0;; i++) { auto stringifiedIndex = std::to_string(i); auto outFile = "device_" + stringifiedIndex + ".json"; - std::array args = { ("--json=" + stringifiedIndex).data(), ("-o " + outFile).data() }; + std::array args = { arg1.data(), arg2.data(), outFile.data() }; int code = nbl::video::vulkaninfo(args); - if (code != 0) + if (code == 0) break; // print out file content - std::ifstream output(outFile); + std::ifstream input(outFile); - while (output >> buf) + while (input >> buf) { std::cout << buf; } From 67b1ae6ec2120ec7bc90c9d8bbc1ff3e6bc1db9d Mon Sep 17 00:00:00 2001 From: YasInvolved Date: Mon, 27 Oct 2025 23:09:20 +0100 Subject: [PATCH 29/36] fix the operator that for some reason I thought was wrong --- smoke/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/smoke/main.cpp b/smoke/main.cpp index c1be36b8e1..924ce5640e 100644 --- a/smoke/main.cpp +++ b/smoke/main.cpp @@ -60,7 +60,7 @@ class Smoke final : public system::IApplicationFramework int code = nbl::video::vulkaninfo(args); - if (code == 0) + if (code != 0) break; // print out file content From 998616d3eb114523119e074ae502e1ccd37931a2 Mon Sep 17 00:00:00 2001 From: YasInvolved Date: Tue, 28 Oct 2025 19:32:18 +0100 Subject: [PATCH 30/36] update vulkan-tools --- 3rdparty/Vulkan-Tools | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/3rdparty/Vulkan-Tools b/3rdparty/Vulkan-Tools index fe3336cb12..29e7e7e6a8 160000 --- a/3rdparty/Vulkan-Tools +++ b/3rdparty/Vulkan-Tools @@ -1 +1 @@ -Subproject commit fe3336cb12dff04bd0cb2c494bb884346b0e2d59 +Subproject commit 29e7e7e6a8fa26d85ad223bc032ab45b6b685623 From 1e3e3ab56e7483b40c36bcd4a29ab4e0f9c3ecb9 Mon Sep 17 00:00:00 2001 From: YasInvolved Date: Tue, 28 Oct 2025 20:46:09 +0100 Subject: [PATCH 31/36] download vulkansdk in ci --- .github/workflows/build-nabla.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/build-nabla.yml b/.github/workflows/build-nabla.yml index 10172c4e15..8894e31c05 100644 --- a/.github/workflows/build-nabla.yml +++ b/.github/workflows/build-nabla.yml @@ -364,6 +364,13 @@ jobs: sparse-checkout: | smoke + - name: Download VulkanSDK + uses: humbletim/setup-vulkan-sdk@v1.2.1 + with: + vulkan-query-version: latest + vulkan-use-cache: true + vulkan-components: Vulkan-Headers, Vulkan-Loader + - name: Download Nabla install artifact uses: actions/download-artifact@v4 with: From e28ffede5f12fc290c3fed0af3ca03238c82ad05 Mon Sep 17 00:00:00 2001 From: YasInvolved Date: Wed, 29 Oct 2025 18:22:38 +0100 Subject: [PATCH 32/36] add lavapipe driver, use different action for installing vulkansdk --- .github/workflows/build-nabla.yml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-nabla.yml b/.github/workflows/build-nabla.yml index 8894e31c05..6824449abb 100644 --- a/.github/workflows/build-nabla.yml +++ b/.github/workflows/build-nabla.yml @@ -365,11 +365,15 @@ jobs: smoke - name: Download VulkanSDK - uses: humbletim/setup-vulkan-sdk@v1.2.1 + uses: jakoch/install-vulkan-sdk-action@v1 with: - vulkan-query-version: latest - vulkan-use-cache: true - vulkan-components: Vulkan-Headers, Vulkan-Loader + install_runtime: true + cache: false + stripdown: true + install_lavapipe: true + + - name: Add lavapipe driver + run: reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Khronos\Vulkan\Drivers" /v "C:\lavapipe\share\vulkan\icd.d\lvp_icd.x86_64.json" /t REG_DWORD /d 0 /f - name: Download Nabla install artifact uses: actions/download-artifact@v4 From 484575788f88e9829604beeb5c2dd5e0582ddd3c Mon Sep 17 00:00:00 2001 From: YasInvolved Date: Wed, 29 Oct 2025 19:43:38 +0100 Subject: [PATCH 33/36] fixed bugs in argument parsing and file reading routine --- 3rdparty/Vulkan-Tools | 2 +- smoke/main.cpp | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/3rdparty/Vulkan-Tools b/3rdparty/Vulkan-Tools index 29e7e7e6a8..761e7bf273 160000 --- a/3rdparty/Vulkan-Tools +++ b/3rdparty/Vulkan-Tools @@ -1 +1 @@ -Subproject commit 29e7e7e6a8fa26d85ad223bc032ab45b6b685623 +Subproject commit 761e7bf2736f3ad326fdfc1b3c1543f4e669fd5c diff --git a/smoke/main.cpp b/smoke/main.cpp index 924ce5640e..69c986369d 100644 --- a/smoke/main.cpp +++ b/smoke/main.cpp @@ -55,8 +55,9 @@ class Smoke final : public system::IApplicationFramework for (size_t i = 0;; i++) { auto stringifiedIndex = std::to_string(i); - auto outFile = "device_" + stringifiedIndex + ".json"; - std::array args = { arg1.data(), arg2.data(), outFile.data() }; + arg1 = "--json=" + stringifiedIndex; + arg3 = "device_" + stringifiedIndex + ".json"; + std::array args = { arg1.data(), arg2.data(), arg3.data() }; int code = nbl::video::vulkaninfo(args); @@ -64,11 +65,11 @@ class Smoke final : public system::IApplicationFramework break; // print out file content - std::ifstream input(outFile); + std::ifstream input(arg3); - while (input >> buf) + while (std::getline(input, buf)) { - std::cout << buf; + std::cout << buf << "\n"; } std::cout << "\n\n"; From 272d26d43f1b33393245a5e02b2238d17c4f9fa3 Mon Sep 17 00:00:00 2001 From: YasInvolved Date: Thu, 30 Oct 2025 18:57:30 +0100 Subject: [PATCH 34/36] use const char* --- include/nbl/video/CVulkanConnection.h | 2 +- src/nbl/video/CVulkanConnection.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/nbl/video/CVulkanConnection.h b/include/nbl/video/CVulkanConnection.h index b02f12f1de..f95c11e6b7 100644 --- a/include/nbl/video/CVulkanConnection.h +++ b/include/nbl/video/CVulkanConnection.h @@ -13,7 +13,7 @@ namespace nbl::video { -NBL_API2 int vulkaninfo(const std::span args); +NBL_API2 int vulkaninfo(const std::span args); class NBL_API2 CVulkanConnection final : public IAPIConnection { diff --git a/src/nbl/video/CVulkanConnection.cpp b/src/nbl/video/CVulkanConnection.cpp index 5f58eaae93..42122937a6 100644 --- a/src/nbl/video/CVulkanConnection.cpp +++ b/src/nbl/video/CVulkanConnection.cpp @@ -375,9 +375,9 @@ bool CVulkanConnection::endCapture() return true; } -int vulkaninfo(const std::span args) +int vulkaninfo(const std::span args) { - return ::vulkaninfo(args.size(), args.data()); + return ::vulkaninfo(args.size(), const_cast(args.data())); } } From d1b762db8ff9cd4438c05077db28696fd1b738a1 Mon Sep 17 00:00:00 2001 From: YasInvolved Date: Fri, 31 Oct 2025 10:34:58 +0100 Subject: [PATCH 35/36] fix smoke error --- smoke/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/smoke/main.cpp b/smoke/main.cpp index 69c986369d..2b1863d404 100644 --- a/smoke/main.cpp +++ b/smoke/main.cpp @@ -57,7 +57,7 @@ class Smoke final : public system::IApplicationFramework auto stringifiedIndex = std::to_string(i); arg1 = "--json=" + stringifiedIndex; arg3 = "device_" + stringifiedIndex + ".json"; - std::array args = { arg1.data(), arg2.data(), arg3.data() }; + std::array args = { arg1.data(), arg2.data(), arg3.data() }; int code = nbl::video::vulkaninfo(args); From 7ed26e81d24af514e47a8720865a5f460cf1bb17 Mon Sep 17 00:00:00 2001 From: YasInvolved Date: Wed, 5 Nov 2025 16:18:51 +0100 Subject: [PATCH 36/36] remove a remnant of a previous solution --- src/nbl/video/CVulkanPhysicalDevice.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/nbl/video/CVulkanPhysicalDevice.cpp b/src/nbl/video/CVulkanPhysicalDevice.cpp index e0dad4039e..da86d7c9d9 100644 --- a/src/nbl/video/CVulkanPhysicalDevice.cpp +++ b/src/nbl/video/CVulkanPhysicalDevice.cpp @@ -1,8 +1,6 @@ #include "nbl/video/CVulkanPhysicalDevice.h" #include "nbl/video/CVulkanLogicalDevice.h" -#include "nlohmann/json.hpp" // TODO/FIXME: this is probably a mess making, consult someone how to do it better. - namespace nbl::video {