Why doesn't the Vulkan specification define VkDeviceSize?

The Vulkan specification (1.0.12) introduces VkDeviceSize in section 2.4:

With a few exceptions, Vulkan uses standard C types for parameters (int types from stdint.h, etc.). Exceptions to this are the use of VkResult for return values ​​using VkBool32 for boolean values, VkDeviceSize for sizes and offsets related to the device address space, and VkFlags for transferring bits or sets of bits of predefined values.

However, he never tells us what the underlying type of VkDeviceSize is. How should we know if it is possible to convert between VkDeviceSize and size_t?

From the headers supplied with the SDK, I see that it is typedef'ed for uint64_t. How likely is this to change at any time in the future?

+4
source share
2 answers

Why doesn't the Vulkan specification define VkDeviceSize?

Please note that the Vulkan specification does not indicate, for example, the value of any of its counters. What for? Because they are listed in vk.xml, which is used to generate vulkan.h.

The same goes for VkDeviceSize. Just like for all the other types that Volcano defines.

Yes, the OpenGL specification specified specific sizes for various types. But Vulcan does not, and this is not necessary.

How should we know if it is possible to convert between VkDeviceSizeand a size_t?

, , :

  • size_t, , VkDeviceSize.

  • VkDeviceSize, , size_t.

, , VkDeviceSize, vkAllocateMemory ( , / .., ). , size_t, VkDeviceSize, ... ?

, , , , , . , VkDeviceSize. , size_t , , , .

, , .

# 2 vkGetPhysicalDeviceMemoryProperties. size_t , , ... , size_t ? , , VkDeviceSize?

, ?

. ? - Vulkan .

Vulkan - . , Vulkan 1.0, Vulkan 1.1. 1.2. .

VkDeviceSize , ( ) . Vulkan, -, , :

API , , , , - .

, .

, VkDeviceSize . , , . , , , .

+6

vk.xml( uint64_t). :

API- Vulkan XML , Vulkan. src/spec/vk.xml [...]

, , 1.0.X( () , )

You can request it using the operator sizeof(). You don’t even know the size of size_t.

+2
source

All Articles