1 /* 2 * Copyright 2024 Google LLC 3 * SPDX-License-Identifier: MIT 4 */ 5 6 #ifndef VK_UTIL_COMPILER_H 7 #define VK_UTIL_COMPILER_H 8 9 #include <vulkan/vulkan_core.h> 10 11 #include "compiler/shader_enums.h" 12 #include "util/bitscan.h" 13 14 static inline gl_shader_stage vk_to_mesa_shader_stage(VkShaderStageFlagBits vk_stage)15vk_to_mesa_shader_stage(VkShaderStageFlagBits vk_stage) 16 { 17 assert(util_bitcount((uint32_t) vk_stage) == 1); 18 return (gl_shader_stage) (ffs((uint32_t) vk_stage) - 1); 19 } 20 21 static inline VkShaderStageFlagBits mesa_to_vk_shader_stage(gl_shader_stage mesa_stage)22mesa_to_vk_shader_stage(gl_shader_stage mesa_stage) 23 { 24 return (VkShaderStageFlagBits) (1 << ((uint32_t) mesa_stage)); 25 } 26 27 struct nir_spirv_specialization; 28 29 struct nir_spirv_specialization* 30 vk_spec_info_to_nir_spirv(const VkSpecializationInfo *spec_info, 31 uint32_t *out_num_spec_entries); 32 #endif 33