glamor: don't reset the GLSL program

We don't use fixed function rendering, so there is no need to reset
the program at all.  This lets the driver avoid checking for state
changes between draw calls when we rebind the same program.

Improves xephyr x11perf -f8text performance by 6.03062% +/- 1.64928%
(n=20)

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
This commit is contained in:
Markus Wick 2014-03-13 11:17:39 +01:00 committed by Eric Anholt
parent aa2635b804
commit 9999a66013
10 changed files with 0 additions and 24 deletions

View File

@ -205,7 +205,6 @@ glamor_copy_n_to_n_textured(DrawablePtr src,
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
glUseProgram(0);
/* The source texture is bound to a fbo, we have to flush it here. */
glamor_put_context(glamor_priv);
glamor_priv->state = RENDER_STATE;

View File

@ -289,7 +289,6 @@ glamor_init_finish_access_shaders(ScreenPtr screen)
glUniform1i(sampler_uniform_location, 0);
glUniform1i(glamor_priv->finish_access_revert[0], 0);
glUniform1i(glamor_priv->finish_access_swap_rb[0], 0);
glUseProgram(0);
glamor_priv->finish_access_revert[1] =
glGetUniformLocation(glamor_priv->finish_access_prog[1], "revert");
@ -301,7 +300,6 @@ glamor_init_finish_access_shaders(ScreenPtr screen)
glUniform1i(glamor_priv->finish_access_revert[1], 0);
glUniform1i(sampler_uniform_location, 0);
glUniform1i(glamor_priv->finish_access_swap_rb[1], 0);
glUseProgram(0);
glamor_put_context(glamor_priv);
}

View File

@ -258,7 +258,6 @@ _glamor_solid_boxes(PixmapPtr pixmap, BoxPtr box, int nbox, float *color)
free(vertices);
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
glUseProgram(0);
glamor_put_context(glamor_priv);
glamor_priv->state = RENDER_STATE;
glamor_priv->render_idle_cnt = 0;

View File

@ -156,7 +156,6 @@ glamor_poly_glyph_blt_pixels(DrawablePtr drawable, GCPtr gc,
}
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
glUseProgram(0);
glamor_put_context(glamor_priv);
@ -328,7 +327,6 @@ glamor_push_pixels_points(GCPtr gc, PixmapPtr bitmap,
glDrawArrays(GL_POINTS, 0, num_points);
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
glUseProgram(0);
glamor_put_context(glamor_priv);

View File

@ -379,8 +379,6 @@ _glamor_create_radial_gradient_program(ScreenPtr screen, int stops_count,
glamor_link_glsl_prog(screen, gradient_prog, "radial gradient");
glUseProgram(0);
if (dyn_gen) {
index = 2;
glamor_priv->radial_max_nstops = stops_count;
@ -592,8 +590,6 @@ _glamor_create_linear_gradient_program(ScreenPtr screen, int stops_count,
glamor_link_glsl_prog(screen, gradient_prog, "linear gradient");
glUseProgram(0);
if (dyn_gen) {
index = 2;
glamor_priv->linear_max_nstops = stops_count;
@ -1169,7 +1165,6 @@ glamor_generate_radial_gradient_picture(ScreenPtr screen,
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
glUseProgram(0);
glamor_put_context(glamor_priv);
return dst_picture;
@ -1191,7 +1186,6 @@ glamor_generate_radial_gradient_picture(ScreenPtr screen,
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
glUseProgram(0);
glamor_put_context(glamor_priv);
return NULL;
}
@ -1522,7 +1516,6 @@ glamor_generate_linear_gradient_picture(ScreenPtr screen,
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
glUseProgram(0);
glamor_put_context(glamor_priv);
return dst_picture;
@ -1544,7 +1537,6 @@ glamor_generate_linear_gradient_picture(ScreenPtr screen,
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
glUseProgram(0);
glamor_put_context(glamor_priv);
return NULL;
}

View File

@ -856,7 +856,6 @@ _glamor_upload_bits_to_pixmap_texture(PixmapPtr pixmap, GLenum format,
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
glUseProgram(0);
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
glDeleteTextures(1, &tex);
@ -1181,7 +1180,6 @@ glamor_es2_pixmap_read_prepare(PixmapPtr source, int x, int y, int w, int h,
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
glUseProgram(0);
glamor_put_context(glamor_priv);
return temp_fbo;
}

View File

@ -1335,7 +1335,6 @@ glamor_composite_with_shader(CARD8 op,
glDisableVertexAttribArray(GLAMOR_VERTEX_MASK);
glDisable(GL_BLEND);
DEBUGF("finish rendering.\n");
glUseProgram(0);
glamor_priv->state = RENDER_STATE;
glamor_priv->render_idle_cnt = 0;
if (saved_source_format)

View File

@ -82,7 +82,6 @@ glamor_init_tile_shader(ScreenPtr screen)
glamor_priv->tile_wh =
glGetUniformLocation(glamor_priv->tile_prog, "wh");
glUseProgram(0);
glamor_put_context(glamor_priv);
}
@ -156,7 +155,6 @@ _glamor_tile(PixmapPtr pixmap, PixmapPtr tile,
glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
glUseProgram(0);
glamor_put_context(glamor_priv);
glamor_priv->state = RENDER_STATE;

View File

@ -982,7 +982,6 @@ _glamor_trapezoids_with_shader(CARD8 op,
glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
glDisableVertexAttribArray(GLAMOR_VERTEX_MASK);
glDisable(GL_BLEND);
glUseProgram(0);
glamor_put_context(glamor_priv);
TRAPEZOID_OUT:
@ -1359,8 +1358,6 @@ glamor_init_trapezoid_shader(ScreenPtr screen)
glamor_link_glsl_prog(screen, glamor_priv->trapezoid_prog, "trapezoid");
glUseProgram(0);
glamor_put_context(glamor_priv);
}
@ -1573,7 +1570,6 @@ _glamor_generate_trapezoid_with_shader(ScreenPtr screen, PicturePtr picture,
glDisableVertexAttribArray(GLAMOR_VERTEX_TOP_BOTTOM);
glDisableVertexAttribArray(GLAMOR_VERTEX_LEFT_PARAM);
glDisableVertexAttribArray(GLAMOR_VERTEX_RIGHT_PARAM);
glUseProgram(0);
glamor_put_context(glamor_priv);
return TRUE;
}

View File

@ -416,7 +416,6 @@ glamor_display_textured_video(glamor_port_private *port_priv)
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
glUseProgram(0);
glamor_put_context(glamor_priv);
DamageDamageRegion(port_priv->pDraw, &port_priv->clip);
}