NVIDIA-RTX / NVIDIA-RTX/ShaderMake

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

Open
#22 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
118
Forks
38
PR merge metrics
No merged PRs in 30d

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 -

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing ShaderMake's recursive regex-based #include parsing and compare its dependency results with the DXC include stack shown in the issue. Use the provided dxc command and a shared C++/shader include containing conditional preprocessor branches to reproduce the missing <float.h> failure. Done means cross-compilation resolves the correct conditional include dependencies.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
tooling
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.