OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "cc/output/shader.h" | 5 #include "cc/output/shader.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "cc/output/gl_renderer.h" // For the GLC() macro. | 11 #include "cc/output/gl_renderer.h" // For the GLC() macro. |
12 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" | 12 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" |
13 #include "third_party/khronos/GLES2/gl2.h" | 13 #include "third_party/khronos/GLES2/gl2.h" |
14 | 14 |
15 #define SHADER0(Src) #Src | 15 #define SHADER0(Src) #Src |
16 #define VERTEX_SHADER(Src) SetVertexTexCoordPrecision(SHADER0(Src)) | 16 #define VERTEX_SHADER(Src) SetVertexTexCoordPrecision(SHADER0(Src)) |
17 #define FRAGMENT_SHADER(Src) SetFragTexCoordPrecision(precision, SHADER0(Src)) | 17 #define FRAGMENT_SHADER(Src) SetFragTexCoordPrecision(precision, SHADER0(Src)) |
18 | 18 |
19 using WebKit::WebGraphicsContext3D; | 19 using blink::WebGraphicsContext3D; |
20 | 20 |
21 namespace cc { | 21 namespace cc { |
22 | 22 |
23 namespace { | 23 namespace { |
24 | 24 |
25 static void GetProgramUniformLocations(WebGraphicsContext3D* context, | 25 static void GetProgramUniformLocations(WebGraphicsContext3D* context, |
26 unsigned program, | 26 unsigned program, |
27 size_t count, | 27 size_t count, |
28 const char** uniforms, | 28 const char** uniforms, |
29 int* locations, | 29 int* locations, |
(...skipping 1507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1537 vec2 texCoord = | 1537 vec2 texCoord = |
1538 clamp(v_texCoord, 0.0, 1.0) * texTransform.zw + texTransform.xy; | 1538 clamp(v_texCoord, 0.0, 1.0) * texTransform.zw + texTransform.xy; |
1539 vec2 coord = mod(floor(texCoord * frequency * 2.0), 2.0); | 1539 vec2 coord = mod(floor(texCoord * frequency * 2.0), 2.0); |
1540 float picker = abs(coord.x - coord.y); // NOLINT | 1540 float picker = abs(coord.x - coord.y); // NOLINT |
1541 gl_FragColor = mix(color1, color2, picker) * alpha; | 1541 gl_FragColor = mix(color1, color2, picker) * alpha; |
1542 } | 1542 } |
1543 ); // NOLINT(whitespace/parens) | 1543 ); // NOLINT(whitespace/parens) |
1544 } | 1544 } |
1545 | 1545 |
1546 } // namespace cc | 1546 } // namespace cc |
OLD | NEW |