Hello ;)
Chris
Hello ;)
Chris
The #include command should let you move common code into shared header files, like we do in C/C++.
Hodgman's answer is definitely what you are after.
Another option, that although is not what you after is interesting non-the-less, is that DirectX 11.2 supports HLSL shader linking. Adding support for precompiled HLSL functions that can be packaged into libraries and linked into shaders at runtime. This would allow you to build up your shader libraries to support more variations without the cost of runtime HLSL compiler times.
Another option, that although is not what you after is interesting non-the-less, is that DirectX 11.2 supports HLSL shader linking. Adding support for precompiled HLSL functions that can be packaged into libraries and linked into shaders at runtime. This would allow you to build up your shader libraries to support more variations without the cost of runtime HLSL compiler times.
Unfortunately this is still not a pure HLSL approach but requires mainly C++ (or whatever language is used) host application side code to address the respective API function. It's a shame that we cannot simply reference and use a pre-compiled shader (e.g. assembly source) file the way we do it with HLSL source files using the #include command.