Use C++11 raw string literals instead of SHADER_SOURCE macro
This is better in many ways:
1. It doesn't confuse clang format
2. \n doesn't need to be included after preprocessor directives like
the version directive.
3. It's using built-in functionality instead of something custom.
Raw string literals should be the preferred way to include shader
source in C++ files going forward.
BUG=angleproject:2157
TEST=angle_end2end_tests
Change-Id: I8b236a6e2d5c25d920297e5bc5b5b143eddeba1f
Reviewed-on: https://chromium-review.googlesource.com/671046
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
diff --git a/src/tests/gl_tests/ProgramBinaryTest.cpp b/src/tests/gl_tests/ProgramBinaryTest.cpp
index 6ee5eb3..7513224 100644
--- a/src/tests/gl_tests/ProgramBinaryTest.cpp
+++ b/src/tests/gl_tests/ProgramBinaryTest.cpp
@@ -34,22 +34,18 @@
{
ANGLETest::SetUp();
- const std::string vertexShaderSource = SHADER_SOURCE
- (
- attribute vec4 inputAttribute;
+ const std::string vertexShaderSource =
+ R"(attribute vec4 inputAttribute;
void main()
{
gl_Position = inputAttribute;
- }
- );
+ })";
- const std::string fragmentShaderSource = SHADER_SOURCE
- (
- void main()
+ const std::string fragmentShaderSource =
+ R"(void main()
{
gl_FragColor = vec4(1,0,0,1);
- }
- );
+ })";
mProgram = CompileProgram(vertexShaderSource, fragmentShaderSource);
if (mProgram == 0)
@@ -452,25 +448,23 @@
{
ANGLETest::SetUp();
- const std::string vertexShaderSource = SHADER_SOURCE
- ( #version 300 es\n
+ const std::string vertexShaderSource =
+ R"(#version 300 es
in vec4 inputAttribute;
out vec4 outputVarying;
void main()
{
outputVarying = inputAttribute;
- }
- );
+ })";
- const std::string fragmentShaderSource = SHADER_SOURCE
- ( #version 300 es\n
+ const std::string fragmentShaderSource =
+ R"(#version 300 es
precision highp float;
out vec4 outputColor;
void main()
{
outputColor = vec4(1,0,0,1);
- }
- );
+ })";
std::vector<std::string> transformFeedbackVaryings;
transformFeedbackVaryings.push_back("outputVarying");
@@ -633,50 +627,44 @@
GLuint createES2ProgramFromSource()
{
- const std::string testVertexShaderSource = SHADER_SOURCE
- (
- attribute highp vec4 position;
+ const std::string testVertexShaderSource =
+ R"(attribute highp vec4 position;
void main(void)
{
gl_Position = position;
- }
- );
+ })";
- const std::string testFragmentShaderSource = SHADER_SOURCE
- (
- void main(void)
+ const std::string testFragmentShaderSource =
+ R"(void main(void)
{
gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
- }
- );
+ })";
return CompileProgram(testVertexShaderSource, testFragmentShaderSource);
}
GLuint createES3ProgramFromSource()
{
- const std::string testVertexShaderSource = SHADER_SOURCE
- ( #version 300 es\n
+ const std::string testVertexShaderSource =
+ R"(#version 300 es
precision highp float;
in highp vec4 position;
void main(void)
{
gl_Position = position;
- }
- );
+ })";
- const std::string testFragmentShaderSource = SHADER_SOURCE
- ( #version 300 es \n
+ const std::string testFragmentShaderSource =
+ R"(#version 300 es
precision highp float;
out vec4 out_FragColor;
void main(void)
{
out_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
- }
- );
+ })";
return CompileProgram(testVertexShaderSource, testFragmentShaderSource);
}