Commit 5512c14e authored by He Junyan's avatar He Junyan Committed by Eric Anholt

Fix the problem of VBO leak.

 In some cases we allocate the VBO but have no vertex to
 emit, which cause the VBO fail to be released. Fix it.
Signed-off-by: He Junyan's avatarJunyan He <junyan.he@linux.intel.com>
parent 9f78e22f
......@@ -826,9 +826,6 @@ glamor_flush_composite_rects(ScreenPtr screen)
glamor_get_screen_private(screen);
glamor_gl_dispatch *dispatch;
if (!glamor_priv->render_nr_verts)
return;
dispatch = glamor_get_dispatch(glamor_priv);
if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP)
dispatch->glUnmapBuffer(GL_ARRAY_BUFFER);
......@@ -840,6 +837,9 @@ glamor_flush_composite_rects(ScreenPtr screen)
glamor_priv->vb, GL_DYNAMIC_DRAW);
}
if (!glamor_priv->render_nr_verts)
return;
dispatch->glDrawElements(GL_TRIANGLES, (glamor_priv->render_nr_verts * 3) / 2,
GL_UNSIGNED_SHORT, NULL);
glamor_put_dispatch(glamor_priv);
......
......@@ -199,9 +199,6 @@ glamor_flush_composite_triangles(ScreenPtr screen)
glamor_get_screen_private(screen);
glamor_gl_dispatch *dispatch;
if (!glamor_priv->render_nr_verts)
return;
dispatch = glamor_get_dispatch(glamor_priv);
if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP)
dispatch->glUnmapBuffer(GL_ARRAY_BUFFER);
......@@ -213,6 +210,9 @@ glamor_flush_composite_triangles(ScreenPtr screen)
glamor_priv->vb, GL_DYNAMIC_DRAW);
}
if (!glamor_priv->render_nr_verts)
return;
dispatch->glDrawArrays(GL_TRIANGLES, 0, glamor_priv->render_nr_verts);
glamor_put_dispatch(glamor_priv);
}
......
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