当前位置:网站首页>Correct pose of Vulkan open feature
Correct pose of Vulkan open feature
2022-07-30 19:04:00 【zenny_chen】
当我们在用VulkanWhen writing some applications,Whether using its graphics pipeline or computational pipeline,More or less need to use some current equipmentVulkanExtended features not available in the core version,So how can we enable some of the features we need both safely and conveniently?This article will give you an introduction.
There are basically two ways to enable an extended feature of the current device.And the two approaches are not mutually exclusive,but need to be used together.
一、Specify a specific extension
This is a common and commonly used method.我们先调用 vkEnumerateDeviceExtensionProperties APIEnumerates the currently specified use 物理设备 How many extensions are supported in total,最后在创建 逻辑设备 When specifying the extension that needs to be used VkDeviceCreateInfo 结构体对象的 ppEnabledExtensionNames 成员之中.
Below is a rough sample code for enumerating extensions:
enum MY_CONSTANT
{
MAX_VULKAN_GLOBAL_EXT_PROPS = 256
};
// Query Vulkan extensions the current selected physical device supports
uint32_t extPropCount = 0U;
res = vkEnumerateDeviceExtensionProperties(physicalDevices[deviceIndex], NULL, &extPropCount, NULL);
if (res != VK_SUCCESS)
{
printf("vkEnumerateDeviceExtensionProperties for count failed: %d\n", res);
return res;
}
printf("The current selected physical device supports %u Vulkan extensions!\n", extPropCount);
if (extPropCount > MAX_VULKAN_GLOBAL_EXT_PROPS) {
extPropCount = MAX_VULKAN_GLOBAL_EXT_PROPS;
}
VkExtensionProperties extProps[MAX_VULKAN_GLOBAL_EXT_PROPS];
res = vkEnumerateDeviceExtensionProperties(physicalDevices[deviceIndex], NULL, &extPropCount, extProps);
if (res != VK_SUCCESS)
{
printf("vkEnumerateDeviceExtensionProperties for content failed: %d\n", res);
return res;
}
这里各位需要注意的是,Some extensions may be currentVulkanThe version has been integrated into the core,而有些GPUThe designer may no longer list the extension,因此我们用 vkEnumerateDeviceExtensionProperties 这一APIcan't be counted at all,But that doesn't mean we can't use the extension.
For example, our current device may not be enumerated VK_KHR_8BIT_STORAGE_EXTENSION_NAME 这一特征,But the feature was earlierVulkan 1.2The version has been added to the core.此时,We can go through what will be described below,Use its corresponding feature structure for further query.And the feature name happens to have a feature structure,名字为:VkPhysicalDevice8BitStorageFeatures.
另外,For some extensions without corresponding feature structures,You can also use its corresponding attribute structure to query.比如,If our current device is not enumerated VK_EXT_SHADER_SUBGROUP_VOTE_EXTENSION_NAME 这一特征,Then we can followsubgroup相关的 VkPhysicalDeviceSubgroupProperties in this property supportedOperations Do further enquiries.
We'll talk about it belowVulkanHow to query and open the feature through the feature structure.
边栏推荐
- 【Pointing to Offer】Pointing to Offer 22. The kth node from the bottom in the linked list
- 【科普】无线电波怎样传送信息?
- VBA connects Access database and Excel
- NC | Tao Liang Group of West Lake University - TMPRSS2 "assists" virus infection and mediates the host invasion of Clostridium sothrix hemorrhagic toxin...
- 二分答案裸题(加一点鸽巢原理)
- MySQL data types
- 解决终极bug,项目最终能顺利部署上线。
- Go 系统收集
- What kind of framework is friendly to developers?
- 第十七届“振兴杯”全国青年 职业技能大赛——计算机程序设计员(云计算平台与运维)参赛回顾与总结
猜你喜欢

第十七届“振兴杯”全国青年 职业技能大赛——计算机程序设计员(云计算平台与运维)参赛回顾与总结

Swiper rotates pictures and plays background music

Pytorch基础--tensorboard使用(一)

VBA 运行时错误‘-2147217900(80040e14):自动化(Automation)错误

vxe-table实现复选框鼠标拖动选中

VBA batch import Excel data into Access database

Basic use of scrapy

浅聊对比学习(Contrastive Learning)第一弹

生物医学论文有何价值 论文中译英怎样翻译效果好

Codeblocks + Widgets create window code analysis
随机推荐
NXP IMX8QXP更换DDR型号操作流程
浅聊对比学习(Contrastive Learning)第一弹
WeChat Mini Program Cloud Development | Urban Information Management
natural language processing nltk
Difference between Object and Map
Multiple instances of mysql
6块钱1斤,日本公司为何来中国收烟头?
高并发秒杀项目总结
第14章 类型信息
阿里云武林头条活动分享
Basic use of scrapy
SwiftUI iOS 精品开源项目之 完整烘焙食品菜谱App基于SQLite(教程含源码)
7.29模拟赛总结
[Use of Qt Designer tool]
架构师如何成长
[TypeScript]编译配置
SimpleOSS third-party library libcurl and engine libcurl error solution
Codeblocks + Widgets 创建窗口代码分析
【总结】1396- 60+个 VSCode 插件,打造好用的编辑器
运营 23 年,昔日“国内第一大电商网站”黄了...