zink: calculate spir-v version based on vk version

This moves the previous check up to the screen-creation, making it
possible to enable features based on the SPIR-V version.

The reason we want to be able to do this, is so we can force specific
SPIR-V versions, in order to work around bugs in tools.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11044>
This commit is contained in:
Erik Faye-Lund 2021-05-27 14:48:52 +02:00 committed by Marge Bot
parent cae50a52e2
commit 990ed280d0
3 changed files with 10 additions and 4 deletions

View file

@ -640,9 +640,7 @@ zink_shader_compile(struct zink_screen *screen, struct zink_shader *zs, struct z
assign_io_locations(nir, shader_slot_map, shader_slots_reserved);
uint32_t spirv_version = screen->vk_version >= VK_MAKE_VERSION(1, 2, 0) ?
0x00010500 : 0x00010000;
struct spirv_shader *spirv = nir_to_spirv(nir, streamout, spirv_version);
struct spirv_shader *spirv = nir_to_spirv(nir, streamout, screen->spirv_version);
if (!spirv)
goto done;

View file

@ -1049,6 +1049,14 @@ choose_pdev(struct zink_screen *screen)
/* runtime version is the lesser of the instance version and device version */
screen->vk_version = MIN2(screen->info.device_version, screen->instance_info.loader_version);
/* calculate SPIR-V version based on VK version */
if (screen->vk_version >= VK_MAKE_VERSION(1, 2, 0))
screen->spirv_version = 0x00010500;
else if (screen->vk_version >= VK_MAKE_VERSION(1, 1, 0))
screen->spirv_version = 0x00010300;
else
screen->spirv_version = 0x00010000;
}
static void

View file

@ -93,7 +93,7 @@ struct zink_screen {
struct zink_instance_info instance_info;
VkPhysicalDevice pdev;
uint32_t vk_version;
uint32_t vk_version, spirv_version;
struct util_idalloc_mt buffer_ids;
struct zink_device_info info;