Refactor test shader style.
This change enforces a lot more consistency. We pass const char * to
the Compile functions instead of std::string. Also fixes the
indentation of C++11 block comments to be more consistent.
Bug: angleproject:2995
Change-Id: Id6e5ea94055d8cbd420df4ea2e81b2d96cb5ce78
Reviewed-on: https://chromium-review.googlesource.com/c/1357103
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
diff --git a/src/tests/gl_tests/FramebufferTest.cpp b/src/tests/gl_tests/FramebufferTest.cpp
index 69ffbc4..5100fe5 100644
--- a/src/tests/gl_tests/FramebufferTest.cpp
+++ b/src/tests/gl_tests/FramebufferTest.cpp
@@ -800,46 +800,42 @@
// anglebug.com/2253
ANGLE_SKIP_TEST_IF(IsLinux() && IsAMD() && IsDesktopOpenGL());
- const std::string &vertexShader1 =
- R"(#version 310 es
- in layout(location = 0) highp vec2 a_position;
- void main()
- {
- gl_Position = vec4(a_position, 0.0, 1.0);
- })";
+ constexpr char kVS1[] = R"(#version 310 es
+in layout(location = 0) highp vec2 a_position;
+void main()
+{
+ gl_Position = vec4(a_position, 0.0, 1.0);
+})";
- const std::string &fragShader1 =
- R"(#version 310 es
- uniform layout(location = 0) highp ivec2 u_expectedSize;
- out layout(location = 5) mediump vec4 f_color;
- void main()
- {
- if (ivec2(gl_FragCoord.xy) != u_expectedSize) discard;
- f_color = vec4(1.0, 0.5, 0.25, 1.0);
- })";
+ constexpr char kFS1[] = R"(#version 310 es
+uniform layout(location = 0) highp ivec2 u_expectedSize;
+out layout(location = 5) mediump vec4 f_color;
+void main()
+{
+ if (ivec2(gl_FragCoord.xy) != u_expectedSize) discard;
+ f_color = vec4(1.0, 0.5, 0.25, 1.0);
+})";
- const std::string &vertexShader2 =
- R"(#version 310 es
- in layout(location = 0) highp vec2 a_position;
- void main()
- {
- gl_Position = vec4(a_position, 0.0, 1.0);
- })";
+ constexpr char kVS2[] = R"(#version 310 es
+in layout(location = 0) highp vec2 a_position;
+void main()
+{
+ gl_Position = vec4(a_position, 0.0, 1.0);
+})";
- const std::string &fragShader2 =
- R"(#version 310 es
- uniform layout(location = 0) highp ivec2 u_expectedSize;
- out layout(location = 2) mediump vec4 f_color;
- void main()
- {
- if (ivec2(gl_FragCoord.xy) != u_expectedSize) discard;
- f_color = vec4(1.0, 0.5, 0.25, 1.0);
- })";
+ constexpr char kFS2[] = R"(#version 310 es
+uniform layout(location = 0) highp ivec2 u_expectedSize;
+out layout(location = 2) mediump vec4 f_color;
+void main()
+{
+ if (ivec2(gl_FragCoord.xy) != u_expectedSize) discard;
+ f_color = vec4(1.0, 0.5, 0.25, 1.0);
+})";
- GLuint program1 = CompileProgram(vertexShader1, fragShader1);
+ GLuint program1 = CompileProgram(kVS1, kFS1);
ASSERT_NE(program1, 0u);
- GLuint program2 = CompileProgram(vertexShader2, fragShader2);
+ GLuint program2 = CompileProgram(kVS2, kFS2);
ASSERT_NE(program2, 0u);
glUseProgram(program1);
@@ -936,10 +932,10 @@
// Test to verify workaround succeeds when no program outputs exist http://anglebug.com/2283
TEST_P(AddDummyTextureNoRenderTargetTest, NoProgramOutputWorkaround)
{
- const std::string &vShader = "void main() {}";
- const std::string &fShader = "void main() {}";
+ constexpr char kVS[] = "void main() {}";
+ constexpr char kFS[] = "void main() {}";
- ANGLE_GL_PROGRAM(drawProgram, vShader, fShader);
+ ANGLE_GL_PROGRAM(drawProgram, kVS, kFS);
glUseProgram(drawProgram);