Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why in vulkan.h non dispatchable objects are always typedefed to 64bit?

Tags:

c

vulkan

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

like image 395
hiddenbit Avatar asked Feb 23 '16 15:02

hiddenbit


1 Answers

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.

like image 98
ratchet freak Avatar answered Sep 22 '22 12:09

ratchet freak