glslvulkanspir-v

is there some method to solve macros in glsl for vulkan


Many GLSL programs use macros

#ifdef
#else
#endif

to solve different configurations, is there some elegant method to solve this issue when vulkan build pipeline layout and descriptor set?


Solution

  • Using normal if()\else() blocks and Vulkan specialization constants should solve this one for most cases. I'd expect any sensible compiler to optimize out an entire if() basic block if the specialization constant is zero at compile time.