Update information about ShaderDef's to indicate how to use non-boolean types in code
How can Bevy's documentation be improved?
Neither the documentation for ShaderDefVal nor for the shader_defs field on the Shader (or ComputeShaderPipelines) have any information about how the defined values get passed to your shader.
Users coming from a C background might assume that the behavior is like passing -DFLAG=1 and would use it as a bare identifier:
for(int i = 0 i < FLAG; ++i) {...}
But this results in naga compilation errors about unknown identifiers.
It actually appears that to use a value it must be with in a "preprocessor context" like a #define.
This is demonstrated fairly well in the shader_defs example, but this still doesn't help users know how to use a numerical value in their code.
I ended up finding the correct invocation by finding an old issue.
I think that the documentation for ShaderDefVal should be updated with examples of how the values defined can be used in a shader. This should include information about some of the strange behavior like how the inserted value will not have a type suffix, so to make many equations work you need to suffix with u or i (sometimes it is helpful though to be able to use f).
It would also be useful for the shader_defs example to be updated to use a numerical ShaderDefVal to demonstrate their use.