-
Notifications
You must be signed in to change notification settings - Fork 420
Windows: size mismatch between file output and console output #457
Description
When using the option "-o -" to output the compilation result to std out, the console output is a few bytes larger than the file output. I noticed because Vulkan doesn't like SPIR-V code that is not a multiple of 4.
System specs:
- Windows 10 64 bit
- Shell: cmd.exe
- shaderc v2018.0-dev beginning-464-g5fd1b25
- spirv-tools v2018.3-dev v2018.2-83-ge7c2e91
- glslang 6.2.2596-110-g3bb4c48c
This happens with every shader I've tried. In the attached zip file, you can find a shader.vert file and two SPIR-V files. The output file ok.spv was generated with glslc -o ok.spv shader.vert and is 996 bytes. The file broken.spv was generated with glslc -o - shader.vert > broken.spv and is 1001 bytes.
After some investigation, it seems that something between compilation and writing it out to console replaces all "LF" characters (0x0A) with the Windows newline "CRLF" (0x0D, 0x0A). Removing the CR characters makes the shader work again.