Vulkan的VkMemoryHeapFlagBits缺少值吗? [英] Is Vulkan's VkMemoryHeapFlagBits missing values?

查看:74
本文介绍了Vulkan的VkMemoryHeapFlagBits缺少值吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Vulkan规格1.0.9(第180页)下,我们具有以下功能:

At Vulkan specs 1.0.9 (pg. 180), we have the following:

typedef struct VkMemoryHeap {
  VkDeviceSize size;
  VkMemoryHeapFlags flags;
} VkMemoryHeap;

和此描述:

•size是堆中的总内存大小(以字节为单位).

• size is the total memory size in bytes in the heap.

•标志是堆的属性标志的位掩码.标志中指定的位是:

• flags is a bitmask of attribute flags for the heap. The bits specified in flags are:

typedef enum VkMemoryHeapFlagBits {
VK_MEMORY_HEAP_DEVICE_LOCAL_BIT = 0x00000001,
} VkMemoryHeapFlagBits;

但是当我查询VkPhysicalDeviceMemoryProperties时,我得到了带有零值的标志.我的代码与Vulkan SDK vkjson_info.exe工具的输出匹配,该工具会输出具有我GPU中的属性的JSON文件.

But when I query VkPhysicalDeviceMemoryProperties I've got flags with zero values. My code matches the output from Vulkan SDK vkjson_info.exe tool, which output a JSON file with properties from my GPU.

这里缺少什么吗?

推荐答案

否. VkMemoryHeap::flags完全为0是完全有效的.这不是枚举值可以达到少数几种不同可能性之一的方法.通常,标志彼此独立.

No. It is perfectly valid for VkMemoryHeap::flags to be 0. A particular flag is either present or absent; it's not an enumeration where the value can attain one of a small number of different possibilities. Usually, flags are independent of one another.

这就是位标志的工作方式;它们代表布尔条件.特定标志存在或不存在.如果存在标志,则对象达到标志定义的含义.如果不存在,则对象具有该含义.

That's how bitflags work; they represent boolean conditions. A particular flag is either present or absent. If a flag is present, then the object attains the meaning that the flag defines. If it is absent, then the object doesn't have that meaning.

带有VK_MEMORY_HEAP_DEVICE_LOCAL_BIT的堆的含义恰恰是规范所说的含义:堆对应于设备本地内存".没有设置该标志的堆意味着对应于设备本地内存".

A heap with VK_MEMORY_HEAP_DEVICE_LOCAL_BIT means exactly what the specification says it means: "the heap corresponds to device local memory". A heap without that flag set means that heap does not "correspond to device local memory".

该规范要求至少 个堆设置此标志.但这就是全部.

The specification requires that at least one heap have this flag set. But that's all.

这篇关于Vulkan的VkMemoryHeapFlagBits缺少值吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