Chromium Code Reviews| Index: cc/output/shader.cc | 
| diff --git a/cc/output/shader.cc b/cc/output/shader.cc | 
| index d70352f58c38e937285cb32e0e2aaa20eeeba561..474e539b79d979dc7daa3e1bea28014b8ddf5a17 100644 | 
| --- a/cc/output/shader.cc | 
| +++ b/cc/output/shader.cc | 
| @@ -913,6 +913,83 @@ std::string FragmentShaderYUVVideo::GetShaderString() const { | 
| ); | 
| } | 
| +FragmentShaderYUVAVideo::FragmentShaderYUVAVideo() | 
| + : y_texture_location_(-1) | 
| 
 
enne (OOO)
2013/04/04 22:08:44
style nit: commas don't go at the beginning of lin
 
vignesh
2013/04/05 22:00:28
Done.
 
 | 
| + , u_texture_location_(-1) | 
| + , v_texture_location_(-1) | 
| + , a_texture_location_(-1) | 
| + , alpha_location_(-1) | 
| + , yuv_matrix_location_(-1) | 
| + , yuv_adj_location_(-1) | 
| +{ | 
| +} | 
| + | 
| +void FragmentShaderYUVAVideo::Init(WebGraphicsContext3D* context, | 
| + unsigned program, | 
| + bool using_bind_uniform, | 
| + int* base_uniform_index) | 
| +{ | 
| 
 
enne (OOO)
2013/04/04 22:08:44
style nit: { goes on the previous line.  How did t
 
vignesh
2013/04/05 22:00:28
Sorry, but i did not get any presubmit warnings. N
 
 | 
| + static const char* shader_uniforms[] = { | 
| 
 
enne (OOO)
2013/04/04 22:08:44
style nit: don't use a 4 space indent
 
vignesh
2013/04/05 22:00:28
Done.
 
 | 
| + "y_texture", | 
| + "u_texture", | 
| + "v_texture", | 
| + "a_texture", | 
| + "alpha", | 
| + "cc_matrix", | 
| + "yuv_adj", | 
| + }; | 
| + int locations[7]; | 
| + | 
| + GetProgramUniformLocations(context, | 
| + program, | 
| + shader_uniforms, | 
| + arraysize(shader_uniforms), | 
| + arraysize(locations), | 
| + locations, | 
| + using_bind_uniform, | 
| + base_uniform_index); | 
| + | 
| + y_texture_location_ = locations[0]; | 
| + u_texture_location_ = locations[1]; | 
| + v_texture_location_ = locations[2]; | 
| + a_texture_location_ = locations[3]; | 
| + alpha_location_ = locations[4]; | 
| + yuv_matrix_location_ = locations[5]; | 
| + yuv_adj_location_ = locations[6]; | 
| + | 
| + DCHECK(y_texture_location_ != -1 && u_texture_location_ != -1 && | 
| + v_texture_location_ != -1 && a_texture_location_ != -1 && | 
| + alpha_location_ != -1 && yuv_matrix_location_ != -1 && | 
| + yuv_adj_location_ != -1); | 
| +} | 
| + | 
| +std::string FragmentShaderYUVAVideo::GetShaderString() const | 
| +{ | 
| + return SHADER( | 
| + precision mediump float; | 
| + precision mediump int; | 
| + varying vec2 y_texCoord; | 
| + varying vec2 uv_texCoord; | 
| 
 
enne (OOO)
2013/04/04 22:08:44
What does this second varying parameter get hooked
 
 | 
| + uniform sampler2D y_texture; | 
| + uniform sampler2D u_texture; | 
| + uniform sampler2D v_texture; | 
| + uniform sampler2D a_texture; | 
| + uniform float alpha; | 
| + uniform vec3 yuv_adj; | 
| + uniform mat3 cc_matrix; | 
| + void main() | 
| + { | 
| + float y_raw = texture2D(y_texture, y_texCoord).x; | 
| + float u_unsigned = texture2D(u_texture, uv_texCoord).x; | 
| + float v_unsigned = texture2D(v_texture, uv_texCoord).x; | 
| + float a_raw = texture2D(a_texture, y_texCoord).x; | 
| + vec3 yuv = vec3(y_raw, u_unsigned, v_unsigned) + yuv_adj; | 
| + vec3 rgb = cc_matrix * yuv; | 
| + gl_FragColor = vec4(rgb, float(1)) * (a_raw * alpha); | 
| + } | 
| + ); | 
| +} | 
| + | 
| FragmentShaderColor::FragmentShaderColor() | 
| : color_location_(-1) {} |