Where to find the definition of basic types in Vulkan

#1

I was looking for a struct defs for following:
VkPhysicalDevice
VkInstance
VkResult etc.,

I see most likely place is in vulkan/vulkan_core.h.
Still looking.

#2

Those aren’t structs. The first two are Vulkan handles, as specified by the Vulkan specification. VkResult is just a typedef of an integer.

1 Like
#3

https://www.khronos.org/registry/vulkan/specs/1.1/html/vkspec.html#VkResult
https://www.khronos.org/registry/vulkan/specs/1.1/html/vkspec.html#VK_DEFINE_HANDLE
https://www.khronos.org/registry/vulkan/specs/1.1/html/vkspec.html#VK_DEFINE_NON_DISPATCHABLE_HANDLE

1 Like
#4

Thanks I noticed that this macro in the same header file:

typedef struct object##_T* object;

That followed by bunch of defines.
I think that has something to do with ##. I have to recall what it means. I am assuming those bunch of definitions use ## as sort of wildmark to generate all those typedef statements.

#5

## is macro string concatenation.
so it would yield a pointer type to a fake struct.
It is kind of a hack to achieve some measure of type safety in C.

1 Like