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

我只是一个虾纸丫 提交于 2019-12-10 14:14:28

问题


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

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