What cause VK_ERROR_DEVICE_LOST error?

There’s not problem when running vulkan program on Intel HD 530.But when i run on GTX 960M VK_ERROR_DEVICE_LOST pop out.Could it because of driver bug?

Undefined behavior may result in VK_ERROR_DEVICE_LOST, notably bad synchronization.
If the OS feels your async execution takes too long, that may also be VK_ERROR_DEVICE_LOST.
HW failure such as overheating may cause this too.
And of course driver bug is always a possibility too.

I hope it just driver bug

I hope not. That’s practically the worst case situation.

1 Like

Why it’s worst case situation? I haven’t update the driver for almost a year.

OK, that’s a wholly different story.

It would be the worst case, because it would affect everyone, and all you can do about it is write an ugly workaround (assuming you know exactly how the driver bug works).
In contrast, bug in your app affects only you, and you can simply fix your code.

I just figured out i forgot to reassign vk::BufferCopy::size to new buffer size before calling vk::CommandBuffer::copyBuffer.It works now.

Mr krOoze can you suggest me a good resource for leaning vulkan.I’m currently leaning through trial and error.I’m not even sure what I’m doing is good method or not.

I am not the best person to ask. There were not many resources around when I started learning it.
I pretty much used this outline how to get a triangle on the screen and the Vulkan specification. So I may be biased, but I think the Vulkan specification itself is quite usable to learn.

Good thing about Vulkan is that it is relatively simple (“simple” as in math, not necessarily “simple” as “easy to learn”; if you know what I mean). Once you get a triangle on the screen you know like 80 % of the core functionality of Vulkan.

Vulkan has objects, and most of them have constant state during their lifetime – that IMO makes it easy to reason about, and learn the purpose of individual commands.

What is tricky to learn from the spec is the synchronization, and the shader interface. Then again, the synchronization chapter was much improved, while some of the available tutorials are still either silent, or confusing about this matter.

Problem with trial and error is the Undefined Behavior. The “error” is not always visible. As you witnessed, your app may work just fine, while still containing an error.
There are the VK_LAYER_LUNARG_standard_validation Validation Layers that everyone should use during development phase. But the coverage is not absolute – especially about synchronization errors. So, you can get away with trial and error, but it pays to learn the synchronization theory upfront and trying to avoid errors there.

Perhaps one of these pages can help guide you to a good learning resource:

https://www.khronos.org/blog/beginners-guide-to-vulkan

https://github.com/KhronosGroup/Khronosdotorg/blob/master/api/vulkan/resources.md