Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1867)

Side by Side Diff: cc/ShaderChromium.cpp

Issue 10968047: cc_unittests fails on several platforms with 158148 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/ShaderChromium.h ('k') | cc/TiledLayerChromium.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "config.h" 5 #include "config.h"
6 6
7 #if USE(ACCELERATED_COMPOSITING) 7 #if USE(ACCELERATED_COMPOSITING)
8 8
9 #include "ShaderChromium.h" 9 #include "ShaderChromium.h"
10 10
(...skipping 828 matching lines...) Expand 10 before | Expand all | Expand 10 after
839 , m_frequencyLocation(-1) 839 , m_frequencyLocation(-1)
840 { 840 {
841 } 841 }
842 842
843 void FragmentShaderCheckerboard::init(WebGraphicsContext3D* context, unsigned pr ogram, bool usingBindUniform, int* baseUniformIndex) 843 void FragmentShaderCheckerboard::init(WebGraphicsContext3D* context, unsigned pr ogram, bool usingBindUniform, int* baseUniformIndex)
844 { 844 {
845 static const char* shaderUniforms[] = { 845 static const char* shaderUniforms[] = {
846 "alpha", 846 "alpha",
847 "texTransform", 847 "texTransform",
848 "frequency", 848 "frequency",
849 "color",
850 }; 849 };
851 int locations[4]; 850 int locations[3];
852 851
853 getProgramUniformLocations(context, program, shaderUniforms, WTF_ARRAY_LENGT H(shaderUniforms), WTF_ARRAY_LENGTH(locations), locations, usingBindUniform, bas eUniformIndex); 852 getProgramUniformLocations(context, program, shaderUniforms, WTF_ARRAY_LENGT H(shaderUniforms), WTF_ARRAY_LENGTH(locations), locations, usingBindUniform, bas eUniformIndex);
854 853
855 m_alphaLocation = locations[0]; 854 m_alphaLocation = locations[0];
856 m_texTransformLocation = locations[1]; 855 m_texTransformLocation = locations[1];
857 m_frequencyLocation = locations[2]; 856 m_frequencyLocation = locations[2];
858 m_colorLocation = locations[3]; 857 ASSERT(m_alphaLocation != -1 && m_texTransformLocation != -1 && m_frequencyL ocation != -1);
859 ASSERT(m_alphaLocation != -1 && m_texTransformLocation != -1 && m_frequencyL ocation != -1 && m_colorLocation != -1);
860 } 858 }
861 859
862 std::string FragmentShaderCheckerboard::getShaderString() const 860 std::string FragmentShaderCheckerboard::getShaderString() const
863 { 861 {
864 // Shader based on Example 13-17 of "OpenGL ES 2.0 Programming Guide" 862 // Shader based on Example 13-17 of "OpenGL ES 2.0 Programming Guide"
865 // by Munshi, Ginsburg, Shreiner. 863 // by Munshi, Ginsburg, Shreiner.
866 return SHADER( 864 return SHADER(
867 precision mediump float; 865 precision mediump float;
868 precision mediump int; 866 precision mediump int;
869 varying vec2 v_texCoord; 867 varying vec2 v_texCoord;
870 uniform float alpha; 868 uniform float alpha;
871 uniform float frequency; 869 uniform float frequency;
872 uniform vec4 texTransform; 870 uniform vec4 texTransform;
873 uniform vec4 color;
874 void main() 871 void main()
875 { 872 {
876 vec4 color1 = vec4(1.0, 1.0, 1.0, 1.0); 873 vec4 color1 = vec4(1.0, 1.0, 1.0, 1.0);
877 vec4 color2 = color; 874 vec4 color2 = vec4(0.945, 0.945, 0.945, 1.0);
878 vec2 texCoord = clamp(v_texCoord, 0.0, 1.0) * texTransform.zw + texT ransform.xy; 875 vec2 texCoord = clamp(v_texCoord, 0.0, 1.0) * texTransform.zw + texT ransform.xy;
879 vec2 coord = mod(floor(texCoord * frequency * 2.0), 2.0); 876 vec2 coord = mod(floor(texCoord * frequency * 2.0), 2.0);
880 float picker = abs(coord.x - coord.y); 877 float picker = abs(coord.x - coord.y);
881 gl_FragColor = mix(color1, color2, picker) * alpha; 878 gl_FragColor = mix(color1, color2, picker) * alpha;
882 } 879 }
883 ); 880 );
884 } 881 }
885 882
886 } // namespace cc 883 } // namespace cc
887 884
888 #endif // USE(ACCELERATED_COMPOSITING) 885 #endif // USE(ACCELERATED_COMPOSITING)
OLDNEW
« no previous file with comments | « cc/ShaderChromium.h ('k') | cc/TiledLayerChromium.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698