Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
de89a25
add a structure that holds information about vulkan devices
YasInvolved Sep 28, 2025
92fd0f0
small change in naming
YasInvolved Sep 30, 2025
a8f4dbb
store a reference to a coresponding profile in CVulkanPhysicalDevice,…
YasInvolved Sep 30, 2025
a8d9ea3
add vulkan-tools submodule and include it in nabla
YasInvolved Oct 6, 2025
67ee163
update vulkan headers, link vulkaninfo to nabla
YasInvolved Oct 8, 2025
e4207b8
link vulkaninfo as static library
YasInvolved Oct 10, 2025
dd4c7fd
update vulkan-tools
YasInvolved Oct 10, 2025
e645f4f
update vulkan-headers
YasInvolved Oct 10, 2025
824662a
fixed silly mistake in Vulkan-Tools, mimic headers from vulkansdk for…
YasInvolved Oct 10, 2025
0002aef
remove unused stuff
YasInvolved Oct 12, 2025
1361717
make vulkaninfo "callable" from nabla
YasInvolved Oct 12, 2025
9cb542d
update branch and resolve merge conflicts
YasInvolved Oct 15, 2025
6f6420b
link vulkaninfo to nabla again
YasInvolved Oct 15, 2025
471d128
make exportGpuProfile function in CVulkanConnection static
YasInvolved Oct 15, 2025
6e15b42
call exportGpuProfile in smoke
YasInvolved Oct 15, 2025
e2bb3cc
fix nonexistent vulkan-headers library
YasInvolved Oct 16, 2025
e3c34aa
do vulkan-headers stuff as it should be done from the beginning
YasInvolved Oct 18, 2025
2725307
update vulkan-tools
YasInvolved Oct 18, 2025
4c7386b
make vulkaninfo a standalone function and export a profile for all gp…
YasInvolved Oct 19, 2025
e956dca
fix broken submodule
YasInvolved Oct 19, 2025
58bceda
fix git-version-tracking
YasInvolved Oct 19, 2025
211ad29
fix dxc submodule
YasInvolved Oct 19, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions include/nbl/video/CVulkanConnection.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class NBL_API2 CVulkanConnection final : public IAPIConnection

inline IDebugCallback* getDebugCallback() const override {return m_debugCallback.get();}

inline const core::vector<core::string>& getVulkanDevicesInfo() const { return m_vulkanDevicesInfo; }
inline const core::vector<core::string>& getVulkanProfiles() const { return m_vulkanProfiles; }

bool startCapture() override;
bool endCapture() override;
Expand All @@ -46,7 +46,7 @@ class NBL_API2 CVulkanConnection final : public IAPIConnection
const VkDebugUtilsMessengerEXT m_vkDebugUtilsMessengerEXT;
const std::unique_ptr<CVulkanDebugCallback> m_debugCallback; // this needs to live longer than VkDebugUtilsMessengerEXT handle above
std::atomic_flag flag;
core::vector<core::string> m_vulkanDevicesInfo;
core::vector<core::string> m_vulkanProfiles;
};

}
Expand Down
5 changes: 3 additions & 2 deletions src/nbl/video/CVulkanConnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -297,10 +297,11 @@ core::smart_refctd_ptr<CVulkanConnection> CVulkanConnection::create(core::smart_

core::smart_refctd_ptr<CVulkanConnection> 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);
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);
Expand Down
13 changes: 11 additions & 2 deletions src/nbl/video/CVulkanPhysicalDevice.cpp
Original file line number Diff line number Diff line change
@@ -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
{

Expand All @@ -10,7 +12,7 @@ do { \
return nullptr; \
} while(0)

std::unique_ptr<CVulkanPhysicalDevice> CVulkanPhysicalDevice::create(core::smart_refctd_ptr<system::ISystem>&& sys, IAPIConnection* const api, renderdoc_api_t* const rdoc, const VkPhysicalDevice vk_physicalDevice)
std::unique_ptr<CVulkanPhysicalDevice> CVulkanPhysicalDevice::create(core::smart_refctd_ptr<system::ISystem>&& sys, IAPIConnection* const api, renderdoc_api_t* const rdoc, const VkPhysicalDevice vk_physicalDevice, core::string& profile)
{
system::logger_opt_ptr logger = api->getDebugCallback()->getLogger();

Expand All @@ -25,6 +27,8 @@ std::unique_ptr<CVulkanPhysicalDevice> 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;
Expand Down Expand Up @@ -263,7 +267,10 @@ std::unique_ptr<CVulkanPhysicalDevice> 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
{
Expand Down Expand Up @@ -1366,8 +1373,10 @@ std::unique_ptr<CVulkanPhysicalDevice> 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<CVulkanPhysicalDevice>(new CVulkanPhysicalDevice(std::move(initData),rdoc,vk_physicalDevice,std::move(availableFeatureSet)));
return std::unique_ptr<CVulkanPhysicalDevice>(new CVulkanPhysicalDevice(std::move(initData),rdoc,vk_physicalDevice,std::move(availableFeatureSet),profile));
}

#undef RETURN_NULL_PHYSICAL_DEVICE
Expand Down
9 changes: 6 additions & 3 deletions src/nbl/video/CVulkanPhysicalDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,17 @@ namespace nbl::video
class CVulkanPhysicalDevice final : public IPhysicalDevice
{
public:
static std::unique_ptr<CVulkanPhysicalDevice> create(core::smart_refctd_ptr<system::ISystem>&& sys, IAPIConnection* const api, renderdoc_api_t* const rdoc, const VkPhysicalDevice vk_physicalDevice);
static std::unique_ptr<CVulkanPhysicalDevice> create(core::smart_refctd_ptr<system::ISystem>&& 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<std::string>&& _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<std::string>&& _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.
Expand Down Expand Up @@ -115,6 +117,7 @@ class CVulkanPhysicalDevice final : public IPhysicalDevice
renderdoc_api_t* const m_rdoc_api;
const VkPhysicalDevice m_vkPhysicalDevice;

core::string& m_profile;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what are you doing!?

you do realize the vector grows and reallocates ? you need an index into it!

Copy link
Contributor Author

@YasInvolved YasInvolved Oct 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, I forgot that it might behave like that. Let me correct that

const core::unordered_set<std::string> m_extensions;
};

Expand Down
Loading