Skip to content

Commit

Permalink
[Vk] add mActiveDevice.driverID and mActiveDevice.apiVersion
Browse files Browse the repository at this point in the history
  • Loading branch information
eugenegff committed Nov 27, 2024
1 parent 87c9523 commit bef4093
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions RenderSystems/Vulkan/include/OgreVulkanRenderSystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ namespace Ogre
{
VkPhysicalDevice physicalDevice;
uint64 physicalDeviceID[2];
VkDriverId driverID;
uint32 apiVersion;
String title;
};

Expand Down
8 changes: 7 additions & 1 deletion RenderSystems/Vulkan/src/OgreVulkanDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -445,27 +445,33 @@ namespace Ogre

// { deviceLUID, 0 } on Windows, deviceUUID or name hash otherwise
uint64 uid[2] = {};
VkDriverId driverID = VkDriverId( 0 );
if( GetPhysicalDeviceProperties2 && deviceProps.apiVersion >= VK_API_VERSION_1_2 )
{
// VkPhysicalDeviceIDProperties requires enabled VK_KHR_EXTERNAL_xxx extensions
VkPhysicalDeviceProperties2 deviceProps2;
VkPhysicalDeviceVulkan11Properties vulkan11Props; // requires VK_API_VERSION_1_2
VkPhysicalDeviceDriverProperties driverProps; // requires VK_API_VERSION_1_2
makeVkStruct( deviceProps2, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2 );
makeVkStruct( vulkan11Props, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_PROPERTIES );
makeVkStruct( driverProps, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRIVER_PROPERTIES );
deviceProps2.pNext = &vulkan11Props;
vulkan11Props.pNext = &driverProps;
GetPhysicalDeviceProperties2( device, &deviceProps2 );
if( vulkan11Props.deviceLUIDValid )
memcpy( uid, vulkan11Props.deviceLUID, VK_LUID_SIZE );
else
memcpy( uid, vulkan11Props.deviceUUID, VK_UUID_SIZE );
driverID = driverProps.driverID;
}
else
{
OGRE_HASH128_FUNC( name.c_str(), (int)name.size(), IdString::Seed, uid );
}

LogManager::getSingleton().logMessage( "Vulkan: \"" + name + "\"" );
mVulkanPhysicalDevices.push_back( { device, { uid[0], uid[1] }, name } );
mVulkanPhysicalDevices.push_back(
{ device, { uid[0], uid[1] }, driverID, deviceProps.apiVersion, name } );
}

LogManager::getSingleton().logMessage( "Vulkan: Device detection ends" );
Expand Down

0 comments on commit bef4093

Please sign in to comment.