vulkan/util: generate define for a selected few enums
authorLionel Landwerlin <lionel.g.landwerlin@intel.com>
Wed, 11 Nov 2020 13:27:29 +0000 (15:27 +0200)
committerMarge Bot <eric+marge@anholt.net>
Wed, 6 Oct 2021 20:22:37 +0000 (20:22 +0000)
commit9af750637050662c771868465ae96c618c87d216
treed5a9c7f03ca7a80459a4bc550ff26e66a822234b
parentdbf4cfeff559891a62acb6e9212b6ce0bad56fca
vulkan/util: generate define for a selected few enums

One of the unfortunate effect of Vulkan starting to use 64bit bitmasks
is that they can no longer be defined using enums because C doesn't
guarantees that enum values will be 64bits.

Vulkan therefore started using those patterns :

  static const VkAccessFlags2KHR VK_ACCESS_2_INDIRECT_COMMAND_READ_BIT_KHR = 0x00000001;

This has the effect that we can not longer use those values in
switch/case statements.

This change introduces defines so that we can keep doing this. For now
only VkAccessFlags2KHR/VkPipelineStageFlags2KHR are allowed to be
redefined this way, this list could be changed later (or all bitmask
could be processed this way).

v2: Generate hexadecimal numbers (Jason)

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9045>
src/vulkan/util/gen_enum_to_str.py