Is Vulkan's VkMemoryHeapFlagBits missing values?

ぃ、小莉子 提交于 2019-12-10 05:32:00

问题


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

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

and this description:

• 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;

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.

Is something missing here ?


回答1:


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.

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.



来源:https://stackoverflow.com/questions/36750210/is-vulkans-vkmemoryheapflagbits-missing-values

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!