charles-lunarg / vk-bootstrap

Vulkan Bootstrapping Iibrary
MIT License
818 stars 82 forks source link

[Fatal Error] [Segmentation Fault] in supports_features Function #282

Closed imad23m closed 5 months ago

imad23m commented 5 months ago

Greetings.

I have been experiencing Segmentation Fault when starting my project, using GDB I got the following error:

Thread 1 received signal SIGSEGV, Segmentation fault. 0x00007ff722992736 in vkb::PhysicalDeviceSelector::is_device_suitable (this=0xb51c3fe5e0, pd=...) at ../dep/vk-bootstrap/src/VkBootstrap.cpp:1189 1189 bool required_features_supported = detail::supports_features(

The error happens only sometimes, not every instance, probably related to #91

I couldn't manage to pin point where the issue in the function call itself happens, however changing all function arguments to pointers seem to have resolved the issue.

it seems sending complex objects in the function call results in some sort of memory issue, but not sure.

if any further information is needed, kindly let me know.

Thank You.

charles-lunarg commented 5 months ago

This is a failure that enabling address sanitizer would be the way to debug.

Can you share the code that is causing the error? (most usage of vk-bootstrap is localized to a single file so is easy to share). I'm hesitant to merge a fix for an undiagnosed crash.

charles-lunarg commented 5 months ago

Are you willing to try out a different branch of vk-bootstrap? This uses references instead of passing by value. https://github.com/charles-lunarg/vk-bootstrap/tree/supports_features_use_references

imad23m commented 5 months ago

This is a failure that enabling address sanitizer would be the way to debug.

I might go back and try to understand what caused the issue using address sanitizer.

Can you share the code that is causing the error?

sure, here:

vkb::PhysicalDeviceSelector vkb_physical_device_selector{MY_INSTANCE};

    auto vkb_physical_device_selector_result = vkb_physical_device_selector
    .set_surface(MY_SURFACE)
    .select();

Are you willing to try out a different branch of vk-bootstrap? This uses references instead of passing by value. https://github.com/charles-lunarg/vk-bootstrap/tree/supports_features_use_references

I have tried it and it works, however just like you mentioned in #283 it is near the same as my poll request.

Closing this Issue as the fix for it was merged.

Thank You so much.

Imad Laggoune.