【发布时间】:2019-03-16 03:03:13
【问题描述】:
我正在尝试将我现有的代码库转换为使用 lunar SDK 的 vulkan.hpp 中定义的包装器。
特别是我有这行代码:
vkEnumerateInstanceLayerProperties(&layerCount, nullptr);
用 vulkan 做事的原生 C 方式是什么。
我尝试将其更改为:
vk::enumerateInstanceLayerProperties(&layerCount, nullptr);
这是 vulkan.hpp 的命名约定。但是编译失败,出现多个错误,第一个是error: ‘unsigned int*’ is not a class, struct, or union type
vulkan.hpp 中定义的签名是:
template <typename Allocator, typename Dispatch>
VULKAN_HPP_INLINE typename ResultValueType<std::vector<LayerProperties,Allocator>>::type enumerateInstanceLayerProperties(Allocator const& vectorAllocator, Dispatch const &d )
我的假设是第一个参数需要是一个向量:
std::vector<vk::LayerProperties> availableLayers;
vk::enumerateInstanceLayerProperties(availableLayers, nullptr);
但是,这也无法编译,警告我:
error: request for member ‘vkEnumerateInstanceLayerProperties’ in ‘d’, whichis of non-class type ‘std::nullptr_t’
d 是函数的第二个参数。
dispatch 需要什么才能成功编译这段代码?
【问题讨论】: