X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Fshader-generator%2Fshader-generator.cpp;h=16cddcc9de2bcf346462ff17c844d64b8cf16a2e;hp=a88333c40a110b30fbfc5cceecc4424e94114c58;hb=7fedb219df999ade85e132809f21e06c9aefd4e4;hpb=e8edbcff4d8a64f6675ee2dbeeef626ab48e36e0 diff --git a/dali-toolkit/shader-generator/shader-generator.cpp b/dali-toolkit/shader-generator/shader-generator.cpp index a88333c..16cddcc 100644 --- a/dali-toolkit/shader-generator/shader-generator.cpp +++ b/dali-toolkit/shader-generator/shader-generator.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. + * Copyright (c) 2022 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -144,10 +144,21 @@ void GenerateHeaderFile( << endl; outFile << "const std::string_view " << shaderVariableName << endl; outFile << "{" << endl; - outFile << "R\"(" << endl; + + // Using Raw String Literal to generate shader files as this will simplify the file layout. + // And it will fix some compilation warnings about missing terminating strings. + // Note : we should skip empty headline to guarantee that "#version ~~~" as top of shader code. + outFile << "R\"("; string line; + bool firstLinePrinted = false; while(getline(shaderFile, line)) { + if(!firstLinePrinted && line.find_first_not_of(" \t\r\n") == std::string::npos) + { + // Empty string occured! + continue; + } + firstLinePrinted = true; outFile << line << endl; } outFile << ")\"" << endl;