Closed
Description
Current ShaderMake just crudely use regex to parse syntax #include directive in shader source files recursively, which does not take any condition branch precessors such as #if #ifdef into considerations. Using this aproach will lead to wrong source file include dependencies when cross complile a common include file used by C++ source and shader source.
DXC and FXC can indeed dump source file include files correctly. The following include stack is a typical output from DXC:
; Opening file [./Descriptors.hlsli], stack top [0]
; Opening file [./../Types.h], stack top [1]
; Opening file [./../../thirdparty/donut/include\donut/shaders/view_cb.h], stack top [2]
; Opening file [./../../thirdparty/donut/include\donut/shaders/light_cb.h], stack top [3]
; Opening file [./../../thirdparty/donut/include\donut/shaders/light_types.h], stack top [4]
; Opening file [./../ddgi/DDGITypes.h], stack top [5]
; Opening file [./Platform.hlsli], stack top [6]
; Opening file [./../../thirdparty/donut/include\donut/shaders/binding_helpers.hlsli], stack top [7]
; Opening file [./../../thirdparty/donut/include\donut/shaders/material_cb.h], stack top [8]
; Opening file [./../../thirdparty/donut/include\donut/shaders/bindless.h], stack top [9]
; Opening file [./Lighting.hlsli], stack top [10]
; Opening file [./Common.hlsli], stack top [11]
; Opening file [./Random.hlsli], stack top [12]
; Opening file [./RayTracing.hlsli], stack top [13]
; Opening file [./../../thirdparty/donut/include\donut/shaders/packing.hlsli], stack top [14]
;
Command line usage is:
dxc -H -T lib_6_5 .\PathTraceRGS.hlsl -I../../thirdparty/donut/include -DHLSL -Fo -
Reacted by dzhdanNV
Metadata
Metadata
Assignees
Labels
No labels
Activity
apanteleev commentedon Jan 15, 2026
This is a known issue, and the workaround is to use the
--relaxedInclude <name>option of ShaderMake. In the example you give in the issue title, the option would be--relaxedInclude float.h.Ideally, we should use the depfiles that DXC can generate with
-MDor-MF <name>and Slang can generate with-depfile <name>. Unfortunately, FXC cannot generate them...Use compiler-reported dependencies for shader rebuilds (implemented #22)
dzhdanNV commentedon Nov 23, 2026
Apologies for the long wait. Thanks for the idea. It's been implemented.