seo综合查询网站,上海建设工程施工许可证查询网站6,物流网站毕业设计论文,wordpress站点维护目录 先叨叨git信息主要逻辑VulkanEnvEnumeratePhysicalDevices()PrintPhysicalDevices() 编译并运行程序 先叨叨
上一篇已经创建了VkInstance#xff0c;本篇我们问问VkInstance#xff0c;在当前平台上有多少个支持Vulkan的物理设备。
git信息
repository: https://gite… 目录 先叨叨git信息主要逻辑VulkanEnvEnumeratePhysicalDevices()PrintPhysicalDevices() 编译并运行程序 先叨叨
上一篇已经创建了VkInstance本篇我们问问VkInstance在当前平台上有多少个支持Vulkan的物理设备。
git信息
repository: https://gitee.com/J8_series/easy-car-uibranch: mastertag: 01-EnumPhysicalDevicesurl: https://gitee.com/J8_series/easy-car-ui/tree/01-EnumPhysicalDevices
主要逻辑
VulkanEnv
新增了两个方法EnumeratePhysicalDevices()和PrintPhysicalDevices().
EnumeratePhysicalDevices()
本方作用是通过**vkEnumeratePhysicalDevices()**接口获取当前平台所有支持Vulkan的物理设备句柄
void VulkanEnv::EnumeratePhysicalDevices()
{//https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html#vkEnumeratePhysicalDevicesuint32_t physicalDeviceCount{0};vkEnumeratePhysicalDevices(m_vkInstance, physicalDeviceCount, nullptr);if (0 physicalDeviceCount){throw std::runtime_error(There is no device support Vulkan!);}m_vkPhysicalDevices.resize(physicalDeviceCount);vkEnumeratePhysicalDevices(m_vkInstance, physicalDeviceCount, m_vkPhysicalDevices.data());
}在Vulkan中所有枚举方法的调用策略都是类似的同一个方法需要调用两次。第一次调用获取对象数量第二次调用对象列表。
PrintPhysicalDevices()
本方法的作用是获取所有物理设备的属性并打印。
void VulkanEnv::PrintPhysicalDevices()
{int index {0};for (auto physicalDevice : m_vkPhysicalDevices){//https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html#vkGetPhysicalDevicePropertiesVkPhysicalDeviceProperties physicalDeviceProperties;vkGetPhysicalDeviceProperties(physicalDevice, physicalDeviceProperties);std::cout Physical Device index is physicalDeviceProperties.deviceName Type is static_castint(physicalDeviceProperties.deviceType) Support API Version is VK_VERSION_MAJOR(physicalDeviceProperties.apiVersion) . VK_VERSION_MINOR(physicalDeviceProperties.apiVersion) . VK_VERSION_PATCH(physicalDeviceProperties.apiVersion) std::endl;index;}
}编译并运行程序
我的实验电脑好像是8年前买的型号是TinkPad E480. 系统是Ubuntu22.04. 共枚举出三个物理设备。
AMD的独显型号是Radeon 500系列llvmpipe这是CPU模拟出来的虚拟显卡Intel的核显UHD Graphics 620 关于显卡类型可以查看VkPhysicalDeviceType中的定义。