41ed07d55ee5297bb4ee025a1df678275a02681a
Allows basic usage of templated functions. There is no support for templated struct. Benefit: - More readable than macros in shader sources. - Compatible with C++ tools. - More sharing possible with host C++ code. Requirements/Limitations: - No default arguments to template parameters. - Must use explicit instantiation for all variant needed. - Explicit instantiation needs to **not** use argument deduction. - Calls to template needs to have all template argument explicit or all implicit. - Template overload is not supported (redefining the same template with different template argument or function argument types). Currently implemented as Macros inside the build-time pre-pocessor, but that could change to copy-paste to allow better error reporting. However, the Macros keep the shader code reduced in the final binary and allow different file to declare different instantiation. The implementation is done by declaring overloads for each explicit instantiation. If a template has arguments not present in function arguments, then all arguments **values** are appended to the function name. The explicit template callsite is then modified to use `TEMPLATE_GLUE` which will call the correct function. This is why template argument deduction is not supported in this case. Rel #137446 Pull Request: https://projects.blender.org/blender/blender/pulls/137441
…
Blender
Blender is the free and open source 3D creation suite. It supports the entirety of the 3D pipeline—modeling, rigging, animation, simulation, rendering, compositing, motion tracking and video editing.
Project Pages
Development
License
Blender as a whole is licensed under the GNU General Public License, Version 3. Individual files may have a different but compatible license.
See blender.org/about/license for details.
Description
Languages
C++
78%
Python
14.9%
C
2.9%
GLSL
1.9%
CMake
1.2%
Other
0.9%
