Skip to content

Cross compile with C++ include path failed: can not find #include <float.h> #22

Description

@HuazyYang

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 -

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions