Skip to content

bug: glslc -E does not escape newlines in string literals #1509

@Mozartenhimer

Description

@Mozartenhimer

Pretty straight forward to explain. preprocessing with glslc -E does not escape newlines in string literals when re-printing the string literal. This results in string literals breaking the source if they're used.

Minimal reproducible example:

~> cat shader.glsl                                                                                                                                                       
#version 450
#extension GL_EXT_debug_printf : enable

int main(){
        debugPrintf("with Newline\n");
}

~> glslc -E shader.glsl                                                                                          
#version 450
#extension GL_EXT_debug_printf : enable

int main() {
 debugPrintf("with Newline
");
}

                                                                                                              

~> glslc --version                                                                                               
shaderc v2023.8 v2025.3
spirv-tools v2025.3 v2022.4-833-g33e02568
glslang 11.1.0-1253-gefd24d75

Target: SPIR-V 1.0

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