diff --git a/tools/shaderc/shaderc.cpp b/tools/shaderc/shaderc.cpp index a5b14edcf..b07556915 100644 --- a/tools/shaderc/shaderc.cpp +++ b/tools/shaderc/shaderc.cpp @@ -1058,6 +1058,20 @@ namespace bgfx memset(&data[size+1], 0, padding); fclose(file); + if (!raw) + { + // To avoid commented code being recognized as used feature, + // first preprocess pass is used to strip all comments before + // substituting code. + preprocessor.run(data); + delete [] data; + + size = (uint32_t)preprocessor.m_preprocessed.size(); + data = new char[size+padding+1]; + memcpy(data, preprocessor.m_preprocessed.c_str(), size); + memset(&data[size], 0, padding+1); + } + strNormalizeEol(data); input = const_cast(bx::strws(data) ); @@ -1090,21 +1104,6 @@ namespace bgfx input = const_cast(bx::strws(input) ); } - - if (!raw) - { - // To avoid commented code being recognized as used feature, - // first preprocess pass is used to strip all comments before - // substituting code. - preprocessor.run(input); - delete [] data; - - size = (uint32_t)preprocessor.m_preprocessed.size(); - data = new char[size+padding+1]; - memcpy(data, preprocessor.m_preprocessed.c_str(), size); - memset(&data[size], 0, padding+1); - input = data; - } } if (raw)