1
1
#include " nbl/video/CVulkanPhysicalDevice.h"
2
2
#include " nbl/video/CVulkanLogicalDevice.h"
3
3
4
+ #include " nlohmann/json.hpp" // TODO/FIXME: this is probably a mess making, consult someone how to do it better.
5
+
4
6
namespace nbl ::video
5
7
{
6
8
10
12
return nullptr ; \
11
13
} while (0 )
12
14
13
- 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)
15
+ 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 )
14
16
{
15
17
system::logger_opt_ptr logger = api->getDebugCallback ()->getLogger ();
16
18
@@ -25,6 +27,8 @@ std::unique_ptr<CVulkanPhysicalDevice> CVulkanPhysicalDevice::create(core::smart
25
27
}
26
28
});
27
29
30
+ using json = nlohmann::json;
31
+ json profileObject = { {" $schema" , " https://schema.khronos.org/vulkan/profiles-0.8-latest.json" } };
28
32
29
33
auto & properties = initData.properties ;
30
34
auto & features = initData.features ;
@@ -263,7 +267,10 @@ std::unique_ptr<CVulkanPhysicalDevice> CVulkanPhysicalDevice::create(core::smart
263
267
assert (VK_SUCCESS==res);
264
268
265
269
for (const auto & vk_extension : vk_extensions)
270
+ {
271
+ profileObject[" capabilities" ][" device" ][" extensions" ][vk_extension.extensionName ] = vk_extension.specVersion ;
266
272
availableFeatureSet.insert (vk_extension.extensionName );
273
+ }
267
274
}
268
275
auto isExtensionSupported = [&availableFeatureSet](const char * name)->bool
269
276
{
@@ -1366,8 +1373,10 @@ std::unique_ptr<CVulkanPhysicalDevice> CVulkanPhysicalDevice::create(core::smart
1366
1373
// bufferUsages.opticalFlowCost = anyFlag(bufferFeatures,VK_FORMAT_FEATURE_2_OPTICAL_FLOW_COST_BIT_NV);
1367
1374
}
1368
1375
1376
+ profile = profileObject.dump (4 ); // nicely indented json
1377
+
1369
1378
success = true ;
1370
- return std::unique_ptr<CVulkanPhysicalDevice>(new CVulkanPhysicalDevice (std::move (initData),rdoc,vk_physicalDevice,std::move (availableFeatureSet)));
1379
+ return std::unique_ptr<CVulkanPhysicalDevice>(new CVulkanPhysicalDevice (std::move (initData),rdoc,vk_physicalDevice,std::move (availableFeatureSet),profile ));
1371
1380
}
1372
1381
1373
1382
#undef RETURN_NULL_PHYSICAL_DEVICE
0 commit comments