Skip to content

Commit df25bd5

Browse files
committed
last residue of static const string and cleanup
1 parent aabd8a8 commit df25bd5

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

src/framework/graphics/ogl/painterogl2_shadersources.h

+10-10
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ static constexpr std::string_view glslMainVertexShader = "\n\
2626
highp vec4 calculatePosition();\n\
2727
void main() {\n\
2828
gl_Position = calculatePosition();\n\
29-
}\n";
29+
}\n",
3030

31-
static constexpr std::string_view glslMainWithTexCoordsVertexShader = "\n\
31+
glslMainWithTexCoordsVertexShader = "\n\
3232
attribute highp vec2 a_TexCoord;\n\
3333
uniform highp mat3 u_TextureMatrix;\n\
3434
varying highp vec2 v_TexCoord;\n\
@@ -37,34 +37,34 @@ static constexpr std::string_view glslMainWithTexCoordsVertexShader = "\n\
3737
{\n\
3838
gl_Position = calculatePosition();\n\
3939
v_TexCoord = (u_TextureMatrix * vec3(a_TexCoord,1.0)).xy;\n\
40-
}\n";
40+
}\n",
4141

42-
static constexpr std::string_view glslPositionOnlyVertexShader = "\n\
42+
glslPositionOnlyVertexShader = "\n\
4343
attribute highp vec2 a_Vertex;\n\
4444
uniform highp mat3 u_TransformMatrix;\n\
4545
uniform highp mat3 u_ProjectionMatrix;\n\
4646
highp vec4 calculatePosition() {\n\
4747
return vec4(u_ProjectionMatrix * u_TransformMatrix * vec3(a_Vertex.xy, 1.0), 1.0);\n\
48-
}\n";
48+
}\n",
4949

50-
static constexpr std::string_view glslMainFragmentShader = "\n\
50+
glslMainFragmentShader = "\n\
5151
uniform lowp float u_Opacity;\n\
5252
lowp vec4 calculatePixel();\n\
5353
void main()\n\
5454
{\n\
5555
gl_FragColor = calculatePixel();\n\
5656
gl_FragColor.a *= u_Opacity;\n\
57-
}\n";
57+
}\n",
5858

59-
static constexpr std::string_view glslTextureSrcFragmentShader = "\n\
59+
glslTextureSrcFragmentShader = "\n\
6060
varying mediump vec2 v_TexCoord;\n\
6161
uniform lowp vec4 u_Color;\n\
6262
uniform sampler2D u_Tex0;\n\
6363
lowp vec4 calculatePixel() {\n\
6464
return texture2D(u_Tex0, v_TexCoord) * u_Color;\n\
65-
}\n";
65+
}\n",
6666

67-
static constexpr std::string_view glslSolidColorFragmentShader = "\n\
67+
glslSolidColorFragmentShader = "\n\
6868
uniform lowp vec4 u_Color;\n\
6969
lowp vec4 calculatePixel() {\n\
7070
return u_Color;\n\

src/framework/graphics/shader.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -54,19 +54,19 @@ Shader::~Shader()
5454
bool Shader::compileSourceCode(const std::string_view sourceCode)
5555
{
5656
#ifndef OPENGL_ES
57-
static const auto* qualifierDefines =
57+
static constexpr std::string_view qualifierDefines =
5858
"#define lowp\n"
5959
"#define mediump\n"
6060
"#define highp\n";
6161
#else
62-
static const char* qualifierDefines =
62+
static constexpr std::string_view =
6363
"#ifndef GL_FRAGMENT_PRECISION_HIGH\n"
6464
"#define highp mediump\n"
6565
"#endif\n"
6666
"precision highp float;\n";
6767
#endif
6868

69-
std::string code = qualifierDefines;
69+
std::string code = std::string{ qualifierDefines };
7070
code.append(sourceCode);
7171
const char* c_source = code.data();
7272
glShaderSource(m_shaderId, 1, &c_source, nullptr);

0 commit comments

Comments
 (0)