shader-slang / slang

Making it easier to work with shaders
MIT License
1.82k stars 165 forks source link

Slang fails to parse file with BOM #4046

Closed pema99 closed 2 months ago

pema99 commented 3 months ago

When compiling a file that has a byte order mark, Slang chokes. Happens both with slangc and the native API (for example when #include'ing a file with a BOM).

I've attached a simple file with a BOM (.txt because github won't let me upload a .hlsl tile) repro.txt

Observe:

>file repro.txt
repro.txt: C source, Unicode text, UTF-8 (with BOM) text, with CRLF line terminators

>slangc -lang hlsl repro.txt
repro.txt(1): error 10000: illegal character (0xEF)
void main()
^
repro.txt(1): error 10000: illegal character (0xBB)
void main()
 ^
repro.txt(1): error 10000: illegal character (0xBF)
void main()
  ^
cheneym2 commented 2 months ago

I've reproduced the issue and am working on a fix.