diff --git a/MobileGL/MG_Util/ShaderTranspiler/ShaderSourceProcessor.cpp b/MobileGL/MG_Util/ShaderTranspiler/ShaderSourceProcessor.cpp index 5a83a113..682ad838 100644 --- a/MobileGL/MG_Util/ShaderTranspiler/ShaderSourceProcessor.cpp +++ b/MobileGL/MG_Util/ShaderTranspiler/ShaderSourceProcessor.cpp @@ -4,14 +4,6 @@ namespace MobileGL { namespace MG_Util { namespace ShaderTranspiler { void PreprocessShaderSource(ShaderStage stage, String& source) { - // remove #line directives - SizeT linedirPos = source.find("#line"); - while (linedirPos != std::string::npos) { - SizeT newlinePos = source.find('\n', linedirPos); - source = source.replace(linedirPos, newlinePos - linedirPos, ""); - linedirPos = source.find("#line", linedirPos); - } - // remove multi-line comment size_t commentStartPos = source.find("/*"); while (commentStartPos != std::string::npos) { @@ -21,6 +13,15 @@ namespace MobileGL { commentStartPos = source.find("/*", commentStartPos); } + // remove #line directives + SizeT linedirPos = source.find("#line"); + while (linedirPos != std::string::npos) { + SizeT newlinePos = source.find('\n', linedirPos); + // + length of "\n" + source = source.replace(linedirPos, newlinePos - linedirPos + 1, ""); + linedirPos = source.find("#line", linedirPos); + } + // force #version ShaderProfile profile = ShaderProfile::Core; SizeT versionPos = source.find("#version");