Hey! 2020.1.0a9 is out and with it the support for multi_compile directive in compute shaders has arrived. Creating compute shader variants has until now been tedious work of hand crafting different kernels for different variations (by combining #pragma kernel and preprocessor defines) and then manually mapping the correct kernels to correct variants at runtime. This new feature brings the keyword based variant management, used in regular shaders, to the compute shaders too. New shader syntax Compute shader code now has support for multi_compile pragmas similar to regular shaders. The pragma affects all the kernels in a .compute file. #pragma multi_compile __ KEYWORD_A KEYWORD_B #pragma multi_compile_local __ KEYWORD_X KEYWORD_Z New & affected API The current global keyword API now affects compute shaders too: Shader.EnableKeyword/DisableKeyword CommandBuffer.EnableKeyword/DisableKeyword Added new keyword API to ComputeShader class, matching what we have in Material: ComputeShader.EnableKeyword/DisableKeyword ComputeShader.IsKeywordEnabled ComputeShader.shaderKeywords Notes No “select best matching variant” logic is built in this system. This means that the user is responsible for selecting a valid keyword combination. We do mask in only the keywords that are actually declared in the shader, but for keywords that don’t have the empty “__” option, it is user’s responsibility to pick a valid option. Otherwise the dispatch fails with error. Atm all the variants are compiled at import time. So be careful with adding too many variants. On-demand/background compilation and scriptable stripping support for compute shaders are planned items but not there yet. This is the very first release of the feature so some hiccups are definitely possible. Any early bird usage providing feedback and/or bug reports would be very much appreciated. Thanks!