DirectXShaderCompiler icon indicating copy to clipboard operation
DirectXShaderCompiler copied to clipboard

force include file

Open turanszkij opened this issue 7 years ago • 2 comments

Hello,

I haven't found a way to force an include file to be included when compiling with dxc. Is there a way to do that? I expected that there would be an -include <filename> flag when invoking dxc. If there is no way, I suppose this would be a feature request. Apologies if I missed something.

Thanks, Janos

turanszkij avatar Oct 24 '18 17:10 turanszkij

Could you include the file with #include in the main source file?

hekota avatar Oct 25 '18 17:10 hekota

Hi, I can do that manually, of course. But it would be neat if I could also have this compiler flag and not manually include the source file myself.

For example, I have a project that has shaders written in an other language, and I want to compile all of them while also inserting a common header that redefines certain keywords to their HLSL equivalent.

The project has a lot of shaders without any includes at all, so I can't just insert this conversion header to a central header. It is also not a requirement to have a central header included in all shaders, to keep the shader authoring workflow as-is and simplistic.

turanszkij avatar Oct 26 '18 09:10 turanszkij

Hello,

I'm bringing up this issue again because I'm interested in this addition for the same reasons as Janos:

  • Shaders written by a third-party entity
  • There is no include-by-all header to inject my stuff

Thanks, Raffaele

rbratta avatar Jul 18 '25 15:07 rbratta