diff options
author | reveman@chromium.org <reveman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-09 03:39:05 +0000 |
---|---|---|
committer | reveman@chromium.org <reveman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-09 03:39:05 +0000 |
commit | 59bb8a3ea04a518bf907881d3d10e2f070416dbe (patch) | |
tree | a778df3e689b83e2cd0580f88171e183643a2434 /cc/output/gl_renderer.cc | |
parent | 6fd3b3f810a20b4a257eee9eb5ff32b23aebd758 (diff) | |
download | chromium_src-59bb8a3ea04a518bf907881d3d10e2f070416dbe.zip chromium_src-59bb8a3ea04a518bf907881d3d10e2f070416dbe.tar.gz chromium_src-59bb8a3ea04a518bf907881d3d10e2f070416dbe.tar.bz2 |
Re-land: cc: Cleanup vertex shaders used for anti-aliasing.
Splits VertexShaderQuad into VertexShaderQuad and VertexShaderQuadTex.
VertexShaderQuadTex is used for drawing textures and VertexShaderQuad is
used for solid color.
Use array indexing in VertexShaderQuad program.
BUG=238644
TEST=cc_unittests --gtest_filter=GLRendererPixelTest.AntiAliasing
R=enne@chromium.org
Review URL: https://chromiumcodereview.appspot.com/12720017
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@199091 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/output/gl_renderer.cc')
-rw-r--r-- | cc/output/gl_renderer.cc | 43 |
1 files changed, 20 insertions, 23 deletions
diff --git a/cc/output/gl_renderer.cc b/cc/output/gl_renderer.cc index f492b10d..34807ff 100644 --- a/cc/output/gl_renderer.cc +++ b/cc/output/gl_renderer.cc @@ -794,7 +794,7 @@ void GLRenderer::DrawRenderPassQuad(DrawingFrame* frame, GLC(Context(), Context()->uniform1i(program->fragment_shader().sampler_location(), 0)); - shader_quad_location = program->vertex_shader().point_location(); + shader_quad_location = program->vertex_shader().quad_location(); shader_edge_location = program->fragment_shader().edge_location(); shader_mask_sampler_location = program->fragment_shader().mask_sampler_location(); @@ -829,7 +829,7 @@ void GLRenderer::DrawRenderPassQuad(DrawingFrame* frame, GLC(Context(), Context()->uniform1i(program->fragment_shader().sampler_location(), 0)); - shader_quad_location = program->vertex_shader().point_location(); + shader_quad_location = program->vertex_shader().quad_location(); shader_edge_location = program->fragment_shader().edge_location(); shader_matrix_location = program->vertex_shader().matrix_location(); shader_alpha_location = program->fragment_shader().alpha_location(); @@ -842,7 +842,7 @@ void GLRenderer::DrawRenderPassQuad(DrawingFrame* frame, Context()->uniform1i(program->fragment_shader().sampler_location(), 0)); shader_matrix_location = program->vertex_shader().matrix_location(); - shader_quad_location = program->vertex_shader().point_location(); + shader_quad_location = program->vertex_shader().quad_location(); shader_tex_scale_location = program->vertex_shader().tex_scale_location(); shader_edge_location = program->fragment_shader().edge_location(); shader_alpha_location = program->fragment_shader().alpha_location(); @@ -864,7 +864,7 @@ void GLRenderer::DrawRenderPassQuad(DrawingFrame* frame, Context()->uniform1i(program->fragment_shader().sampler_location(), 0)); shader_matrix_location = program->vertex_shader().matrix_location(); - shader_quad_location = program->vertex_shader().point_location(); + shader_quad_location = program->vertex_shader().quad_location(); shader_tex_scale_location = program->vertex_shader().tex_scale_location(); shader_edge_location = program->fragment_shader().edge_location(); shader_alpha_location = program->fragment_shader().alpha_location(); @@ -1009,8 +1009,7 @@ struct SolidColorProgramUniforms { unsigned program; unsigned matrix_location; unsigned color_location; - unsigned point_location; - unsigned tex_scale_location; + unsigned quad_location; unsigned edge_location; }; @@ -1020,8 +1019,7 @@ static void SolidColorUniformLocation(T program, uniforms->program = program->program(); uniforms->matrix_location = program->vertex_shader().matrix_location(); uniforms->color_location = program->fragment_shader().color_location(); - uniforms->point_location = program->vertex_shader().point_location(); - uniforms->tex_scale_location = program->vertex_shader().tex_scale_location(); + uniforms->quad_location = program->vertex_shader().quad_location(); uniforms->edge_location = program->fragment_shader().edge_location(); } @@ -1112,7 +1110,6 @@ bool GLRenderer::SetupQuadForAntialiasing( void GLRenderer::DrawSolidColorQuad(const DrawingFrame* frame, const SolidColorDrawQuad* quad) { - SetBlendEnabled(quad->ShouldDrawWithBlending()); gfx::Rect tile_rect = quad->visible_rect; SkColor color = quad->color; @@ -1159,7 +1156,7 @@ void GLRenderer::DrawSolidColorQuad(const DrawingFrame* frame, // Normalize to tile_rect. local_quad.Scale(1.0f / tile_rect.width(), 1.0f / tile_rect.height()); - SetShaderQuadF(local_quad, uniforms.point_location); + SetShaderQuadF(local_quad, uniforms.quad_location); // The transform and vertex data are used to figure out the extents that the // un-antialiased quad should have and which vertex this is and the float @@ -1180,7 +1177,7 @@ struct TileProgramUniforms { unsigned edge_location; unsigned matrix_location; unsigned alpha_location; - unsigned point_location; + unsigned quad_location; }; template <class T> @@ -1189,7 +1186,7 @@ static void TileUniformLocation(T program, TileProgramUniforms* uniforms) { uniforms->vertex_tex_transform_location = program->vertex_shader().vertex_tex_transform_location(); uniforms->matrix_location = program->vertex_shader().matrix_location(); - uniforms->point_location = program->vertex_shader().point_location(); + uniforms->quad_location = program->vertex_shader().quad_location(); uniforms->sampler_location = program->fragment_shader().sampler_location(); uniforms->alpha_location = program->fragment_shader().alpha_location(); @@ -1353,7 +1350,7 @@ void GLRenderer::DrawContentQuad(const DrawingFrame* frame, local_quad.Scale(1.0f / tile_rect.width(), 1.0f / tile_rect.height()); SetShaderOpacity(quad->opacity(), uniforms.alpha_location); - SetShaderQuadF(local_quad, uniforms.point_location); + SetShaderQuadF(local_quad, uniforms.quad_location); // The transform and vertex data are used to figure out the extents that the // un-antialiased quad should have and which vertex this is and the float @@ -1820,16 +1817,16 @@ void GLRenderer::SetShaderQuadF(const gfx::QuadF& quad, int quad_location) { if (quad_location == -1) return; - float point[8]; - point[0] = quad.p1().x(); - point[1] = quad.p1().y(); - point[2] = quad.p2().x(); - point[3] = quad.p2().y(); - point[4] = quad.p3().x(); - point[5] = quad.p3().y(); - point[6] = quad.p4().x(); - point[7] = quad.p4().y(); - GLC(context_, context_->uniform2fv(quad_location, 4, point)); + float gl_quad[8]; + gl_quad[0] = quad.p1().x(); + gl_quad[1] = quad.p1().y(); + gl_quad[2] = quad.p2().x(); + gl_quad[3] = quad.p2().y(); + gl_quad[4] = quad.p3().x(); + gl_quad[5] = quad.p3().y(); + gl_quad[6] = quad.p4().x(); + gl_quad[7] = quad.p4().y(); + GLC(context_, context_->uniform2fv(quad_location, 4, gl_quad)); } void GLRenderer::SetShaderOpacity(float opacity, int alpha_location) { |