当前位置:网站首页>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.
边栏推荐
- 在华为云,见证迷你世界的神奇觉醒
- After 23 years of operation, the former "China's largest e-commerce website" has turned yellow...
- 第4章 控制执行流程
- 【剑指 Offe】剑指 Offer 18. 删除链表的节点
- SimpleOSS third-party library libcurl and engine libcurl error solution
- 中集世联达飞瞳全球工业人工智能AI领军者,全球顶尖AI核心技术高泛化性高鲁棒性稀疏样本持续学习,工业级高性能成熟AI产品规模应用
- MYSQL(基本篇)——一篇文章带你走进MYSQL的奇妙世界
- 怎么样的框架对于开发者是友好的?
- kotlin的by lazy
- C# wpf 无边框窗口添加阴影效果
猜你喜欢
【Pointing to Offer】Pointing to Offer 22. The kth node from the bottom in the linked list
中集世联达工业级成熟航运港口人工智能AI产品规模化应用,打造新一代高效能智慧港口和创新数字港口,全球港航人工智能能领军者中集飞瞳
C# wpf borderless window add shadow effect
《痞子衡嵌入式半月刊》 第 59 期
NXP IMX8QXP更换DDR型号操作流程
C# wpf 无边框窗口添加阴影效果
开心的聚餐
kotlin by lazy
Immersive experience iFLYTEK 2022 Consumer Expo "Official Designated Product"
【剑指 Offe】剑指 Offer 17. 打印从1到最大的n位数
随机推荐
攻防世界web-Cat
AI基础:图解Transformer
SimpleOSS第三方库libcurl与引擎libcurl错误解决方法
Chapter 4 Controlling the Execution Flow
【Swords Offer】Swords Offer 17. Print n digits from 1 to the largest
【PHPWord】PHPOffice 套件之PHPWord快速入门
MYSQL(基本篇)——一篇文章带你走进MYSQL的奇妙世界
设计消息队列存储消息数据的 MySQL 表格
What kind of framework is friendly to developers?
The large-scale application of artificial intelligence AI products in industrial-grade mature shipping ports of CIMC World Lianda will create a new generation of high-efficiency smart ports and innova
[Summary] 1396- 60+ VSCode plugins to create a useful editor
node封装一个控制台进度条插件
常见链表题及其 Go 实现
Pytorch foundation -- tensorboard use (1)
Chapter 14 Type Information
防抖和节流有什么区别,分别用于什么场景?
VBA 运行时错误‘-2147217900(80040e14):自动化(Automation)错误
【PHPWord】Quick Start of PHPWord in PHPOffice Suite
【每日一道LeetCode】——191. 位1的个数
The advanced version of the Niu Ke brushing series (team competition, sorting subsequences, inverting strings, deleting common characters, repairing pastures)