glamor: Drop the non-VAO rendering path
GLES spells this extension as GL_OES_vertex_array_object, but it is functionally equivalent to the GL_ARB version. Mesa has supported both since 9.0, let's go ahead and require it. Signed-off-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Eric Anholt <eric@anholt.net>
This commit is contained in:
parent
dbda03d5d1
commit
66e8eaa456
|
@ -579,6 +579,12 @@ glamor_init(ScreenPtr screen, unsigned int flags)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!epoxy_has_gl_extension("GL_ARB_vertex_array_object") &&
|
||||||
|
!epoxy_has_gl_extension("GL_OES_vertex_array_object")) {
|
||||||
|
ErrorF("GL_{ARB,OES}_vertex_array_object required\n");
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
|
||||||
glamor_priv->has_rw_pbo = FALSE;
|
glamor_priv->has_rw_pbo = FALSE;
|
||||||
if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP)
|
if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP)
|
||||||
glamor_priv->has_rw_pbo = TRUE;
|
glamor_priv->has_rw_pbo = TRUE;
|
||||||
|
@ -605,8 +611,6 @@ glamor_init(ScreenPtr screen, unsigned int flags)
|
||||||
glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP ||
|
glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP ||
|
||||||
epoxy_gl_version() >= 30 ||
|
epoxy_gl_version() >= 30 ||
|
||||||
epoxy_has_gl_extension("GL_NV_pack_subimage");
|
epoxy_has_gl_extension("GL_NV_pack_subimage");
|
||||||
glamor_priv->has_vertex_array_object =
|
|
||||||
epoxy_has_gl_extension("GL_ARB_vertex_array_object");
|
|
||||||
glamor_priv->has_dual_blend =
|
glamor_priv->has_dual_blend =
|
||||||
epoxy_has_gl_extension("GL_ARB_blend_func_extended");
|
epoxy_has_gl_extension("GL_ARB_blend_func_extended");
|
||||||
|
|
||||||
|
|
|
@ -197,7 +197,6 @@ typedef struct glamor_screen_private {
|
||||||
Bool has_unpack_subimage;
|
Bool has_unpack_subimage;
|
||||||
Bool has_rw_pbo;
|
Bool has_rw_pbo;
|
||||||
Bool use_quads;
|
Bool use_quads;
|
||||||
Bool has_vertex_array_object;
|
|
||||||
Bool has_dual_blend;
|
Bool has_dual_blend;
|
||||||
Bool has_texture_swizzle;
|
Bool has_texture_swizzle;
|
||||||
Bool is_core_profile;
|
Bool is_core_profile;
|
||||||
|
|
|
@ -174,11 +174,8 @@ glamor_init_vbo(ScreenPtr screen)
|
||||||
glamor_make_current(glamor_priv);
|
glamor_make_current(glamor_priv);
|
||||||
|
|
||||||
glGenBuffers(1, &glamor_priv->vbo);
|
glGenBuffers(1, &glamor_priv->vbo);
|
||||||
if (glamor_priv->has_vertex_array_object) {
|
glGenVertexArrays(1, &glamor_priv->vao);
|
||||||
glGenVertexArrays(1, &glamor_priv->vao);
|
glBindVertexArray(glamor_priv->vao);
|
||||||
glBindVertexArray(glamor_priv->vao);
|
|
||||||
} else
|
|
||||||
glamor_priv->vao = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -188,10 +185,8 @@ glamor_fini_vbo(ScreenPtr screen)
|
||||||
|
|
||||||
glamor_make_current(glamor_priv);
|
glamor_make_current(glamor_priv);
|
||||||
|
|
||||||
if (glamor_priv->vao != 0) {
|
glDeleteVertexArrays(1, &glamor_priv->vao);
|
||||||
glDeleteVertexArrays(1, &glamor_priv->vao);
|
glamor_priv->vao = 0;
|
||||||
glamor_priv->vao = 0;
|
|
||||||
}
|
|
||||||
if (!glamor_priv->has_map_buffer_range)
|
if (!glamor_priv->has_map_buffer_range)
|
||||||
free(glamor_priv->vb);
|
free(glamor_priv->vb);
|
||||||
}
|
}
|
||||||
|
|
|
@ -208,13 +208,6 @@ ephyr_glamor_set_vertices(struct ephyr_glamor *glamor)
|
||||||
glEnableVertexAttribArray(glamor->texture_shader_texcoord_loc);
|
glEnableVertexAttribArray(glamor->texture_shader_texcoord_loc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
ephyr_glamor_clear_vertices(struct ephyr_glamor *glamor)
|
|
||||||
{
|
|
||||||
glDisableVertexAttribArray(glamor->texture_shader_position_loc);
|
|
||||||
glDisableVertexAttribArray(glamor->texture_shader_texcoord_loc);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ephyr_glamor_damage_redisplay(struct ephyr_glamor *glamor,
|
ephyr_glamor_damage_redisplay(struct ephyr_glamor *glamor,
|
||||||
struct pixman_region16 *damage)
|
struct pixman_region16 *damage)
|
||||||
|
@ -230,13 +223,8 @@ ephyr_glamor_damage_redisplay(struct ephyr_glamor *glamor,
|
||||||
|
|
||||||
glXMakeCurrent(dpy, glamor->glx_win, glamor->ctx);
|
glXMakeCurrent(dpy, glamor->glx_win, glamor->ctx);
|
||||||
|
|
||||||
if (glamor->vao) {
|
glGetIntegerv(GL_VERTEX_ARRAY_BINDING, &old_vao);
|
||||||
glGetIntegerv(GL_VERTEX_ARRAY_BINDING, &old_vao);
|
glBindVertexArray(glamor->vao);
|
||||||
glBindVertexArray(glamor->vao);
|
|
||||||
} else {
|
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, glamor->vbo);
|
|
||||||
ephyr_glamor_set_vertices(glamor);
|
|
||||||
}
|
|
||||||
|
|
||||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||||
glUseProgram(glamor->texture_shader);
|
glUseProgram(glamor->texture_shader);
|
||||||
|
@ -248,10 +236,7 @@ ephyr_glamor_damage_redisplay(struct ephyr_glamor *glamor,
|
||||||
glBindTexture(GL_TEXTURE_2D, glamor->tex);
|
glBindTexture(GL_TEXTURE_2D, glamor->tex);
|
||||||
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||||
|
|
||||||
if (glamor->vao)
|
glBindVertexArray(old_vao);
|
||||||
glBindVertexArray(old_vao);
|
|
||||||
else
|
|
||||||
ephyr_glamor_clear_vertices(glamor);
|
|
||||||
|
|
||||||
glXSwapBuffers(dpy, glamor->glx_win);
|
glXSwapBuffers(dpy, glamor->glx_win);
|
||||||
}
|
}
|
||||||
|
@ -374,23 +359,17 @@ ephyr_glamor_glx_screen_init(xcb_window_t win)
|
||||||
glamor->glx_win = glx_win;
|
glamor->glx_win = glx_win;
|
||||||
ephyr_glamor_setup_texturing_shader(glamor);
|
ephyr_glamor_setup_texturing_shader(glamor);
|
||||||
|
|
||||||
if (epoxy_has_gl_extension("GL_ARB_vertex_array_object")) {
|
glGenVertexArrays(1, &glamor->vao);
|
||||||
glGenVertexArrays(1, &glamor->vao);
|
glGetIntegerv(GL_VERTEX_ARRAY_BINDING, &old_vao);
|
||||||
glGetIntegerv(GL_VERTEX_ARRAY_BINDING, &old_vao);
|
glBindVertexArray(glamor->vao);
|
||||||
glBindVertexArray(glamor->vao);
|
|
||||||
} else
|
|
||||||
glamor->vao = 0;
|
|
||||||
|
|
||||||
glGenBuffers(1, &glamor->vbo);
|
glGenBuffers(1, &glamor->vbo);
|
||||||
|
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, glamor->vbo);
|
glBindBuffer(GL_ARRAY_BUFFER, glamor->vbo);
|
||||||
glBufferData(GL_ARRAY_BUFFER, sizeof (position), position, GL_STATIC_DRAW);
|
glBufferData(GL_ARRAY_BUFFER, sizeof (position), position, GL_STATIC_DRAW);
|
||||||
|
|
||||||
if (glamor->vao) {
|
ephyr_glamor_set_vertices(glamor);
|
||||||
ephyr_glamor_set_vertices(glamor);
|
glBindVertexArray(old_vao);
|
||||||
glBindVertexArray(old_vao);
|
|
||||||
} else
|
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
|
||||||
|
|
||||||
return glamor;
|
return glamor;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue