Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type issues #332

Open
th3or14 opened this issue Jan 30, 2025 · 0 comments · May be fixed by #333
Open

Type issues #332

th3or14 opened this issue Jan 30, 2025 · 0 comments · May be fixed by #333

Comments

@th3or14
Copy link
Contributor

th3or14 commented Jan 30, 2025

  1. VkBool32 presentSupport should be assigned to VK_FALSE instead of false in VkBootstrap.cpp.

  2. VkAllocationCallbacks* allocation_callbacks should be assigned to nullptr instead of VK_NULL_HANDLE in VkBootstrap.h because callbacks are pointers, not handles.

  3. The problem of usage of VkBool32 in VkBootstrap.h and VkBootstrap.cpp for fields is in such initialization:

memset(fields, UINT8_MAX, sizeof(VkBool32) * field_capacity);

After setting every byte to 0xFF (UINT8_MAX), every VkBool32 field becomes 0xFFFFFFFF.

While boolean context works as expected in the current code for fields initalized in such a way, a comparison against VK_TRUE would fail because VK_TRUE (1U) is not equal to 0xFFFFFFFF, which sounds bad for a field of type VkBool32 even though there are currently no comparisons against VK_TRUE.

I would simply change the type of fields from VkBool32 to uint8_t. Then when fields become "enabled" after setting every byte to UINT8_MAX, they don't have to be equal to VK_TRUE because the type is not VkBool32. Boolean context should still work as expected.

@th3or14 th3or14 linked a pull request Jan 30, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant