[英]Vulkan instance creation fails
I have a vulkan program that is running on my laptop but fails on my desktop.我有一个 vulkan 程序在我的笔记本电脑上运行,但在我的台式机上失败了。 The error is:
错误是:
HeatMethod: ../libraries/vulkansdk-linux/1.2.154.0/source/Vulkan-Headers/include/vulkan/vulkan.hpp:13143: typename vk::ResultValueType<vk::UniqueHandle<Type, Dispatch> >::type vk::createResultValue(vk::Result, T&, const char*, const typename vk::UniqueHandleTraits<Type, Dispatch>::deleter&) [with T = vk::Instance; D = vk::DispatchLoaderStatic; typename vk::ResultValueType<vk::UniqueHandle<Type, Dispatch> >::type = vk::ResultValue<vk::UniqueHandle<vk::Instance, vk::DispatchLoaderStatic> >; typename vk::UniqueHandleTraits<Type, Dispatch>::deleter = vk::ObjectDestroy<vk::NoParent, vk::DispatchLoaderStatic>]: Assertion `result == Result::eSuccess' failed.
I used comments to track down the problem and found that it happens upon instance creation:我使用注释来追踪问题,发现它发生在实例创建时:
// Global scope
const std::vector<const char*> VALIDATION_LAYERS = {
"VK_LAYER_KHRONOS_validation",
};
// Setup general information about the current application
vk::ApplicationInfo program_info(
"Vulkan Engine",
VK_MAKE_VERSION(1, 0, 0),
"No Engine",
VK_MAKE_VERSION(1, 0, 0),
VK_API_VERSION_1_2);
if(!CheckAvailableLayers())
RecordLogError("Validation layers requested, but not available!");
vector<const char*> required_extensions;
if(!RequestExtensions(required_extensions))
RecordLogError("Missing a required extension");
// Create Vulkan instance to communicate with the loader
vk::InstanceCreateInfo createInfo(
{},
&program_info,
static_cast<uint32_t>(VALIDATION_LAYERS.size()),
VALIDATION_LAYERS.data(),
static_cast<uint32_t>(required_extensions.size()),
required_extensions.data());
auto [result, instance] = vk::createInstanceUnique(createInfo);
The error itself is a failed asseriton in the hpp header, so it's kinda cryptic.错误本身是 hpp 标头中的失败断言,所以它有点神秘。 I am not sure what the problem is.
我不确定问题是什么。
The problem was trying to set the validation layers on a build script:问题是试图在构建脚本上设置验证层:
os.environ['VK_INSTANCE_LAYERS'] = 'VK_LAYER_LUNARG_standard_validation'
Deleting that line solved the issue.删除该行解决了问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.