为什么在 vulkan.h 中不可调度对象总是被定义为 64 位? [英] Why in vulkan.h non dispatchable objects are always typedefed to 64bit?

查看:41
本文介绍了为什么在 vulkan.h 中不可调度对象总是被定义为 64 位?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

查看 vulkan.h 我看到了:

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

有谁知道为什么是 64 位?对我来说,总是使用 ifdef 的第一种情况似乎更合理

Does anyone has an idea why the 64bits? For me it appears more reasonable to always use the first case of the ifdef

推荐答案

spec 明确指出不可调度句柄必须是 64 位:

In the spec it explicitly says that the non-dispatchable handles must be 64 bits:

不可分派句柄类型是一个 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 中不可调度对象总是被定义为 64 位?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