为什么在 vulkan.h 中,不可分派的对象总是类型定义为 64 位?
Why in vulkan.h non dispatchable objects are always typedefed to 64bit?
查看 vulkan.h 我看到了这个:
#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
有谁知道为什么是 64 位?对我来说,总是使用 ifdef
的第一种情况似乎更合理
在spec it explicitly says中不可分派的句柄必须是64位:
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.
查看 vulkan.h 我看到了这个:
#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
有谁知道为什么是 64 位?对我来说,总是使用 ifdef
的第一种情况似乎更合理在spec it explicitly says中不可分派的句柄必须是64位:
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.