zink: avoid generating nonsensical code
authorErik Faye-Lund <erik.faye-lund@collabora.com>
Wed, 25 Aug 2021 19:51:44 +0000 (21:51 +0200)
committerMarge Bot <eric+marge@anholt.net>
Fri, 27 Aug 2021 18:55:19 +0000 (18:55 +0000)
commit4b8f2b99e852986551661f166d16f8eccfe9e560
tree42ab814c20b4e760d7359a2f01238a18b8197595
parenta00fccce0c68ab64158c371fcdfcce2846f2648d
zink: avoid generating nonsensical code

With this code, we end up generating code such as:

if (!strcmp(extensions[i].extensionName, "VK_KHR_maintenance1")) {
   if (VK_MAKE_VERSION(1,2,0) >= screen->vk_version) {
      info->have_KHR_maintenance1 = true;
   } else {
      info->have_KHR_maintenance1 = true;
   }
}

That's clearly nonsense, as it does the same thing in the true and false
case. So let's instead try to walk the Vulkan versions up to the one
we're using in a separate pass, and add all extensions that were made core
in that version.

CID: 1473289

Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12593>
src/gallium/drivers/zink/zink_device_info.py