问题描述
限时送ChatGPT账号..我一直在搜索,但我仍然不确定什么 VKAPI_ATTR
和 VKAPI_CALL
是什么.我不确定它们是不是我不知道的宏或一些花哨的 C++ 函数声明.
I have been searching and I still am not sure what VKAPI_ATTR
and VKAPI_CALL
are. I am not sure if they are suppose to be a macro or some fancy C++ function declaration I am not aware of.
什么是 VKAPI_ATTR void VKAPI_CALL vkCommand(void)
提供而 void vkCommand(void)
不提供的?
What is VKAPI_ATTR void VKAPI_CALL vkCommand(void)
offering that void vkCommand(void)
doesn't offer?
推荐答案
它们是确保应用正确调用约定的宏.这在 64 位中不太重要,因为它们大多收敛,但在 32 位中存在一些不兼容的.
They are macros to make sure the correct calling convention is applied. This is less important in 64 bit where they have mostly converged but in 32 bit there are several incompatible ones.
不幸的是,不同的编译器有不同的方法来做到这一点.一个将所需的标记放在返回值之前,另一个将其放在后面.
Unfortunately different compilers have different ways of doing that. One puts the required token before the return value the other puts it after.
所以标题使用两者来确保它可以覆盖所有基础.
So the header uses both to make sure it can cover all bases.
这篇关于Vulkan 中的 VKAPI_ATTR 和 VKAPI_CALL 宏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
更多推荐
[db:关键词]
发布评论