diff --git a/src/gallium/drivers/zink/zink_compiler.c b/src/gallium/drivers/zink/zink_compiler.c index 63d570db30b..c5a592fa76e 100644 --- a/src/gallium/drivers/zink/zink_compiler.c +++ b/src/gallium/drivers/zink/zink_compiler.c @@ -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; diff --git a/src/gallium/drivers/zink/zink_screen.c b/src/gallium/drivers/zink/zink_screen.c index 548c8d56dcd..8e012d38d69 100644 --- a/src/gallium/drivers/zink/zink_screen.c +++ b/src/gallium/drivers/zink/zink_screen.c @@ -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 diff --git a/src/gallium/drivers/zink/zink_screen.h b/src/gallium/drivers/zink/zink_screen.h index 1c4fb29cac5..b8ef5d87254 100644 --- a/src/gallium/drivers/zink/zink_screen.h +++ b/src/gallium/drivers/zink/zink_screen.h @@ -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;