SaschaWillems / SPIRV-VSExtension

SPIR-V extension for Visual Studio

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can you add away to remove the BOM

blair0011 opened this issue · comments

commented

I am using your extension to compile compute shaders easily, but it seems that Visual Studio saves all new files in UTF-8 with BOM. This encoding causes glslangValidator to throw a very interesting set of errors:

ERROR: #version: compute shaders require es profile with version 310 or above, or non-es profile with version 420 or above
ERROR: #version: statement must appear first in es-profile shader; before comments or newlines
ERROR: .\dot.comp:1: 'Ç' : unexpected token
ERROR: .\dot.comp:1: '' : compilation terminated

Can you add a check for the BOM and rewrite the file without it?

Thanks,

Blair

but it seems that Visual Studio saves all new files in UTF-8 with BOM.

That's odd. I'm writing my shaders in VS too (2015 and 2017) and I don't get an added BOM and everything works fine. Are you sure this isn't some setting in VS or caused by some unicode characters in your shader sources?

I don't like the idea automatically rewriting the file and removing the BOM just to get it to compile, esp. as this is not a problem with the extension but rather with the official glslang compiler.

There also seems to be a PR related to this at the official Khronos: KhronosGroup/glslang#425

commented

Hmm, Ok I would prefer to have the glslang app be able to handle it, just I didn't know where to submit the problem. Also I looked to see if I could change the default file encoding in VS, but that doesn't seem to be an option in VS and a lot of other people have the problem too. I only suggested that you add it because the resulting error doesn't make any sense and took me 2 hours to figure out what was wrong.