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/egl_tests/EGLPresentPathD3D11Test.cpp b/src/tests/egl_tests/EGLPresentPathD3D11Test.cpp
index 1b8383b..35401b7 100644
--- a/src/tests/egl_tests/EGLPresentPathD3D11Test.cpp
+++ b/src/tests/egl_tests/EGLPresentPathD3D11Test.cpp
@@ -183,21 +183,25 @@
GLint mTexture2DUniformLocation;
const std::string vertexShaderSource =
- SHADER_SOURCE(precision highp float; attribute vec4 position; varying vec2 texcoord;
+ R"(precision highp float;
+ attribute vec4 position;
+ varying vec2 texcoord;
- void main()
- {
- gl_Position = vec4(position.xy, 0.0, 1.0);
- texcoord = (position.xy * 0.5) + 0.5;
- });
+ void main()
+ {
+ gl_Position = vec4(position.xy, 0.0, 1.0);
+ texcoord = (position.xy * 0.5) + 0.5;
+ })";
const std::string fragmentShaderSource2D =
- SHADER_SOURCE(precision highp float; uniform sampler2D tex; varying vec2 texcoord;
+ R"(precision highp float;
+ uniform sampler2D tex;
+ varying vec2 texcoord;
- void main()
- {
- gl_FragColor = texture2D(tex, texcoord);
- });
+ void main()
+ {
+ gl_FragColor = texture2D(tex, texcoord);
+ })";
m2DProgram = CompileProgram(vertexShaderSource, fragmentShaderSource2D);
mTexture2DUniformLocation = glGetUniformLocation(m2DProgram, "tex");
diff --git a/src/tests/egl_tests/EGLSurfaceTest.cpp b/src/tests/egl_tests/EGLSurfaceTest.cpp
index a798a5e..fc2c32a 100644
--- a/src/tests/egl_tests/EGLSurfaceTest.cpp
+++ b/src/tests/egl_tests/EGLSurfaceTest.cpp
@@ -167,23 +167,19 @@
GLuint createProgram()
{
- 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);
}
diff --git a/src/tests/gl_tests/BindUniformLocationTest.cpp b/src/tests/gl_tests/BindUniformLocationTest.cpp
index 75bd886..4acdcc3 100644
--- a/src/tests/gl_tests/BindUniformLocationTest.cpp
+++ b/src/tests/gl_tests/BindUniformLocationTest.cpp
@@ -64,28 +64,22 @@
ASSERT_NE(mBindUniformLocation, nullptr);
- // clang-format off
- const std::string vsSource = SHADER_SOURCE
- (
- attribute vec4 a_position;
+ const std::string vsSource =
+ R"(attribute vec4 a_position;
void main()
{
gl_Position = a_position;
- }
- );
+ })";
- const std::string fsSource = SHADER_SOURCE
- (
- precision mediump float;
+ const std::string fsSource =
+ R"(precision mediump float;
uniform vec4 u_colorC;
uniform vec4 u_colorB[2];
uniform vec4 u_colorA;
void main()
{
gl_FragColor = u_colorA + u_colorB[0] + u_colorB[1] + u_colorC;
- }
- );
- // clang-format on
+ })";
GLint colorALocation = 3;
GLint colorBLocation = 10;
@@ -141,27 +135,21 @@
ASSERT_NE(nullptr, mBindUniformLocation);
- // clang-format off
- const std::string vsSource = SHADER_SOURCE
- (
- attribute vec4 a_position;
+ const std::string vsSource =
+ R"(attribute vec4 a_position;
void main()
{
gl_Position = a_position;
- }
- );
+ })";
- const std::string fsSource = SHADER_SOURCE
- (
- precision mediump float;
+ const std::string fsSource =
+ R"(precision mediump float;
uniform vec4 u_colorA;
uniform vec4 u_colorB;
void main()
{
gl_FragColor = u_colorA + u_colorB;
- }
- );
- // clang-format on
+ })";
GLint colorALocation = 3;
GLint colorBLocation = 4;
@@ -203,10 +191,8 @@
ASSERT_NE(nullptr, mBindUniformLocation);
- // clang-format off
- const std::string vsSource = SHADER_SOURCE
- (
- attribute vec4 a_position;
+ const std::string vsSource =
+ R"(attribute vec4 a_position;
attribute vec2 a_texCoord;
uniform mat4 matrix;
uniform vec2 color_a[4];
@@ -218,12 +204,10 @@
v_color.zw = color_a[2] + color_a[3];
v_color += color_b;
gl_Position = matrix * a_position;
- }
- );
+ })";
- const std::string fsSource = SHADER_SOURCE
- (
- precision mediump float;
+ const std::string fsSource =
+ R"(precision mediump float;
varying vec4 v_color;
uniform float alpha;
uniform vec4 multiplier;
@@ -242,9 +226,7 @@
color_c_sum.w = alpha;
color_c_sum *= multiplier;
gl_FragColor = v_color + color_c_sum;
- }
- );
- // clang-format on
+ })";
int counter = 6;
int matrixLocation = counter++;
@@ -319,28 +301,22 @@
ASSERT_NE(nullptr, mBindUniformLocation);
- // clang-format off
- const std::string vsSource = SHADER_SOURCE
- (
- attribute vec4 a_position;
+ const std::string vsSource =
+ R"(attribute vec4 a_position;
void main()
{
gl_Position = a_position;
- }
- );
+ })";
- const std::string fsSource = SHADER_SOURCE
- (
- precision mediump float;
+ const std::string fsSource =
+ R"(precision mediump float;
uniform vec4 u_colorA;
uniform float u_colorU;
uniform vec4 u_colorC;
void main()
{
gl_FragColor = u_colorA + u_colorC;
- }
- );
- // clang-format on
+ })";
const GLint colorULocation = 1;
const GLint nonexistingLocation = 5;
@@ -430,24 +406,18 @@
ASSERT_NE(nullptr, mBindUniformLocation);
- // clang-format off
- const std::string vsSource = SHADER_SOURCE
- (
- void main()
+ const std::string vsSource =
+ R"(void main()
{
gl_Position = vec4(0);
- }
- );
+ })";
- const std::string fsSource = SHADER_SOURCE
- (
- uniform sampler2D tex;
+ const std::string fsSource =
+ R"(uniform sampler2D tex;
void main()
{
gl_FragColor = texture2D(tex, vec2(1));
- }
- );
- // clang-format on
+ })";
const GLuint texLocation = 54;
@@ -485,26 +455,20 @@
ASSERT_NE(nullptr, mBindUniformLocation);
- // clang-format off
- const std::string vsSource = SHADER_SOURCE
- (
- void main()
+ const std::string vsSource =
+ R"(void main()
{
gl_Position = vec4(0);
- }
- );
+ })";
- const std::string fsSource = SHADER_SOURCE
- (
- precision mediump float;
+ const std::string fsSource =
+ R"(precision mediump float;
uniform vec4 a;
uniform vec4 b;
void main()
{
gl_FragColor = a;
- }
- );
- // clang-format on
+ })";
const GLuint location = 54;
diff --git a/src/tests/gl_tests/BlendMinMaxTest.cpp b/src/tests/gl_tests/BlendMinMaxTest.cpp
index 39f5251..a5c892a 100644
--- a/src/tests/gl_tests/BlendMinMaxTest.cpp
+++ b/src/tests/gl_tests/BlendMinMaxTest.cpp
@@ -123,24 +123,19 @@
{
ANGLETest::SetUp();
- const std::string testVertexShaderSource = SHADER_SOURCE
- (
- attribute highp vec4 aPosition;
-
+ const std::string testVertexShaderSource =
+ R"(attribute highp vec4 aPosition;
void main(void)
{
gl_Position = aPosition;
- }
- );
+ })";
- const std::string testFragmentShaderSource = SHADER_SOURCE
- (
- uniform highp vec4 color;
+ const std::string testFragmentShaderSource =
+ R"(uniform highp vec4 color;
void main(void)
{
gl_FragColor = color;
- }
- );
+ })";
mProgram = CompileProgram(testVertexShaderSource, testFragmentShaderSource);
if (mProgram == 0)
diff --git a/src/tests/gl_tests/BlitFramebufferANGLETest.cpp b/src/tests/gl_tests/BlitFramebufferANGLETest.cpp
index fd8f4fb..6558a3c 100644
--- a/src/tests/gl_tests/BlitFramebufferANGLETest.cpp
+++ b/src/tests/gl_tests/BlitFramebufferANGLETest.cpp
@@ -65,9 +65,8 @@
{
ANGLETest::SetUp();
- const std::string passthroughVS = SHADER_SOURCE
- (
- precision highp float;
+ const std::string passthroughVS =
+ R"(precision highp float;
attribute vec4 position;
varying vec4 pos;
@@ -75,12 +74,10 @@
{
gl_Position = position;
pos = position;
- }
- );
+ })";
- const std::string checkeredFS = SHADER_SOURCE
- (
- precision highp float;
+ const std::string checkeredFS =
+ R"(precision highp float;
varying vec4 pos;
void main()
@@ -93,19 +90,16 @@
{
gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);
}
- }
- );
+ })";
- const std::string blueFS = SHADER_SOURCE
- (
- precision highp float;
+ const std::string blueFS =
+ R"(precision highp float;
varying vec4 pos;
void main()
{
gl_FragColor = vec4(0.0, 0.0, 1.0, 1.0);
- }
- );
+ })";
mCheckerProgram = CompileProgram(passthroughVS, checkeredFS);
mBlueProgram = CompileProgram(passthroughVS, blueFS);
diff --git a/src/tests/gl_tests/BufferDataTest.cpp b/src/tests/gl_tests/BufferDataTest.cpp
index e63b5b2..456b1fc 100644
--- a/src/tests/gl_tests/BufferDataTest.cpp
+++ b/src/tests/gl_tests/BufferDataTest.cpp
@@ -35,27 +35,23 @@
{
ANGLETest::SetUp();
- const char * vsSource = SHADER_SOURCE
- (
- attribute vec4 position;
+ const char *vsSource =
+ R"(attribute vec4 position;
attribute float in_attrib;
varying float v_attrib;
void main()
{
v_attrib = in_attrib;
gl_Position = position;
- }
- );
+ })";
- const char * fsSource = SHADER_SOURCE
- (
- precision mediump float;
+ const char *fsSource =
+ R"(precision mediump float;
varying float v_attrib;
void main()
{
gl_FragColor = vec4(v_attrib, 0, 0, 1);
- }
- );
+ })";
glGenBuffers(1, &mBuffer);
ASSERT_NE(mBuffer, 0U);
@@ -253,27 +249,23 @@
{
ANGLETest::SetUp();
- const char * vsSource = SHADER_SOURCE
- (
- attribute vec3 in_attrib;
+ const char *vsSource =
+ R"(attribute vec3 in_attrib;
varying vec3 v_attrib;
void main()
{
v_attrib = in_attrib;
gl_Position = vec4(0.0, 0.0, 0.5, 1.0);
gl_PointSize = 100.0;
- }
- );
+ })";
- const char * fsSource = SHADER_SOURCE
- (
- precision mediump float;
+ const char *fsSource =
+ R"(precision mediump float;
varying vec3 v_attrib;
void main()
{
gl_FragColor = vec4(v_attrib, 1);
- }
- );
+ })";
glGenBuffers(2, mBuffers);
ASSERT_NE(mBuffers[0], 0U);
diff --git a/src/tests/gl_tests/ClearTest.cpp b/src/tests/gl_tests/ClearTest.cpp
index 1ad240c..13989c3 100644
--- a/src/tests/gl_tests/ClearTest.cpp
+++ b/src/tests/gl_tests/ClearTest.cpp
@@ -75,26 +75,22 @@
void setupDefaultProgram()
{
- const std::string vertexShaderSource = SHADER_SOURCE
- (
- precision highp float;
+ const std::string vertexShaderSource =
+ R"(precision highp float;
attribute vec4 position;
void main()
{
gl_Position = position;
- }
- );
+ })";
- const std::string fragmentShaderSource = SHADER_SOURCE
- (
- precision highp float;
+ const std::string fragmentShaderSource =
+ R"(precision highp float;
void main()
{
gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
- }
- );
+ })";
mProgram = CompileProgram(vertexShaderSource, fragmentShaderSource);
ASSERT_NE(0u, mProgram);
diff --git a/src/tests/gl_tests/CubeMapTextureTest.cpp b/src/tests/gl_tests/CubeMapTextureTest.cpp
index 68a91da..95078de 100644
--- a/src/tests/gl_tests/CubeMapTextureTest.cpp
+++ b/src/tests/gl_tests/CubeMapTextureTest.cpp
@@ -25,23 +25,19 @@
{
ANGLETest::SetUp();
- const std::string vsSource = SHADER_SOURCE
- (
- attribute highp vec4 position;
+ const std::string vsSource =
+ R"(attribute highp vec4 position;
void main(void)
{
gl_Position = position;
- }
- );
+ })";
- const std::string fsSource = SHADER_SOURCE
- (
- uniform highp vec4 color;
+ const std::string fsSource =
+ R"(uniform highp vec4 color;
void main(void)
{
gl_FragColor = color;
- }
- );
+ })";
mProgram = CompileProgram(vsSource, fsSource);
if (mProgram == 0)
diff --git a/src/tests/gl_tests/D3DImageFormatConversionTest.cpp b/src/tests/gl_tests/D3DImageFormatConversionTest.cpp
index d6319d3..0946077 100644
--- a/src/tests/gl_tests/D3DImageFormatConversionTest.cpp
+++ b/src/tests/gl_tests/D3DImageFormatConversionTest.cpp
@@ -32,9 +32,8 @@
{
ANGLETest::SetUp();
- const std::string vertexShaderSource = SHADER_SOURCE
- (
- precision highp float;
+ const std::string vertexShaderSource =
+ R"(precision highp float;
attribute vec4 position;
varying vec2 texcoord;
@@ -42,20 +41,17 @@
{
gl_Position = vec4(position.xy, 0.0, 1.0);
texcoord = (position.xy * 0.5) + 0.5;
- }
- );
+ })";
- const std::string fragmentShaderSource2D = SHADER_SOURCE
- (
- precision highp float;
+ const std::string fragmentShaderSource2D =
+ R"(precision highp float;
uniform sampler2D tex;
varying vec2 texcoord;
void main()
{
gl_FragColor = texture2D(tex, texcoord);
- }
- );
+ })";
m2DProgram = CompileProgram(vertexShaderSource, fragmentShaderSource2D);
mTexture2DUniformLocation = glGetUniformLocation(m2DProgram, "tex");
diff --git a/src/tests/gl_tests/D3DTextureTest.cpp b/src/tests/gl_tests/D3DTextureTest.cpp
index f097024..4d9900e 100644
--- a/src/tests/gl_tests/D3DTextureTest.cpp
+++ b/src/tests/gl_tests/D3DTextureTest.cpp
@@ -36,10 +36,8 @@
{
ANGLETest::SetUp();
- // clang-format off
- const std::string vsSource = SHADER_SOURCE
- (
- precision highp float;
+ const std::string vsSource =
+ R"(precision highp float;
attribute vec4 position;
varying vec2 texcoord;
@@ -48,31 +46,25 @@
gl_Position = position;
texcoord = (position.xy * 0.5) + 0.5;
texcoord.y = 1.0 - texcoord.y;
- }
- );
+ })";
- const std::string textureFSSource = SHADER_SOURCE
- (
- precision highp float;
+ const std::string textureFSSource =
+ R"(precision highp float;
uniform sampler2D tex;
varying vec2 texcoord;
void main()
{
gl_FragColor = texture2D(tex, texcoord);
- }
- );
+ })";
- const std::string textureFSSourceNoSampling = SHADER_SOURCE
- (
- precision highp float;
+ const std::string textureFSSourceNoSampling =
+ R"(precision highp float;
void main()
{
gl_FragColor = vec4(1.0, 0.0, 1.0, 1.0);
- }
- );
- // clang-format on
+ })";
mTextureProgram = CompileProgram(vsSource, textureFSSource);
ASSERT_NE(0u, mTextureProgram) << "shader compilation failed.";
diff --git a/src/tests/gl_tests/DXT1CompressedTextureTest.cpp b/src/tests/gl_tests/DXT1CompressedTextureTest.cpp
index ce53881..dd5baf5 100644
--- a/src/tests/gl_tests/DXT1CompressedTextureTest.cpp
+++ b/src/tests/gl_tests/DXT1CompressedTextureTest.cpp
@@ -28,9 +28,8 @@
{
ANGLETest::SetUp();
- const std::string vsSource = SHADER_SOURCE
- (
- precision highp float;
+ const std::string vsSource =
+ R"(precision highp float;
attribute vec4 position;
varying vec2 texcoord;
@@ -39,20 +38,17 @@
gl_Position = position;
texcoord = (position.xy * 0.5) + 0.5;
texcoord.y = 1.0 - texcoord.y;
- }
- );
+ })";
- const std::string textureFSSource = SHADER_SOURCE
- (
- precision highp float;
+ const std::string textureFSSource =
+ R"(precision highp float;
uniform sampler2D tex;
varying vec2 texcoord;
void main()
{
gl_FragColor = texture2D(tex, texcoord);
- }
- );
+ })";
mTextureProgram = CompileProgram(vsSource, textureFSSource);
if (mTextureProgram == 0)
diff --git a/src/tests/gl_tests/DepthStencilFormatsTest.cpp b/src/tests/gl_tests/DepthStencilFormatsTest.cpp
index 2764f56..fe99445 100644
--- a/src/tests/gl_tests/DepthStencilFormatsTest.cpp
+++ b/src/tests/gl_tests/DepthStencilFormatsTest.cpp
@@ -68,9 +68,8 @@
{
ANGLETest::SetUp();
- const std::string vertexShaderSource = SHADER_SOURCE
- (
- precision highp float;
+ const std::string vertexShaderSource =
+ R"(precision highp float;
attribute vec4 position;
varying vec2 texcoord;
@@ -78,20 +77,17 @@
{
gl_Position = position;
texcoord = (position.xy * 0.5) + 0.5;
- }
- );
+ })";
- const std::string fragmentShaderSource = SHADER_SOURCE
- (
- precision highp float;
+ const std::string fragmentShaderSource =
+ R"(precision highp float;
uniform sampler2D tex;
varying vec2 texcoord;
void main()
{
gl_FragColor = texture2D(tex, texcoord);
- }
- );
+ })";
mProgram = CompileProgram(vertexShaderSource, fragmentShaderSource);
if (mProgram == 0)
diff --git a/src/tests/gl_tests/DifferentStencilMasksTest.cpp b/src/tests/gl_tests/DifferentStencilMasksTest.cpp
index 7e1cd8a..b3b2279 100644
--- a/src/tests/gl_tests/DifferentStencilMasksTest.cpp
+++ b/src/tests/gl_tests/DifferentStencilMasksTest.cpp
@@ -32,26 +32,22 @@
{
ANGLETest::SetUp();
- const std::string vertexShaderSource = SHADER_SOURCE
- (
- precision highp float;
+ const std::string vertexShaderSource =
+ R"(precision highp float;
attribute vec4 position;
void main()
{
gl_Position = position;
- }
- );
+ })";
- const std::string fragmentShaderSource = SHADER_SOURCE
- (
- precision highp float;
+ const std::string fragmentShaderSource =
+ R"(precision highp float;
void main()
{
gl_FragColor = vec4(0.0, 0.0, 1.0, 1.0);
- }
- );
+ })";
mProgram = CompileProgram(vertexShaderSource, fragmentShaderSource);
ASSERT_NE(0u, mProgram);
@@ -118,26 +114,22 @@
{
ANGLETest::SetUp();
- const std::string vertexShaderSource = SHADER_SOURCE
- (
- precision highp float;
+ const std::string vertexShaderSource =
+ R"(precision highp float;
attribute vec4 position;
void main()
{
gl_Position = position;
- }
- );
+ })";
- const std::string fragmentShaderSource = SHADER_SOURCE
- (
- precision highp float;
+ const std::string fragmentShaderSource =
+ R"(precision highp float;
void main()
{
gl_FragColor = vec4(0.0, 0.0, 1.0, 1.0);
- }
- );
+ })";
mProgram = CompileProgram(vertexShaderSource, fragmentShaderSource);
ASSERT_NE(0u, mProgram);
diff --git a/src/tests/gl_tests/FramebufferRenderMipmapTest.cpp b/src/tests/gl_tests/FramebufferRenderMipmapTest.cpp
index 660b6d6..d46c736 100644
--- a/src/tests/gl_tests/FramebufferRenderMipmapTest.cpp
+++ b/src/tests/gl_tests/FramebufferRenderMipmapTest.cpp
@@ -25,23 +25,19 @@
{
ANGLETest::SetUp();
- const std::string vsSource = SHADER_SOURCE
- (
- attribute highp vec4 position;
+ const std::string vsSource =
+ R"(attribute highp vec4 position;
void main(void)
{
gl_Position = position;
- }
- );
+ })";
- const std::string fsSource = SHADER_SOURCE
- (
- uniform highp vec4 color;
+ const std::string fsSource =
+ R"(uniform highp vec4 color;
void main(void)
{
gl_FragColor = color;
- }
- );
+ })";
mProgram = CompileProgram(vsSource, fsSource);
if (mProgram == 0)
diff --git a/src/tests/gl_tests/GLSLTest.cpp b/src/tests/gl_tests/GLSLTest.cpp
index c908652..92bbe3c 100644
--- a/src/tests/gl_tests/GLSLTest.cpp
+++ b/src/tests/gl_tests/GLSLTest.cpp
@@ -30,14 +30,12 @@
{
ANGLETest::SetUp();
- mSimpleVSSource = SHADER_SOURCE
- (
- attribute vec4 inputAttribute;
+ mSimpleVSSource =
+ R"(attribute vec4 inputAttribute;
void main()
{
gl_Position = inputAttribute;
- }
- );
+ })";
}
std::string GenerateVaryingType(GLint vectorSize)
@@ -449,12 +447,12 @@
ANGLETest::SetUp();
mSimpleVSSource =
- "#version 300 es\n"
- "in vec4 inputAttribute;"
- "void main()"
- "{"
- " gl_Position = inputAttribute;"
- "}";
+ R"(#version 300 es
+ in vec4 inputAttribute;
+ void main()
+ {
+ gl_Position = inputAttribute;
+ })";
}
};
@@ -465,21 +463,19 @@
ANGLETest::SetUp();
mSimpleVSSource =
- "#version 310 es\n"
- "in vec4 inputAttribute;"
- "void main()"
- "{"
- " gl_Position = inputAttribute;"
- "}";
+ R"(#version 310 es
+ in vec4 inputAttribute;
+ void main()
+ {
+ gl_Position = inputAttribute;
+ })";
}
};
TEST_P(GLSLTest, NamelessScopedStructs)
{
- const std::string fragmentShaderSource = SHADER_SOURCE
- (
- precision mediump float;
-
+ const std::string fragmentShaderSource =
+ R"(precision mediump float;
void main()
{
struct
@@ -489,8 +485,7 @@
gl_FragColor = vec4(1, 0, 0, 1);
gl_FragColor.a += b.q;
- }
- );
+ })";
GLuint program = CompileProgram(mSimpleVSSource, fragmentShaderSource);
EXPECT_NE(0u, program);
@@ -508,9 +503,8 @@
return;
}
- const std::string fragmentShaderSource = SHADER_SOURCE
- (
- precision mediump float;
+ const std::string fragmentShaderSource =
+ R"(precision mediump float;
struct T
{
@@ -531,8 +525,7 @@
gl_FragColor = vec4(1, 0, 0, 1);
gl_FragColor.a += a.f;
gl_FragColor.a += b.q;
- }
- );
+ })";
GLuint program = CompileProgram(mSimpleVSSource, fragmentShaderSource);
EXPECT_NE(0u, program);
@@ -540,9 +533,8 @@
TEST_P(GLSLTest, ScopedStructsBug)
{
- const std::string fragmentShaderSource = SHADER_SOURCE
- (
- precision mediump float;
+ const std::string fragmentShaderSource =
+ R"(precision mediump float;
struct T_0
{
@@ -563,8 +555,7 @@
gl_FragColor.a += a.f;
gl_FragColor.a += b.v.x;
- }
- );
+ })";
GLuint program = CompileProgram(mSimpleVSSource, fragmentShaderSource);
EXPECT_NE(0u, program);
@@ -572,28 +563,24 @@
TEST_P(GLSLTest, DxPositionBug)
{
- const std::string &vertexShaderSource = SHADER_SOURCE
- (
- attribute vec4 inputAttribute;
+ const std::string &vertexShaderSource =
+ R"(attribute vec4 inputAttribute;
varying float dx_Position;
void main()
{
gl_Position = vec4(inputAttribute);
dx_Position = 0.0;
- }
- );
+ })";
- const std::string &fragmentShaderSource = SHADER_SOURCE
- (
- precision mediump float;
+ const std::string &fragmentShaderSource =
+ R"(precision mediump float;
varying float dx_Position;
void main()
{
gl_FragColor = vec4(dx_Position, 0, 0, 1);
- }
- );
+ })";
GLuint program = CompileProgram(vertexShaderSource, fragmentShaderSource);
EXPECT_NE(0u, program);
@@ -664,20 +651,17 @@
{
EGLPlatformParameters platform = GetParam().eglParameters;
- const std::string vertexShaderSource = SHADER_SOURCE
- (
- attribute vec4 a_position;
+ const std::string vertexShaderSource =
+ R"(attribute vec4 a_position;
varying float v_varying;
void main()
{
v_varying = a_position.x;
gl_Position = a_position;
- }
- );
+ })";
- const std::string fragmentShaderSource = SHADER_SOURCE
- (
- precision mediump float;
+ const std::string fragmentShaderSource =
+ R"(precision mediump float;
varying float v_varying;
void main()
{
@@ -692,8 +676,7 @@
c = vec4(0, v_varying, 0, 1.0);
}
gl_FragColor = c;
- }
- );
+ })";
GLuint program = CompileProgram(vertexShaderSource, fragmentShaderSource);
@@ -1570,9 +1553,8 @@
// Test that structs defined in uniforms are translated correctly.
TEST_P(GLSLTest, StructSpecifiersUniforms)
{
- const std::string fragmentShaderSource = SHADER_SOURCE
- (
- precision mediump float;
+ const std::string fragmentShaderSource =
+ R"(precision mediump float;
uniform struct S { float field;} s;
@@ -1580,8 +1562,7 @@
{
gl_FragColor = vec4(1, 0, 0, 1);
gl_FragColor.a += s.field;
- }
- );
+ })";
GLuint program = CompileProgram(mSimpleVSSource, fragmentShaderSource);
EXPECT_NE(0u, program);
@@ -1593,15 +1574,13 @@
// (note this test is still Impl-independent)
TEST_P(GLSLTestNoValidation, DepthRangeUniforms)
{
- const std::string fragmentShaderSource = SHADER_SOURCE
- (
- precision mediump float;
+ const std::string fragmentShaderSource =
+ R"(precision mediump float;
void main()
{
gl_FragColor = vec4(gl_DepthRange.near, gl_DepthRange.far, gl_DepthRange.diff, 1);
- }
- );
+ })";
ANGLE_GL_PROGRAM(program, mSimpleVSSource, fragmentShaderSource);
@@ -1683,9 +1662,8 @@
// than FL9_3.
TEST_P(GLSLTest, LoopIndexingValidation)
{
- const std::string fragmentShaderSource = SHADER_SOURCE
- (
- precision mediump float;
+ const std::string fragmentShaderSource =
+ R"(precision mediump float;
uniform float loopMax;
@@ -1699,8 +1677,7 @@
gl_FragColor.a += 0.1;
}
}
- }
- );
+ })";
GLuint shader = glCreateShader(GL_FRAGMENT_SHADER);
diff --git a/src/tests/gl_tests/IncompleteTextureTest.cpp b/src/tests/gl_tests/IncompleteTextureTest.cpp
index c835676..c7f7654 100644
--- a/src/tests/gl_tests/IncompleteTextureTest.cpp
+++ b/src/tests/gl_tests/IncompleteTextureTest.cpp
@@ -28,9 +28,8 @@
{
ANGLETest::SetUp();
- const std::string vertexShaderSource = SHADER_SOURCE
- (
- precision highp float;
+ const std::string vertexShaderSource =
+ R"(precision highp float;
attribute vec4 position;
varying vec2 texcoord;
@@ -38,20 +37,17 @@
{
gl_Position = position;
texcoord = (position.xy * 0.5) + 0.5;
- }
- );
+ })";
- const std::string fragmentShaderSource = SHADER_SOURCE
- (
- precision highp float;
+ const std::string fragmentShaderSource =
+ R"(precision highp float;
uniform sampler2D tex;
varying vec2 texcoord;
void main()
{
gl_FragColor = texture2D(tex, texcoord);
- }
- );
+ })";
mProgram = CompileProgram(vertexShaderSource, fragmentShaderSource);
if (mProgram == 0)
diff --git a/src/tests/gl_tests/IndexBufferOffsetTest.cpp b/src/tests/gl_tests/IndexBufferOffsetTest.cpp
index 329848a..d344c17 100644
--- a/src/tests/gl_tests/IndexBufferOffsetTest.cpp
+++ b/src/tests/gl_tests/IndexBufferOffsetTest.cpp
@@ -29,14 +29,22 @@
ANGLETest::SetUp();
const std::string vertexShaderSource =
- SHADER_SOURCE(precision highp float; attribute vec2 position;
+ R"(precision highp float;
+ attribute vec2 position;
- void main() { gl_Position = vec4(position, 0.0, 1.0); });
+ void main()
+ {
+ gl_Position = vec4(position, 0.0, 1.0);
+ })";
const std::string fragmentShaderSource =
- SHADER_SOURCE(precision highp float; uniform vec4 color;
+ R"(precision highp float;
+ uniform vec4 color;
- void main() { gl_FragColor = color; });
+ void main()
+ {
+ gl_FragColor = color;
+ })";
mProgram = CompileProgram(vertexShaderSource, fragmentShaderSource);
ASSERT_NE(0u, mProgram);
diff --git a/src/tests/gl_tests/IndexedPointsTest.cpp b/src/tests/gl_tests/IndexedPointsTest.cpp
index 4858f20..9199947 100644
--- a/src/tests/gl_tests/IndexedPointsTest.cpp
+++ b/src/tests/gl_tests/IndexedPointsTest.cpp
@@ -32,34 +32,45 @@
ANGLETest::SetUp();
const std::string vertexShaderSource =
- SHADER_SOURCE(precision highp float; attribute vec2 position;
+ R"(precision highp float;
+ attribute vec2 position;
- void main() {
- gl_PointSize = 5.0;
- gl_Position = vec4(position, 0.0, 1.0);
- });
+ void main() {
+ gl_PointSize = 5.0;
+ gl_Position = vec4(position, 0.0, 1.0);
+ })";
const std::string fragmentShaderSource =
- SHADER_SOURCE(precision highp float;
+ R"(precision highp float;
- void main() { gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0); });
+ void main()
+ {
+ gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
+ })";
mProgram = CompileProgram(vertexShaderSource, fragmentShaderSource);
ASSERT_NE(0u, mProgram);
const std::string vertexShaderSource2 =
- SHADER_SOURCE(precision highp float; attribute vec2 position; attribute vec4 color;
- varying vec4 vcolor;
+ R"(precision highp float;
+ attribute vec2 position;
+ attribute vec4 color;
+ varying vec4 vcolor;
- void main() {
- gl_PointSize = 5.0;
- gl_Position = vec4(position, 0.0, 1.0);
- vcolor = color;
- });
+ void main() {
+ gl_PointSize = 5.0;
+ gl_Position = vec4(position, 0.0, 1.0);
+ vcolor = color;
+ })";
const std::string fragmentShaderSource2 =
- SHADER_SOURCE(precision highp float; varying vec4 vcolor;
- void main() { gl_FragColor = vec4(vcolor.xyz, 1.0); });
+ R"(precision highp float;
+ varying vec4 vcolor;
+
+ void main()
+ {
+ gl_FragColor = vec4(vcolor.xyz, 1.0);
+ })";
mVertexWithColorBufferProgram = CompileProgram(vertexShaderSource2, fragmentShaderSource2);
ASSERT_NE(0u, mVertexWithColorBufferProgram);
diff --git a/src/tests/gl_tests/LineLoopTest.cpp b/src/tests/gl_tests/LineLoopTest.cpp
index 91fe88b..4566a37 100644
--- a/src/tests/gl_tests/LineLoopTest.cpp
+++ b/src/tests/gl_tests/LineLoopTest.cpp
@@ -25,12 +25,19 @@
{
ANGLETest::SetUp();
- const std::string vsSource = SHADER_SOURCE(attribute highp vec4 position;
-
- void main(void) { gl_Position = position; });
+ const std::string vsSource =
+ R"(attribute highp vec4 position;
+ void main(void)
+ {
+ gl_Position = position;
+ })";
const std::string fsSource =
- SHADER_SOURCE(uniform highp vec4 color; void main(void) { gl_FragColor = color; });
+ R"(uniform highp vec4 color;
+ void main(void)
+ {
+ gl_FragColor = color;
+ })";
mProgram = CompileProgram(vsSource, fsSource);
if (mProgram == 0)
diff --git a/src/tests/gl_tests/MaxTextureSizeTest.cpp b/src/tests/gl_tests/MaxTextureSizeTest.cpp
index bfef701..7686134 100644
--- a/src/tests/gl_tests/MaxTextureSizeTest.cpp
+++ b/src/tests/gl_tests/MaxTextureSizeTest.cpp
@@ -25,9 +25,8 @@
{
ANGLETest::SetUp();
- const std::string vsSource = SHADER_SOURCE
- (
- precision highp float;
+ const std::string vsSource =
+ R"(precision highp float;
attribute vec4 position;
varying vec2 texcoord;
@@ -35,30 +34,25 @@
{
gl_Position = position;
texcoord = (position.xy * 0.5) + 0.5;
- }
- );
+ })";
- const std::string textureFSSource = SHADER_SOURCE
- (
- precision highp float;
+ const std::string textureFSSource =
+ R"(precision highp float;
uniform sampler2D tex;
varying vec2 texcoord;
void main()
{
gl_FragColor = texture2D(tex, texcoord);
- }
- );
+ })";
- const std::string blueFSSource = SHADER_SOURCE
- (
- precision highp float;
+ const std::string blueFSSource =
+ R"(precision highp float;
void main()
{
gl_FragColor = vec4(0.0, 0.0, 1.0, 1.0);
- }
- );
+ })";
mTextureProgram = CompileProgram(vsSource, textureFSSource);
mBlueProgram = CompileProgram(vsSource, blueFSSource);
diff --git a/src/tests/gl_tests/MipmapTest.cpp b/src/tests/gl_tests/MipmapTest.cpp
index 8487875..9fde0bf 100644
--- a/src/tests/gl_tests/MipmapTest.cpp
+++ b/src/tests/gl_tests/MipmapTest.cpp
@@ -75,23 +75,19 @@
void setUp2DProgram()
{
// Vertex Shader source
- // clang-format off
- const std::string vs = SHADER_SOURCE
- (
- attribute vec4 position;
+ const std::string vs =
+ R"(attribute vec4 position;
varying vec2 vTexCoord;
void main()
{
gl_Position = position;
vTexCoord = (position.xy * 0.5) + 0.5;
- }
- );
+ })";
// Fragment Shader source
- const std::string fs = SHADER_SOURCE
- (
- precision mediump float;
+ const std::string fs =
+ R"(precision mediump float;
uniform sampler2D uTexture;
varying vec2 vTexCoord;
@@ -99,9 +95,7 @@
void main()
{
gl_FragColor = texture2D(uTexture, vTexCoord);
- }
- );
- // clang-format on
+ })";
m2DProgram = CompileProgram(vs, fs);
ASSERT_NE(0u, m2DProgram);
@@ -110,31 +104,25 @@
void setUpCubeProgram()
{
// A simple vertex shader for the texture cube
- // clang-format off
- const std::string cubeVS = SHADER_SOURCE
- (
- attribute vec4 position;
+ const std::string cubeVS =
+ R"(attribute vec4 position;
varying vec4 vPosition;
void main()
{
gl_Position = position;
vPosition = position;
- }
- );
+ })";
// A very simple fragment shader to sample from the negative-Y face of a texture cube.
- const std::string cubeFS = SHADER_SOURCE
- (
- precision mediump float;
+ const std::string cubeFS =
+ R"(precision mediump float;
uniform samplerCube uTexture;
varying vec4 vPosition;
void main()
{
gl_FragColor = textureCube(uTexture, vec3(vPosition.x, -1, vPosition.y));
- }
- );
- // clang-format on
+ })";
mCubeProgram = CompileProgram(cubeVS, cubeFS);
ASSERT_NE(0u, mCubeProgram);
@@ -264,9 +252,8 @@
// Don't put "#version ..." on its own line. See [cpp]p1:
// "If there are sequences of preprocessing tokens within the list of arguments that
// would otherwise act as preprocessing directives, the behavior is undefined"
- // clang-format off
- return SHADER_SOURCE
- ( #version 300 es\n
+ return
+ R"(#version 300 es
precision highp float;
in vec4 position;
out vec2 texcoord;
@@ -275,15 +262,13 @@
{
gl_Position = vec4(position.xy, 0.0, 1.0);
texcoord = (position.xy * 0.5) + 0.5;
- }
- );
- // clang-format on
+ })";
}
void setUpArrayProgram()
{
- const std::string fragmentShaderSourceArray = SHADER_SOURCE
- ( #version 300 es\n
+ const std::string fragmentShaderSourceArray =
+ R"(#version 300 es
precision highp float;
uniform highp sampler2DArray tex;
uniform int slice;
@@ -293,8 +278,7 @@
void main()
{
out_FragColor = texture(tex, vec3(texcoord, float(slice)));
- }
- );
+ })";
mArrayProgram = CompileProgram(vertexShaderSource(), fragmentShaderSourceArray);
if (mArrayProgram == 0)
@@ -312,8 +296,8 @@
void setUp3DProgram()
{
- const std::string fragmentShaderSource3D = SHADER_SOURCE
- ( #version 300 es\n
+ const std::string fragmentShaderSource3D =
+ R"(#version 300 es
precision highp float;
uniform highp sampler3D tex;
uniform float slice;
@@ -324,8 +308,7 @@
void main()
{
out_FragColor = textureLod(tex, vec3(texcoord, slice), lod);
- }
- );
+ })";
m3DProgram = CompileProgram(vertexShaderSource(), fragmentShaderSource3D);
if (m3DProgram == 0)
@@ -347,9 +330,8 @@
void setUp2DProgram()
{
- // clang-format off
- const std::string fragmentShaderSource2D = SHADER_SOURCE
- ( #version 300 es\n
+ const std::string fragmentShaderSource2D =
+ R"(#version 300 es
precision highp float;
uniform highp sampler2D tex;
in vec2 texcoord;
@@ -358,9 +340,7 @@
void main()
{
out_FragColor = texture(tex, texcoord);
- }
- );
- // clang-format on
+ })";
m2DProgram = CompileProgram(vertexShaderSource(), fragmentShaderSource2D);
ASSERT_NE(0u, m2DProgram);
@@ -371,9 +351,8 @@
void setUpCubeProgram()
{
// A very simple fragment shader to sample from the negative-Y face of a texture cube.
- // clang-format off
- const std::string cubeFS = SHADER_SOURCE
- ( #version 300 es\n
+ const std::string cubeFS =
+ R"(#version 300 es
precision mediump float;
uniform samplerCube uTexture;
in vec2 texcoord;
@@ -382,9 +361,7 @@
void main()
{
out_FragColor = texture(uTexture, vec3(texcoord.x, -1, texcoord.y));
- }
- );
- // clang-format on
+ })";
mCubeProgram = CompileProgram(vertexShaderSource(), cubeFS);
ASSERT_NE(0u, mCubeProgram);
diff --git a/src/tests/gl_tests/OcclusionQueriesTest.cpp b/src/tests/gl_tests/OcclusionQueriesTest.cpp
index 5c24f8b..e33429f 100644
--- a/src/tests/gl_tests/OcclusionQueriesTest.cpp
+++ b/src/tests/gl_tests/OcclusionQueriesTest.cpp
@@ -28,23 +28,19 @@
{
ANGLETest::SetUp();
- const std::string passthroughVS = SHADER_SOURCE
- (
- attribute highp vec4 position;
+ const std::string passthroughVS =
+ R"(attribute highp vec4 position;
void main(void)
{
gl_Position = position;
- }
- );
+ })";
- const std::string passthroughPS = SHADER_SOURCE
- (
- precision highp float;
+ const std::string passthroughPS =
+ R"(precision highp float;
void main(void)
{
gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);
- }
- );
+ })";
mProgram = CompileProgram(passthroughVS, passthroughPS);
ASSERT_NE(0u, mProgram);
@@ -288,23 +284,19 @@
eglMakeCurrent(display, surface, surface, context.context);
- const std::string passthroughVS = SHADER_SOURCE
- (
- attribute highp vec4 position;
+ const std::string passthroughVS =
+ R"(attribute highp vec4 position;
void main(void)
{
gl_Position = position;
- }
- );
+ })";
- const std::string passthroughPS = SHADER_SOURCE
- (
- precision highp float;
+ const std::string passthroughPS =
+ R"(precision highp float;
void main(void)
{
gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);
- }
- );
+ })";
context.program = CompileProgram(passthroughVS, passthroughPS);
ASSERT_NE(context.program, 0u);
diff --git a/src/tests/gl_tests/PBOExtensionTest.cpp b/src/tests/gl_tests/PBOExtensionTest.cpp
index bc6179a..baa63a4 100644
--- a/src/tests/gl_tests/PBOExtensionTest.cpp
+++ b/src/tests/gl_tests/PBOExtensionTest.cpp
@@ -34,18 +34,24 @@
glBindBuffer(GL_PIXEL_PACK_BUFFER, 0);
const char *vertexShaderSrc =
- SHADER_SOURCE(attribute vec4 aTest; attribute vec2 aPosition; varying vec4 vTest;
+ R"(attribute vec4 aTest;
+ attribute vec2 aPosition;
+ varying vec4 vTest;
- void main() {
- vTest = aTest;
- gl_Position = vec4(aPosition, 0.0, 1.0);
- gl_PointSize = 1.0;
- });
+ void main()
+ {
+ vTest = aTest;
+ gl_Position = vec4(aPosition, 0.0, 1.0);
+ gl_PointSize = 1.0;
+ })";
const char *fragmentShaderSrc =
- SHADER_SOURCE(precision mediump float; varying vec4 vTest;
-
- void main() { gl_FragColor = vTest; });
+ R"(precision mediump float;
+ varying vec4 vTest;
+ void main()
+ {
+ gl_FragColor = vTest;
+ })";
mProgram = CompileProgram(vertexShaderSrc, fragmentShaderSrc);
diff --git a/src/tests/gl_tests/PackUnpackTest.cpp b/src/tests/gl_tests/PackUnpackTest.cpp
index 032504b..d86f526 100644
--- a/src/tests/gl_tests/PackUnpackTest.cpp
+++ b/src/tests/gl_tests/PackUnpackTest.cpp
@@ -32,21 +32,19 @@
ANGLETest::SetUp();
// Vertex Shader source
- const std::string vs = SHADER_SOURCE
- ( #version 300 es\n
+ const std::string vs =
+ R"(#version 300 es
precision mediump float;
in vec4 position;
void main()
{
gl_Position = position;
- }
- );
+ })";
- // clang-format off
// Fragment Shader source
- const std::string sNormFS = SHADER_SOURCE
- ( #version 300 es\n
+ const std::string sNormFS =
+ R"(#version 300 es
precision mediump float;
uniform mediump vec2 v;
layout(location = 0) out mediump vec4 fragColor;
@@ -56,12 +54,11 @@
uint u = packSnorm2x16(v);
vec2 r = unpackSnorm2x16(u);
fragColor = vec4(r, 0.0, 1.0);
- }
- );
+ })";
// Fragment Shader source
- const std::string uNormFS = SHADER_SOURCE
- ( #version 300 es\n
+ const std::string uNormFS =
+ R"(#version 300 es
precision mediump float;
uniform mediump vec2 v;
layout(location = 0) out mediump vec4 fragColor;
@@ -71,12 +68,11 @@
uint u = packUnorm2x16(v);
vec2 r = unpackUnorm2x16(u);
fragColor = vec4(r, 0.0, 1.0);
- }
- );
+ })";
// Fragment Shader source
- const std::string halfFS = SHADER_SOURCE
- ( #version 300 es\n
+ const std::string halfFS =
+ R"(#version 300 es
precision mediump float;
uniform mediump vec2 v;
layout(location = 0) out mediump vec4 fragColor;
@@ -86,9 +82,7 @@
uint u = packHalf2x16(v);
vec2 r = unpackHalf2x16(u);
fragColor = vec4(r, 0.0, 1.0);
- }
- );
- // clang-format on
+ })";
mSNormProgram = CompileProgram(vs, sNormFS);
mUNormProgram = CompileProgram(vs, uNormFS);
diff --git a/src/tests/gl_tests/PbufferTest.cpp b/src/tests/gl_tests/PbufferTest.cpp
index f3b5dac..19a174a 100644
--- a/src/tests/gl_tests/PbufferTest.cpp
+++ b/src/tests/gl_tests/PbufferTest.cpp
@@ -26,9 +26,8 @@
{
ANGLETest::SetUp();
- const std::string vsSource = SHADER_SOURCE
- (
- precision highp float;
+ const std::string vsSource =
+ R"(precision highp float;
attribute vec4 position;
varying vec2 texcoord;
@@ -37,20 +36,17 @@
gl_Position = position;
texcoord = (position.xy * 0.5) + 0.5;
texcoord.y = 1.0 - texcoord.y;
- }
- );
+ })";
- const std::string textureFSSource = SHADER_SOURCE
- (
- precision highp float;
+ const std::string textureFSSource =
+ R"(precision highp float;
uniform sampler2D tex;
varying vec2 texcoord;
void main()
{
gl_FragColor = texture2D(tex, texcoord);
- }
- );
+ })";
mTextureProgram = CompileProgram(vsSource, textureFSSource);
if (mTextureProgram == 0)
diff --git a/src/tests/gl_tests/PointSpritesTest.cpp b/src/tests/gl_tests/PointSpritesTest.cpp
index aec1ddf..2003aa7 100644
--- a/src/tests/gl_tests/PointSpritesTest.cpp
+++ b/src/tests/gl_tests/PointSpritesTest.cpp
@@ -52,15 +52,21 @@
return;
}
- const std::string fs = SHADER_SOURCE(precision mediump float; void main() {
- gl_FragColor = vec4(gl_PointCoord.x, gl_PointCoord.y, 0, 1);
- });
+ const std::string fs =
+ R"(precision mediump float;
+ void main()
+ {
+ gl_FragColor = vec4(gl_PointCoord.x, gl_PointCoord.y, 0, 1);
+ })";
const std::string vs =
- SHADER_SOURCE(attribute vec4 vPosition; uniform float uPointSize; void main() {
+ R"(attribute vec4 vPosition;
+ uniform float uPointSize;
+ void main()
+ {
gl_PointSize = uPointSize;
gl_Position = vPosition;
- });
+ })";
ANGLE_GL_PROGRAM(program, vs, fs);
@@ -156,25 +162,19 @@
return;
}
- // clang-format off
- const std::string fs = SHADER_SOURCE
- (
- precision mediump float;
+ const std::string fs =
+ R"(precision mediump float;
void main()
{
gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);
- }
- );
+ })";
- const std::string vs = SHADER_SOURCE
- (
- void main()
+ const std::string vs =
+ R"(void main()
{
gl_PointSize = 2.0;
gl_Position = vec4(0.0, 0.0, 0.0, 1.0);
- }
- );
- // clang-format on
+ })";
ANGLE_GL_PROGRAM(program, vs, fs);
ASSERT_GL_NO_ERROR();
@@ -201,7 +201,10 @@
}
const std::string fs =
- SHADER_SOURCE(precision mediump float; varying vec4 v_color; void main() {
+ R"(precision mediump float;
+ varying vec4 v_color;
+ void main()
+ {
// It seems as long as this mathematical expression references
// gl_PointCoord, the fragment's color is incorrect.
vec2 diff = gl_PointCoord - vec2(.5, .5);
@@ -210,17 +213,20 @@
// The point should be a solid color.
gl_FragColor = v_color;
- });
+ })";
const std::string vs =
- SHADER_SOURCE(varying vec4 v_color;
- // The X and Y coordinates of the center of the point.
- attribute vec2 a_vertex; uniform float u_pointSize; void main() {
- gl_PointSize = u_pointSize;
- gl_Position = vec4(a_vertex, 0.0, 1.0);
- // The color of the point.
- v_color = vec4(0.0, 1.0, 0.0, 1.0);
- });
+ R"(varying vec4 v_color;
+ // The X and Y coordinates of the center of the point.
+ attribute vec2 a_vertex;
+ uniform float u_pointSize;
+ void main()
+ {
+ gl_PointSize = u_pointSize;
+ gl_Position = vec4(a_vertex, 0.0, 1.0);
+ // The color of the point.
+ v_color = vec4(0.0, 1.0, 0.0, 1.0);
+ })";
ANGLE_GL_PROGRAM(program, vs, fs);
ASSERT_GL_NO_ERROR();
@@ -278,18 +284,27 @@
return;
}
- const std::string fs = SHADER_SOURCE(precision mediump float; varying vec4 color;
+ const std::string fs =
+ R"(precision mediump float;
+ varying vec4 color;
- void main() { gl_FragColor = color; });
+ void main()
+ {
+ gl_FragColor = color;
+ })";
- const std::string vs = SHADER_SOURCE(attribute vec3 pos; attribute vec4 colorIn;
- uniform float pointSize; varying vec4 color;
+ const std::string vs =
+ R"(attribute vec3 pos;
+ attribute vec4 colorIn;
+ uniform float pointSize;
+ varying vec4 color;
- void main() {
- gl_PointSize = pointSize;
- color = colorIn;
- gl_Position = vec4(pos, 1.0);
- });
+ void main()
+ {
+ gl_PointSize = pointSize;
+ color = colorIn;
+ gl_Position = vec4(pos, 1.0);
+ })";
// The WebGL test is drawn on a 2x2 canvas. Emulate this by setting a 2x2 viewport.
glViewport(0, 0, 2, 2);
@@ -387,15 +402,20 @@
// Verify that rendering works correctly when gl_PointSize is declared in a shader but isn't used
TEST_P(PointSpritesTest, PointSizeDeclaredButUnused)
{
- const std::string vs = SHADER_SOURCE(attribute highp vec4 position;
+ const std::string vs =
+ R"(attribute highp vec4 position;
- void main(void) {
- gl_PointSize = 1.0;
- gl_Position = position;
- });
+ void main(void)
+ {
+ gl_PointSize = 1.0;
+ gl_Position = position;
+ })";
const std::string fs =
- SHADER_SOURCE(void main(void) { gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0); });
+ R"(void main(void)
+ {
+ gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
+ })";
ANGLE_GL_PROGRAM(program, vs, fs);
ASSERT_GL_NO_ERROR();
@@ -413,44 +433,34 @@
// spites.
TEST_P(PointSpritesTest, PointSpriteAlternatingDrawTypes)
{
- // clang-format off
- const std::string pointFS = SHADER_SOURCE
- (
- precision mediump float;
+ const std::string pointFS =
+ R"(precision mediump float;
void main()
{
gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);
- }
- );
+ })";
- const std::string pointVS = SHADER_SOURCE
- (
- void main()
+ const std::string pointVS =
+ R"(void main()
{
gl_PointSize = 16.0;
gl_Position = vec4(0.0, 0.0, 0.0, 1.0);
- }
- );
+ })";
- const std::string quadFS = SHADER_SOURCE
- (
- precision mediump float;
+ const std::string quadFS =
+ R"(precision mediump float;
void main()
{
gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
- }
- );
+ })";
- const std::string quadVS = SHADER_SOURCE
- (
- precision mediump float;
+ const std::string quadVS =
+ R"(precision mediump float;
attribute vec4 pos;
void main()
{
gl_Position = pos;
- }
- );
- // clang-format on
+ })";
ANGLE_GL_PROGRAM(pointProgram, pointVS, pointFS);
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);
}
diff --git a/src/tests/gl_tests/SimpleOperationTest.cpp b/src/tests/gl_tests/SimpleOperationTest.cpp
index a22b8e1..d5850d8 100644
--- a/src/tests/gl_tests/SimpleOperationTest.cpp
+++ b/src/tests/gl_tests/SimpleOperationTest.cpp
@@ -54,14 +54,12 @@
TEST_P(SimpleOperationTest, CompileVertexShader)
{
- const std::string source = SHADER_SOURCE
- (
- attribute vec4 a_input;
+ const std::string source =
+ R"(attribute vec4 a_input;
void main()
{
gl_Position = a_input;
- }
- );
+ })";
GLuint shader = CompileShader(GL_VERTEX_SHADER, source);
EXPECT_NE(shader, 0u);
@@ -72,15 +70,13 @@
TEST_P(SimpleOperationTest, CompileFragmentShader)
{
- const std::string source = SHADER_SOURCE
- (
- precision mediump float;
+ const std::string source =
+ R"(precision mediump float;
varying vec4 v_input;
void main()
{
gl_FragColor = v_input;
- }
- );
+ })";
GLuint shader = CompileShader(GL_FRAGMENT_SHADER, source);
EXPECT_NE(shader, 0u);
@@ -91,21 +87,17 @@
TEST_P(SimpleOperationTest, LinkProgram)
{
- const std::string vsSource = SHADER_SOURCE
- (
- void main()
+ const std::string vsSource =
+ R"(void main()
{
gl_Position = vec4(1.0, 1.0, 1.0, 1.0);
- }
- );
+ })";
- const std::string fsSource = SHADER_SOURCE
- (
- void main()
+ const std::string fsSource =
+ R"(void main()
{
gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);
- }
- );
+ })";
GLuint program = CompileProgram(vsSource, fsSource);
EXPECT_NE(program, 0u);
@@ -123,23 +115,19 @@
return;
}
- const std::string vsSource = SHADER_SOURCE
- (
- void main()
+ const std::string vsSource =
+ R"(void main()
{
gl_Position = vec4(1.0, 1.0, 1.0, 1.0);
- }
- );
+ })";
- const std::string fsSource = SHADER_SOURCE
- (
- precision mediump float;
+ const std::string fsSource =
+ R"(precision mediump float;
uniform vec4 u_input;
void main()
{
gl_FragColor = u_input;
- }
- );
+ })";
GLuint program = CompileProgram(vsSource, fsSource);
EXPECT_NE(program, 0u);
@@ -161,22 +149,18 @@
return;
}
- const std::string vsSource = SHADER_SOURCE
- (
- attribute vec4 a_input;
+ const std::string vsSource =
+ R"(attribute vec4 a_input;
void main()
{
gl_Position = a_input;
- }
- );
+ })";
- const std::string fsSource = SHADER_SOURCE
- (
- void main()
+ const std::string fsSource =
+ R"(void main()
{
gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);
- }
- );
+ })";
GLuint program = CompileProgram(vsSource, fsSource);
EXPECT_NE(program, 0u);
diff --git a/src/tests/gl_tests/SixteenBppTextureTest.cpp b/src/tests/gl_tests/SixteenBppTextureTest.cpp
index b6da319..ad59cf4 100644
--- a/src/tests/gl_tests/SixteenBppTextureTest.cpp
+++ b/src/tests/gl_tests/SixteenBppTextureTest.cpp
@@ -50,9 +50,8 @@
{
ANGLETest::SetUp();
- const std::string vertexShaderSource = SHADER_SOURCE
- (
- precision highp float;
+ const std::string vertexShaderSource =
+ R"(precision highp float;
attribute vec4 position;
varying vec2 texcoord;
@@ -60,20 +59,17 @@
{
gl_Position = vec4(position.xy, 0.0, 1.0);
texcoord = (position.xy * 0.5) + 0.5;
- }
- );
+ })";
- const std::string fragmentShaderSource2D = SHADER_SOURCE
- (
- precision highp float;
+ const std::string fragmentShaderSource2D =
+ R"(precision highp float;
uniform sampler2D tex;
varying vec2 texcoord;
void main()
{
gl_FragColor = texture2D(tex, texcoord);
- }
- );
+ })";
m2DProgram = CompileProgram(vertexShaderSource, fragmentShaderSource2D);
mTexture2DUniformLocation = glGetUniformLocation(m2DProgram, "tex");
diff --git a/src/tests/gl_tests/SwizzleTest.cpp b/src/tests/gl_tests/SwizzleTest.cpp
index c69074b..e82f11d 100644
--- a/src/tests/gl_tests/SwizzleTest.cpp
+++ b/src/tests/gl_tests/SwizzleTest.cpp
@@ -64,9 +64,8 @@
{
ANGLETest::SetUp();
- const std::string vertexShaderSource = SHADER_SOURCE
- (
- precision highp float;
+ const std::string vertexShaderSource =
+ R"(precision highp float;
attribute vec4 position;
varying vec2 texcoord;
@@ -74,20 +73,17 @@
{
gl_Position = position;
texcoord = (position.xy * 0.5) + 0.5;
- }
- );
+ })";
- const std::string fragmentShaderSource = SHADER_SOURCE
- (
- precision highp float;
+ const std::string fragmentShaderSource =
+ R"(precision highp float;
uniform sampler2D tex;
varying vec2 texcoord;
void main()
{
gl_FragColor = texture2D(tex, texcoord);
- }
- );
+ })";
mProgram = CompileProgram(vertexShaderSource, fragmentShaderSource);
ASSERT_NE(0u, mProgram);
diff --git a/src/tests/gl_tests/TextureTest.cpp b/src/tests/gl_tests/TextureTest.cpp
index 5f689c9..1096709 100644
--- a/src/tests/gl_tests/TextureTest.cpp
+++ b/src/tests/gl_tests/TextureTest.cpp
@@ -49,9 +49,8 @@
virtual std::string getVertexShaderSource()
{
- return std::string(SHADER_SOURCE
- (
- precision highp float;
+ return
+ R"(precision highp float;
attribute vec4 position;
varying vec2 texcoord;
@@ -59,9 +58,7 @@
{
gl_Position = vec4(position.xy, 0.0, 1.0);
texcoord = (position.xy * 0.5) + 0.5;
- }
- )
- );
+ })";
}
virtual std::string getFragmentShaderSource() = 0;
@@ -140,18 +137,15 @@
std::string getFragmentShaderSource() override
{
- return std::string(SHADER_SOURCE
- (
- precision highp float;
+ return
+ R"(precision highp float;
uniform sampler2D tex;
varying vec2 texcoord;
void main()
{
gl_FragColor = texture2D(tex, texcoord);
- }
- )
- );
+ })";
}
virtual const char *getTextureUniformName() { return "tex"; }
@@ -497,9 +491,8 @@
std::string getVertexShaderSource() override
{
- return std::string(SHADER_SOURCE
- (
- precision highp float;
+ return
+ R"(precision highp float;
attribute vec4 position;
varying vec2 texcoord;
@@ -509,9 +502,7 @@
{
gl_Position = vec4(position.xy * drawScale, 0.0, 1.0);
texcoord = (position.xy * 0.5) + 0.5;
- }
- )
- );
+ })";
}
void SetUp() override
@@ -539,9 +530,8 @@
std::string getFragmentShaderSource() override
{
- return std::string(SHADER_SOURCE
- (
- precision highp float;
+ return
+ R"(precision highp float;
uniform sampler2D tex;
varying vec2 texcoord;
@@ -553,9 +543,7 @@
void main()
{
gl_FragColor = computeFragColor(tex);
- }
- )
- );
+ })";
}
void SetUp() override
@@ -579,9 +567,8 @@
std::string getFragmentShaderSource() override
{
- return std::string(SHADER_SOURCE
- (
- precision highp float;
+ return
+ R"(precision highp float;
uniform sampler2D tex2D;
uniform samplerCube texCube;
varying vec2 texcoord;
@@ -590,9 +577,7 @@
{
gl_FragColor = texture2D(tex2D, texcoord);
gl_FragColor += textureCube(texCube, vec3(texcoord, 0));
- }
- )
- );
+ })";
}
void SetUp() override
@@ -650,18 +635,15 @@
std::string getFragmentShaderSource() override
{
- return std::string(SHADER_SOURCE
- (
- precision mediump float;
+ return
+ R"(precision mediump float;
uniform highp sampler2D tex2DArray[2];
varying vec2 texcoord;
void main()
{
gl_FragColor = texture2D(tex2DArray[0], texcoord);
gl_FragColor += texture2D(tex2DArray[1], texcoord);
- }
- )
- );
+ })";
}
void SetUp() override
@@ -728,9 +710,8 @@
std::string getFragmentShaderSource() override
{
- return std::string(SHADER_SOURCE
- (
- precision mediump float;
+ return
+ R"(precision mediump float;
uniform highp sampler2D tex2DArray[2];
varying vec2 texcoord;
@@ -742,9 +723,7 @@
void main()
{
gl_FragColor = computeFragColor(tex2DArray);
- }
- )
- );
+ })";
}
};
@@ -3936,20 +3915,20 @@
}
const std::string vs =
R"(#version 300 es
- precision mediump float;
- in vec3 pos;
- void main() {
- gl_Position = vec4(pos, 1.0);
- })";
+ precision mediump float;
+ in vec3 pos;
+ void main() {
+ gl_Position = vec4(pos, 1.0);
+ })";
const std::string fs =
R"(#version 300 es
- precision mediump float;
- out vec4 color;
- uniform samplerCube uTex;
- void main(){
- color = texture(uTex, vec3(1.0));
- })";
+ precision mediump float;
+ out vec4 color;
+ uniform samplerCube uTex;
+ void main(){
+ color = texture(uTex, vec3(1.0));
+ })";
ANGLE_GL_PROGRAM(program, vs, fs);
glUseProgram(program);
diff --git a/src/tests/gl_tests/TransformFeedbackTest.cpp b/src/tests/gl_tests/TransformFeedbackTest.cpp
index d66c8bf..47e17c6 100644
--- a/src/tests/gl_tests/TransformFeedbackTest.cpp
+++ b/src/tests/gl_tests/TransformFeedbackTest.cpp
@@ -78,14 +78,21 @@
ASSERT_EQ(0u, mProgram);
const std::string vertexShaderSource =
- SHADER_SOURCE(precision highp float; attribute vec4 position;
+ R"(precision highp float;
+ attribute vec4 position;
- void main() { gl_Position = position; });
+ void main()
+ {
+ gl_Position = position;
+ })";
const std::string fragmentShaderSource =
- SHADER_SOURCE(precision highp float;
+ R"(precision highp float;
- void main() { gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0); });
+ void main()
+ {
+ gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
+ })";
mProgram = CompileProgramWithTransformFeedback(vertexShaderSource, fragmentShaderSource,
tfVaryings, bufferMode);
@@ -421,28 +428,24 @@
const size_t transformFeedbackCount = 8;
- // clang-format off
- const std::string vertexShaderSource = SHADER_SOURCE
- ( #version 300 es\n
- in highp vec4 position;
- in float transformFeedbackInput;
- out float transformFeedbackOutput;
- void main(void)
- {
- gl_Position = position;
- transformFeedbackOutput = transformFeedbackInput;
- }
- );
+ const std::string vertexShaderSource =
+ R"(#version 300 es
+ in highp vec4 position;
+ in float transformFeedbackInput;
+ out float transformFeedbackOutput;
+ void main(void)
+ {
+ gl_Position = position;
+ transformFeedbackOutput = transformFeedbackInput;
+ })";
- const std::string fragmentShaderSource = SHADER_SOURCE
- ( #version 300 es\n
- out mediump vec4 color;
- void main(void)
- {
- color = vec4(1.0, 1.0, 1.0, 1.0);
- }
- );
- // clang-format on
+ const std::string fragmentShaderSource =
+ R"(#version 300 es
+ out mediump vec4 color;
+ void main(void)
+ {
+ color = vec4(1.0, 1.0, 1.0, 1.0);
+ })";
std::vector<std::string> tfVaryings;
tfVaryings.push_back("transformFeedbackOutput");
@@ -558,9 +561,8 @@
eglMakeCurrent(display, surface, surface, context.context);
- // clang-format off
- const std::string vertexShaderSource = SHADER_SOURCE
- ( #version 300 es\n
+ const std::string vertexShaderSource =
+ R"(#version 300 es
in highp vec4 position;
in float transformFeedbackInput;
out float transformFeedbackOutput;
@@ -568,18 +570,15 @@
{
gl_Position = position;
transformFeedbackOutput = transformFeedbackInput;
- }
- );
+ })";
- const std::string fragmentShaderSource = SHADER_SOURCE
- ( #version 300 es\n
+ const std::string fragmentShaderSource =
+ R"(#version 300 es
out mediump vec4 color;
void main(void)
{
color = vec4(1.0, 1.0, 1.0, 1.0);
- }
- );
- // clang-format on
+ })";
std::vector<std::string> tfVaryings;
tfVaryings.push_back("transformFeedbackOutput");
diff --git a/src/tests/gl_tests/UniformBufferTest.cpp b/src/tests/gl_tests/UniformBufferTest.cpp
index 4c3e7a2..db28f7b 100644
--- a/src/tests/gl_tests/UniformBufferTest.cpp
+++ b/src/tests/gl_tests/UniformBufferTest.cpp
@@ -29,14 +29,23 @@
{
ANGLETest::SetUp();
- mVertexShaderSource = SHADER_SOURCE(#version 300 es\n in vec4 position;
- void main() { gl_Position = position; });
+ mVertexShaderSource =
+ R"(#version 300 es
+ in vec4 position;
+ void main()
+ {
+ gl_Position = position;
+ })";
+
mFragmentShaderSource =
- SHADER_SOURCE(#version 300 es\n precision highp float; uniform uni { vec4 color; };
-
- out vec4 fragColor;
-
- void main() { fragColor = color; });
+ R"(#version 300 es
+ precision highp float;
+ uniform uni { vec4 color; };
+ out vec4 fragColor;
+ void main()
+ {
+ fragColor = color;
+ })";
mProgram = CompileProgram(mVertexShaderSource, mFragmentShaderSource);
ASSERT_NE(mProgram, 0u);
diff --git a/src/tests/gl_tests/UniformTest.cpp b/src/tests/gl_tests/UniformTest.cpp
index 50e3233..eee3454 100644
--- a/src/tests/gl_tests/UniformTest.cpp
+++ b/src/tests/gl_tests/UniformTest.cpp
@@ -110,25 +110,21 @@
return;
}
- const std::string vertexShader = SHADER_SOURCE
- (
- precision mediump float;
+ const std::string vertexShader =
+ R"(precision mediump float;
uniform float uPosition[4];
void main(void)
{
gl_Position = vec4(uPosition[0], uPosition[1], uPosition[2], uPosition[3]);
- }
- );
+ })";
- const std::string fragShader = SHADER_SOURCE
- (
- precision mediump float;
+ const std::string fragShader =
+ R"(precision mediump float;
uniform float uColor[4];
void main(void)
{
gl_FragColor = vec4(uColor[0], uColor[1], uColor[2], uColor[3]);
- }
- );
+ })";
GLuint program = CompileProgram(vertexShader, fragShader);
ASSERT_NE(program, 0u);
diff --git a/src/tests/gl_tests/UnpackAlignmentTest.cpp b/src/tests/gl_tests/UnpackAlignmentTest.cpp
index 2a3f76b..056bfa1 100644
--- a/src/tests/gl_tests/UnpackAlignmentTest.cpp
+++ b/src/tests/gl_tests/UnpackAlignmentTest.cpp
@@ -31,26 +31,22 @@
{
ANGLETest::SetUp();
- const std::string vertexShaderSource = SHADER_SOURCE
- (
- precision highp float;
+ const std::string vertexShaderSource =
+ R"(precision highp float;
attribute vec4 position;
void main()
{
gl_Position = position;
- }
- );
+ })";
- const std::string fragmentShaderSource = SHADER_SOURCE
- (
- uniform sampler2D tex;
+ const std::string fragmentShaderSource =
+ R"(uniform sampler2D tex;
void main()
{
gl_FragColor = texture2D(tex, vec2(0.0, 1.0));
- }
- );
+ })";
mProgram = CompileProgram(vertexShaderSource, fragmentShaderSource);
if (mProgram == 0)
diff --git a/src/tests/gl_tests/UnpackRowLength.cpp b/src/tests/gl_tests/UnpackRowLength.cpp
index 05ad595..bacd70f 100644
--- a/src/tests/gl_tests/UnpackRowLength.cpp
+++ b/src/tests/gl_tests/UnpackRowLength.cpp
@@ -31,26 +31,22 @@
{
ANGLETest::SetUp();
- const std::string vertexShaderSource = SHADER_SOURCE
- (
- precision highp float;
+ const std::string vertexShaderSource =
+ R"(precision highp float;
attribute vec4 position;
void main()
{
gl_Position = position;
- }
- );
+ })";
- const std::string fragmentShaderSource = SHADER_SOURCE
- (
- uniform sampler2D tex;
+ const std::string fragmentShaderSource =
+ R"(uniform sampler2D tex;
void main()
{
gl_FragColor = texture2D(tex, vec2(0.0, 1.0));
- }
- );
+ })";
mProgram = CompileProgram(vertexShaderSource, fragmentShaderSource);
if (mProgram == 0)
diff --git a/src/tests/gl_tests/ViewportTest.cpp b/src/tests/gl_tests/ViewportTest.cpp
index 8cd9cd3..7e8da21 100644
--- a/src/tests/gl_tests/ViewportTest.cpp
+++ b/src/tests/gl_tests/ViewportTest.cpp
@@ -122,23 +122,19 @@
{
ANGLETest::SetUp();
- 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);
- }
- );
+ })";
mProgram = CompileProgram(testVertexShaderSource, testFragmentShaderSource);
if (mProgram == 0)
diff --git a/src/tests/perf_tests/TexSubImage.cpp b/src/tests/perf_tests/TexSubImage.cpp
index b66aab4..f534ee9 100644
--- a/src/tests/perf_tests/TexSubImage.cpp
+++ b/src/tests/perf_tests/TexSubImage.cpp
@@ -131,15 +131,24 @@
{
const auto ¶ms = GetParam();
- const std::string vs = SHADER_SOURCE(attribute vec4 a_position; attribute vec2 a_texCoord;
- varying vec2 v_texCoord; void main() {
- gl_Position = a_position;
- v_texCoord = a_texCoord;
- });
+ const std::string vs =
+ R"(attribute vec4 a_position;
+ attribute vec2 a_texCoord;
+ varying vec2 v_texCoord;
+ void main()
+ {
+ gl_Position = a_position;
+ v_texCoord = a_texCoord;
+ })";
const std::string fs =
- SHADER_SOURCE(precision mediump float; varying vec2 v_texCoord; uniform sampler2D s_texture;
- void main() { gl_FragColor = texture2D(s_texture, v_texCoord); });
+ R"(precision mediump float;
+ varying vec2 v_texCoord;
+ uniform sampler2D s_texture;
+ void main()
+ {
+ gl_FragColor = texture2D(s_texture, v_texCoord);
+ })";
mProgram = CompileProgram(vs, fs);
ASSERT_NE(0u, mProgram);
diff --git a/src/tests/test_utils/draw_call_perf_utils.cpp b/src/tests/test_utils/draw_call_perf_utils.cpp
index e6c316c..beeaf09 100644
--- a/src/tests/test_utils/draw_call_perf_utils.cpp
+++ b/src/tests/test_utils/draw_call_perf_utils.cpp
@@ -18,49 +18,37 @@
const char *SimpleScaleAndOffsetVertexShaderSource()
{
- // clang-format off
- return SHADER_SOURCE
- (
- attribute vec2 vPosition;
+ return
+ R"(attribute vec2 vPosition;
uniform float uScale;
uniform float uOffset;
void main()
{
gl_Position = vec4(vPosition * vec2(uScale) + vec2(uOffset), 0, 1);
- }
- );
- // clang-format on
+ })";
}
const char *SimpleDrawVertexShaderSource()
{
- // clang-format off
- return SHADER_SOURCE
- (
- attribute vec2 vPosition;
+ return
+ R"(attribute vec2 vPosition;
const float scale = 0.5;
const float offset = -0.5;
void main()
{
gl_Position = vec4(vPosition * vec2(scale) + vec2(offset), 0, 1);
- }
- );
- // clang-format on
+ })";
}
const char *SimpleFragmentShaderSource()
{
- // clang-format off
- return SHADER_SOURCE
- (
- precision mediump float;
+ return
+ R"(precision mediump float;
void main()
{
gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
- }
- );
- // clang-format on
+ })";
}
void Generate2DTriangleData(size_t numTris, std::vector<float> *floatData)