Skip to content

Commit 1337184

Browse files
committed
OpenGL driverUUID Name Info ComformanceVersion
Query Vulkan Properties of all versions and reorder SProperties to match Vulkans
1 parent d6217f7 commit 1337184

File tree

3 files changed

+83
-30
lines changed

3 files changed

+83
-30
lines changed

include/nbl/video/IPhysicalDevice.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -236,29 +236,29 @@ class IPhysicalDevice : public core::Interface, public core::Unmovable
236236

237237
struct SProperties
238238
{
239-
//--> VkPhysicalDeviceProperties:
239+
/* Vulkan Core 1.0 */
240240
APIVersion apiVersion;
241241
// uint32_t driverVersion;
242242
// uint32_t vendorID;
243243
// uint32_t deviceID;
244244
E_TYPE deviceType;
245245
// char deviceName[VK_MAX_PHYSICAL_DEVICE_NAME_SIZE];
246246
// uint8_t pipelineCacheUUID[VK_UUID_SIZE];
247-
SLimits limits;
247+
SLimits limits; // Contains Limits on Vulkan Core 1.0, 1.1, 1.2 and extensions
248248
// VkPhysicalDeviceSparseProperties sparseProperties;
249-
250-
//--> VkPhysicalDeviceDriverProperties
251-
E_DRIVER_ID driverID;
252-
// char driverName[VK_MAX_DRIVER_NAME_SIZE];
253-
// char driverInfo[VK_MAX_DRIVER_INFO_SIZE];
254-
// VkConformanceVersion conformanceVersion;
255-
256-
//--> VkPhysicalDeviceIDProperties
249+
250+
/* Vulkan Core 1.1 */
257251
uint8_t deviceUUID[VK_UUID_SIZE];
258252
// uint8_t driverUUID[VK_UUID_SIZE];
259253
// uint8_t deviceLUID[VK_LUID_SIZE];
260254
// uint32_t deviceNodeMask;
261255
// VkBool32 deviceLUIDValid;
256+
257+
/* Vulkan Core 1.2 */
258+
E_DRIVER_ID driverID;
259+
char driverName[VK_MAX_DRIVER_NAME_SIZE];
260+
char driverInfo[VK_MAX_DRIVER_INFO_SIZE];
261+
VkConformanceVersion conformanceVersion;
262262
};
263263

264264
const SProperties& getProperties() const { return m_properties; }

src/nbl/video/CVulkanPhysicalDevice.h

Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,18 @@ class CVulkanPhysicalDevice final : public IPhysicalDevice
2929
}
3030

3131
// Get physical device's limits/properties
32-
VkPhysicalDeviceDriverProperties driverProperties = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRIVER_PROPERTIES };
33-
VkPhysicalDeviceIDProperties deviceIDProperties = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES, &driverProperties };
34-
VkPhysicalDeviceSubgroupProperties subgroupProperties = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_PROPERTIES, &deviceIDProperties };
35-
VkPhysicalDeviceRayTracingPipelinePropertiesKHR rayTracingPipelineProperties = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_PIPELINE_PROPERTIES_KHR, &subgroupProperties };
32+
VkPhysicalDeviceVulkan13Properties vulkan13Properties = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_PROPERTIES, nullptr };
33+
VkPhysicalDeviceVulkan12Properties vulkan12Properties = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_PROPERTIES, &vulkan13Properties };
34+
VkPhysicalDeviceVulkan11Properties vulkan11Properties = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_PROPERTIES, &vulkan12Properties };
35+
VkPhysicalDeviceRayTracingPipelinePropertiesKHR rayTracingPipelineProperties = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_PIPELINE_PROPERTIES_KHR, &vulkan11Properties };
3636
VkPhysicalDeviceAccelerationStructurePropertiesKHR accelerationStructureProperties = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ACCELERATION_STRUCTURE_PROPERTIES_KHR, &rayTracingPipelineProperties };
3737
{
3838
VkPhysicalDeviceProperties2 deviceProperties = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2 };
3939
deviceProperties.pNext = &accelerationStructureProperties;
4040
vkGetPhysicalDeviceProperties2(m_vkPhysicalDevice, &deviceProperties);
41-
42-
memcpy(m_properties.deviceUUID, deviceIDProperties.deviceUUID, VK_UUID_SIZE);
43-
m_properties.deviceType = static_cast<E_TYPE>(deviceProperties.properties.deviceType);
44-
m_properties.driverID = static_cast<E_DRIVER_ID>(driverProperties.driverID);
45-
41+
4642
/* Vulkan Core 1.0 */
43+
m_properties.deviceType = static_cast<E_TYPE>(deviceProperties.properties.deviceType);
4744
m_properties.limits.maxImageDimension1D = deviceProperties.properties.limits.maxImageDimension1D;
4845
m_properties.limits.maxImageDimension2D = deviceProperties.properties.limits.maxImageDimension2D;
4946
m_properties.limits.maxImageDimension3D = deviceProperties.properties.limits.maxImageDimension3D;
@@ -78,19 +75,31 @@ class CVulkanPhysicalDevice final : public IPhysicalDevice
7875
m_properties.limits.lineWidthRange[1] = deviceProperties.properties.limits.lineWidthRange[1];
7976
m_properties.limits.nonCoherentAtomSize = deviceProperties.properties.limits.nonCoherentAtomSize;
8077

