autodesk-forks / MaterialX

MaterialX C++ and Python libraries
http://www.materialx.org/
Apache License 2.0
107 stars 23 forks source link

ShaderGen should allow uniform declarations with initialization #1239

Open bernardkwok opened 3 years ago

bernardkwok commented 3 years ago

This is a request based on the fact that a shading language may not allow for initialization of a uniform as part of the declaration. It is also useful for code reuse if the shader code itself is used to determine uniqueness for reuse (say to to avoid shader recompilation)

The proposal is to add in a generation option settable can be set before generation is requested. It would apply to all generators, including OSL and MDL. Here it would be a main function argument initialization option.