aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/glamor/glamor_render.c
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/glamor/glamor_render.c')
-rw-r--r--xorg-server/glamor/glamor_render.c29
1 files changed, 4 insertions, 25 deletions
diff --git a/xorg-server/glamor/glamor_render.c b/xorg-server/glamor/glamor_render.c
index c0ee22c2f..cdf8effdc 100644
--- a/xorg-server/glamor/glamor_render.c
+++ b/xorg-server/glamor/glamor_render.c
@@ -412,29 +412,10 @@ glamor_init_composite_shaders(ScreenPtr screen)
eb_size = GLAMOR_COMPOSITE_VBO_VERT_CNT * sizeof(short) * 2;
- if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) {
- glBufferData(GL_ELEMENT_ARRAY_BUFFER, eb_size, NULL, GL_STATIC_DRAW);
- eb = glMapBuffer(GL_ELEMENT_ARRAY_BUFFER, GL_WRITE_ONLY);
- }
- else {
- eb = malloc(eb_size);
- }
-
- if (eb == NULL)
- FatalError
- ("fatal error, fail to get element buffer. GL context may be not created correctly.\n");
+ eb = XNFalloc(eb_size);
glamor_init_eb(eb, GLAMOR_COMPOSITE_VBO_VERT_CNT);
-
- 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);
- }
+ glBufferData(GL_ELEMENT_ARRAY_BUFFER, eb_size, eb, GL_STATIC_DRAW);
+ free(eb);
glamor_put_context(glamor_priv);
}
@@ -448,6 +429,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 +688,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 +1309,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);