Skip to content

Type issues #332

Closed
Closed
@th3or14

Description

@th3or14
  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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions