问题
Looking into the vulkan.h i see this:
#if defined(__LP64__) || defined(_WIN64) || defined(__x86_64__) || .....
#define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) typedef struct object##_T *object;
#else
#define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) typedef uint64_t object;
#endif
Does anyone has an idea why the 64bits? For me it appears more reasonable to always use the first case of the ifdef
回答1:
In the spec it explicitly says that the non-dispatchable handles must be 64 bits:
Non-dispatchable handle types are a 64-bit integer type whose meaning is implementation-dependent, and may encode object information directly in the handle rather than pointing to a software structure. Objects of a non-dispatchable type may not have unique handle values within a type or across types. If handle values are not unique, then destroying one such handle must not cause identical handles of other types to become invalid, and must not cause identical handles of the same type to become invalid if that handle value has been created more times than it has been destroyed.
来源:https://stackoverflow.com/questions/35581131/why-in-vulkan-h-non-dispatchable-objects-are-always-typedefed-to-64bit