78+
/* Vulkan Core 1.1 */
79+
memcpy(m_properties.deviceUUID, vulkan11Properties.deviceUUID, VK_UUID_SIZE);
80+
8181
/* SubgroupProperties */
82-
m_properties.limits.subgroupSize = subgroupProperties.subgroupSize;
83-
m_properties.limits.subgroupOpsShaderStages = static_cast<asset::IShader::E_SHADER_STAGE>(subgroupProperties.supportedStages);
84-
m_properties.limits.shaderSubgroupBasic = subgroupProperties.supportedOperations & VK_SUBGROUP_FEATURE_BASIC_BIT;
85-
m_properties.limits.shaderSubgroupVote = subgroupProperties.supportedOperations & VK_SUBGROUP_FEATURE_VOTE_BIT;
86-
m_properties.limits.shaderSubgroupArithmetic = subgroupProperties.supportedOperations & VK_SUBGROUP_FEATURE_ARITHMETIC_BIT;
87-
m_properties.limits.shaderSubgroupBallot = subgroupProperties.supportedOperations & VK_SUBGROUP_FEATURE_BALLOT_BIT;
88-
m_properties.limits.shaderSubgroupShuffle = subgroupProperties.supportedOperations & VK_SUBGROUP_FEATURE_SHUFFLE_BIT;
89-
m_properties.limits.shaderSubgroupShuffleRelative = subgroupProperties.supportedOperations & VK_SUBGROUP_FEATURE_SHUFFLE_RELATIVE_BIT;
90-
m_properties.limits.shaderSubgroupClustered = subgroupProperties.supportedOperations & VK_SUBGROUP_FEATURE_CLUSTERED_BIT;
91-
m_properties.limits.shaderSubgroupQuad = subgroupProperties.supportedOperations & VK_SUBGROUP_FEATURE_QUAD_BIT;
92-
m_properties.limits.shaderSubgroupQuadAllStages = subgroupProperties.quadOperationsInAllStages;
82+
m_properties.limits.subgroupSize = vulkan11Properties.subgroupSize;
83+
m_properties.limits.subgroupOpsShaderStages = static_cast<asset::IShader::E_SHADER_STAGE>(vulkan11Properties.subgroupSupportedStages);
84+
m_properties.limits.shaderSubgroupBasic = vulkan11Properties.subgroupSupportedOperations & VK_SUBGROUP_FEATURE_BASIC_BIT;
85+
m_properties.limits.shaderSubgroupVote = vulkan11Properties.subgroupSupportedOperations & VK_SUBGROUP_FEATURE_VOTE_BIT;
86+
m_properties.limits.shaderSubgroupArithmetic = vulkan11Properties.subgroupSupportedOperations & VK_SUBGROUP_FEATURE_ARITHMETIC_BIT;
87+
m_properties.limits.shaderSubgroupBallot = vulkan11Properties.subgroupSupportedOperations & VK_SUBGROUP_FEATURE_BALLOT_BIT;
88+
m_properties.limits.shaderSubgroupShuffle = vulkan11Properties.subgroupSupportedOperations & VK_SUBGROUP_FEATURE_SHUFFLE_BIT;
89+
m_properties.limits.shaderSubgroupShuffleRelative = vulkan11Properties.subgroupSupportedOperations & VK_SUBGROUP_FEATURE_SHUFFLE_RELATIVE_BIT;
90+
m_properties.limits.shaderSubgroupClustered = vulkan11Properties.subgroupSupportedOperations & VK_SUBGROUP_FEATURE_CLUSTERED_BIT;
91+
m_properties.limits.shaderSubgroupQuad = vulkan11Properties.subgroupSupportedOperations & VK_SUBGROUP_FEATURE_QUAD_BIT;
92+
m_properties.limits.shaderSubgroupQuadAllStages = vulkan11Properties.subgroupQuadOperationsInAllStages;
9393

