mirror of
https://github.com/godotengine/godot-angle-static.git
synced 2026-01-06 02:09:55 +03:00
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>
This commit is contained in:
@@ -40,21 +40,18 @@ class MultiTextureSample : public SampleApplication
|
||||
|
||||
virtual bool initialize()
|
||||
{
|
||||
const std::string vs = SHADER_SOURCE
|
||||
(
|
||||
attribute vec4 a_position;
|
||||
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;
|
||||
const std::string fs =
|
||||
R"(precision mediump float;
|
||||
varying vec2 v_texCoord;
|
||||
uniform sampler2D s_baseMap;
|
||||
uniform sampler2D s_lightMap;
|
||||
@@ -66,8 +63,7 @@ class MultiTextureSample : public SampleApplication
|
||||
baseColor = texture2D(s_baseMap, v_texCoord);
|
||||
lightColor = texture2D(s_lightMap, v_texCoord);
|
||||
gl_FragColor = baseColor * (lightColor + 0.25);
|
||||
}
|
||||
);
|
||||
})";
|
||||
|
||||
mProgram = CompileProgram(vs, fs);
|
||||
if (!mProgram)
|
||||
|
||||
Reference in New Issue
Block a user