Commit 7c4e1472 authored by Markus Wick's avatar Markus Wick Committed by Eric Anholt

glamor: Always keep GL_ELEMENT_ARRAY_BUFFER bound to the same IB.

We never used glDrawElements() with a different index buffer.
Signed-off-by: Eric Anholt's avatarEric Anholt <eric@anholt.net>
Reviewed-by: Eric Anholt's avatarEric Anholt <eric@anholt.net>
parent 82168b1e
......@@ -218,9 +218,6 @@ _glamor_solid_boxes(PixmapPtr pixmap, BoxPtr box, int nbox, float *color)
}
}
if (_X_UNLIKELY(nbox > 1))
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, glamor_priv->ebo);
glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT,
GL_FALSE, 2 * sizeof(float), vertices);
glEnableVertexAttribArray(GLAMOR_VERTEX_POS);
......
......@@ -1121,7 +1121,6 @@ glamor_generate_radial_gradient_picture(ScreenPtr screen,
}
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
......@@ -1142,7 +1141,6 @@ glamor_generate_radial_gradient_picture(ScreenPtr screen,
}
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
......@@ -1472,7 +1470,6 @@ glamor_generate_linear_gradient_picture(ScreenPtr screen,
}
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
......@@ -1493,7 +1490,6 @@ glamor_generate_linear_gradient_picture(ScreenPtr screen,
}
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
......
......@@ -427,11 +427,9 @@ glamor_init_composite_shaders(ScreenPtr screen)
if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) {
glUnmapBuffer(GL_ELEMENT_ARRAY_BUFFER);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
}
else {
glBufferData(GL_ELEMENT_ARRAY_BUFFER, eb_size, eb, GL_STATIC_DRAW);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
free(eb);
}
......@@ -448,6 +446,7 @@ glamor_fini_composite_shaders(ScreenPtr screen)
glamor_priv = glamor_get_screen_private(screen);
glamor_get_context(glamor_priv);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
glDeleteBuffers(1, &glamor_priv->ebo);
for (i = 0; i < SHADER_SOURCE_COUNT; i++)
......@@ -706,8 +705,6 @@ glamor_setup_composite_vbo(ScreenPtr screen, int n_verts)
glamor_get_context(glamor_priv);
vb = glamor_get_vbo_space(screen, vert_size, &vbo_offset);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, glamor_priv->ebo);
glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT, GL_FALSE,
glamor_priv->vb_stride, vbo_offset);
glEnableVertexAttribArray(GLAMOR_VERTEX_POS);
......@@ -1329,7 +1326,6 @@ glamor_composite_with_shader(CARD8 op,
}
}
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
glDisableVertexAttribArray(GLAMOR_VERTEX_MASK);
......
......@@ -637,8 +637,6 @@ glamor_setup_composite_vbo_for_trapezoid(ScreenPtr screen, int n_verts)
vb = glamor_get_vbo_space(screen, vert_size, &vbo_offset);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, glamor_priv->ebo);
/* Set the vertex pointer. */
glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT,
GL_FALSE, glamor_priv->vb_stride,
......@@ -977,7 +975,6 @@ _glamor_trapezoids_with_shader(CARD8 op,
ret = TRUE;
TRAPEZOID_RESET_GL:
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
glDisableVertexAttribArray(GLAMOR_VERTEX_MASK);
......@@ -1415,8 +1412,6 @@ _glamor_generate_trapezoid_with_shader(ScreenPtr screen, PicturePtr picture,
pixmap_priv_get_dest_scale(pixmap_priv, (&xscale), (&yscale));
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
/* Now draw the Trapezoid mask. */
glUseProgram(trapezoid_prog);
......@@ -1562,7 +1557,6 @@ _glamor_generate_trapezoid_with_shader(ScreenPtr screen, PicturePtr picture,
}
}
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
glBlendFunc(GL_ONE, GL_ZERO);
glDisable(GL_BLEND);
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment