diff options
author | Olli Etuaho <oetuaho@nvidia.com> | 2017-09-18 13:32:29 +0300 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2017-09-18 15:08:15 +0000 |
commit | a20af6d7e88129d571543f3e3eab6993adf87bc6 (patch) | |
tree | 7d8cff7d5617cf58439cea082d92530e39bbdbef /samples/texture_wrap | |
parent | bb5a7e29d2cccf9b10f010913a368037313a7118 (diff) | |
download | angle-a20af6d7e88129d571543f3e3eab6993adf87bc6.tar.gz |
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>
Diffstat (limited to 'samples/texture_wrap')
-rw-r--r-- | samples/texture_wrap/TextureWrap.cpp | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/samples/texture_wrap/TextureWrap.cpp b/samples/texture_wrap/TextureWrap.cpp index 92bb31bc00..e52ca4858f 100644 --- a/samples/texture_wrap/TextureWrap.cpp +++ b/samples/texture_wrap/TextureWrap.cpp @@ -27,9 +27,8 @@ class TextureWrapSample : public SampleApplication virtual bool initialize() { - const std::string vs = SHADER_SOURCE - ( - uniform float u_offset; + const std::string vs = + R"(uniform float u_offset; attribute vec4 a_position; attribute vec2 a_texCoord; varying vec2 v_texCoord; @@ -38,19 +37,16 @@ class TextureWrapSample : public SampleApplication gl_Position = a_position; gl_Position.x += u_offset; 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_texture; void main() { gl_FragColor = texture2D(s_texture, v_texCoord); - } - ); + })"; mProgram = CompileProgram(vs, fs); if (!mProgram) |