projects
/
platform
/
core
/
uifw
/
dali-toolkit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[Shader Generator] Remove empty first line
[platform/core/uifw/dali-toolkit.git]
/
dali-toolkit
/
shader-generator
/
shader-generator.cpp
diff --git
a/dali-toolkit/shader-generator/shader-generator.cpp
b/dali-toolkit/shader-generator/shader-generator.cpp
index
d386fb3
..
16cddcc
100644
(file)
--- a/
dali-toolkit/shader-generator/shader-generator.cpp
+++ b/
dali-toolkit/shader-generator/shader-generator.cpp
@@
-1,5
+1,5
@@
/*
/*
- * Copyright (c) 202
1
Samsung Electronics Co., Ltd.
+ * Copyright (c) 202
2
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.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@
-144,11
+144,24
@@
void GenerateHeaderFile(
<< endl;
outFile << "const std::string_view " << shaderVariableName << endl;
outFile << "{" << endl;
<< endl;
outFile << "const std::string_view " << shaderVariableName << endl;
outFile << "{" << 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;
string line;
+ bool firstLinePrinted = false;
while(getline(shaderFile, line))
{
while(getline(shaderFile, line))
{
- outFile << "\"" << line << "\\n\"" << endl;
+ if(!firstLinePrinted && line.find_first_not_of(" \t\r\n") == std::string::npos)
+ {
+ // Empty string occured!
+ continue;
+ }
+ firstLinePrinted = true;
+ outFile << line << endl;
}
}
+ outFile << ")\"" << endl;
outFile << "};" << endl;
cout << " [OK]" << endl;
}
outFile << "};" << endl;
cout << " [OK]" << endl;
}