94+
/* Vulkan Core 1.2 */
95+
m_properties.driverID = static_cast<E_DRIVER_ID>(vulkan12Properties.driverID);
96+
memcpy(m_properties.driverName, vulkan12Properties.driverName, VK_MAX_DRIVER_NAME_SIZE);
97+
memcpy(m_properties.driverInfo, vulkan12Properties.driverInfo, VK_MAX_DRIVER_INFO_SIZE);
98+
m_properties.conformanceVersion = vulkan12Properties.conformanceVersion;
99+
100+
/* Vulkan Core 1.3 */
101+
102+
94103
/* Nabla */
95104
m_properties.limits.maxBufferSize = core::max(m_properties.limits.maxUBOSize, m_properties.limits.maxSSBOSize);
96105
m_properties.limits.maxOptimallyResidentWorkgroupInvocations = core::min(core::roundDownToPoT(deviceProperties.properties.limits.maxComputeWorkGroupInvocations),512u);

src/nbl/video/IOpenGL_PhysicalDeviceBase.h

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,50 @@ class IOpenGL_PhysicalDeviceBase : public IOpenGLPhysicalDeviceBase
302302
else
303303
m_properties.driverID = E_DRIVER_ID::EDI_UNKNOWN;
304304

305+
memset(m_properties.deviceUUID, 0, VK_UUID_SIZE);
306+
strcpy(m_properties.driverInfo, renderer);
307+
// driverName
308+
switch (m_properties.driverID)
309+
{
310+
case E_DRIVER_ID::EDI_AMD_PROPRIETARY: strcpy(m_properties.driverName, "AMD proprietary driver"); break; // from vulkan.gpuinfo.org
311+
case E_DRIVER_ID::EDI_AMD_OPEN_SOURCE: strcpy(m_properties.driverName, "AMD open-source driver"); break; // from vulkan.gpuinfo.org
312+
case E_DRIVER_ID::EDI_MESA_RADV: strcpy(m_properties.driverName, "radv"); break; // from vulkan.gpuinfo.org
313+
case E_DRIVER_ID::EDI_NVIDIA_PROPRIETARY: strcpy(m_properties.driverName, "NVIDIA"); break; // from vulkan.gpuinfo.org
314+
case E_DRIVER_ID::EDI_INTEL_PROPRIETARY_WINDOWS: strcpy(m_properties.driverName, "Intel Corporation"); break; // from vulkan.gpuinfo.org
315+
case E_DRIVER_ID::EDI_INTEL_OPEN_SOURCE_MESA: strcpy(m_properties.driverName, "Intel open-source Mesa driver"); break; // from vulkan.gpuinfo.org
316+
case E_DRIVER_ID::EDI_IMAGINATION_PROPRIETARY: strcpy(m_properties.driverName, "Imagination Proprietary driver"); break;
317+
case E_DRIVER_ID::EDI_QUALCOMM_PROPRIETARY: strcpy(m_properties.driverName, "Qualcomm Proprietary driver"); break;
318+
case E_DRIVER_ID::EDI_ARM_PROPRIETARY: strcpy(m_properties.driverName, "ARM Proprietary driver"); break;
319+
case E_DRIVER_ID::EDI_GOOGLE_SWIFTSHADER: strcpy(m_properties.driverName, "SwiftShader driver"); break; // from vulkan.gpuinfo.org
320+
case E_DRIVER_ID::EDI_GGP_PROPRIETARY: strcpy(m_properties.driverName, "GGP Proprietary driver"); break;
321+
case E_DRIVER_ID::EDI_BROADCOM_PROPRIETARY: strcpy(m_properties.driverName, "BROADCOM Proprietary driver"); break;
322+
case E_DRIVER_ID::EDI_MESA_LLVMPIPE: strcpy(m_properties.driverName, "llvmpipe"); break; // from vulkan.gpuinfo.org
323+
case E_DRIVER_ID::EDI_MOLTENVK: strcpy(m_properties.driverName, "MoltenVk Driver"); break;
324+
case E_DRIVER_ID::EDI_COREAVI_PROPRIETARY: strcpy(m_properties.driverName, "COREAVI Proprietary driver"); break;
325+
case E_DRIVER_ID::EDI_JUICE_PROPRIETARY: strcpy(m_properties.driverName, "JUICE Proprietary driver"); break;
326+
case E_DRIVER_ID::EDI_VERISILICON_PROPRIETARY: strcpy(m_properties.driverName, "VERISILICON Proprietary driver"); break;
327+
case E_DRIVER_ID::EDI_MESA_TURNIP: strcpy(m_properties.driverName, "turnip Mesa driver"); break; // from vulkan.gpuinfo.org
328+
case E_DRIVER_ID::EDI_MESA_V3DV: strcpy(m_properties.driverName, "V3DV Mesa driver"); break;
329+
case E_DRIVER_ID::EDI_MESA_PANVK: strcpy(m_properties.driverName, "PANVK Mesa driver"); break;
330+
case E_DRIVER_ID::EDI_SAMSUNG_PROPRIETARY: strcpy(m_properties.driverName, "Samsung Driver"); break;
331+
case E_DRIVER_ID::EDI_MESA_VENUS: strcpy(m_properties.driverName, "venus"); break; // from vulkan.gpuinfo.org
332+
case E_DRIVER_ID::EDI_UNKNOWN:
333+
default: strcpy(m_properties.driverName, "UNKNOWN"); break;
334+
}
335+
336+
337+
// conformanceVersion
338+
if(m_properties.driverID == E_DRIVER_ID::EDI_INTEL_OPEN_SOURCE_MESA || m_properties.driverID == E_DRIVER_ID::EDI_INTEL_PROPRIETARY_WINDOWS)
339+
m_properties.conformanceVersion = {4u, 4u, 0u, 0u};
340+
else if(m_properties.driverID == E_DRIVER_ID::EDI_AMD_OPEN_SOURCE || m_properties.driverID == E_DRIVER_ID::EDI_AMD_PROPRIETARY)
341+
m_properties.conformanceVersion = {3u, 3u, 0u, 0u};
342+
else if(m_properties.driverID == E_DRIVER_ID::EDI_NVIDIA_PROPRIETARY)
343+
m_properties.conformanceVersion = {4u, 4u, 0u, 0u};
344+
else
345+
{
346+
// TODO(Erfan):???
347+
}
348+
305349
m_glfeatures.isIntelGPU = (m_properties.driverID == E_DRIVER_ID::EDI_INTEL_OPEN_SOURCE_MESA || m_properties.driverID == E_DRIVER_ID::EDI_INTEL_PROPRIETARY_WINDOWS);
306350

307351
// Heuristic to detect Physical Device Type until we have something better:

0 commit comments

Comments
 (0)