glamor: Select VBO path by ARB_mbr extension.
The mbr path was hard coded enabled for desktop gl and disabled for gles. But there are both desktop without mbr and GLES with mbr. v2: Don't forget to update the fini path, too (change by anholt) Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Eric Anholt <eric@anholt.net>
This commit is contained in:
parent
53df6e8c3b
commit
82168b1e6e
|
@ -378,6 +378,8 @@ glamor_init(ScreenPtr screen, unsigned int flags)
|
||||||
epoxy_has_gl_extension("GL_MESA_pack_invert");
|
epoxy_has_gl_extension("GL_MESA_pack_invert");
|
||||||
glamor_priv->has_fbo_blit =
|
glamor_priv->has_fbo_blit =
|
||||||
epoxy_has_gl_extension("GL_EXT_framebuffer_blit");
|
epoxy_has_gl_extension("GL_EXT_framebuffer_blit");
|
||||||
|
glamor_priv->has_map_buffer_range =
|
||||||
|
epoxy_has_gl_extension("GL_ARB_map_buffer_range");
|
||||||
glamor_priv->has_buffer_storage =
|
glamor_priv->has_buffer_storage =
|
||||||
epoxy_has_gl_extension("GL_ARB_buffer_storage");
|
epoxy_has_gl_extension("GL_ARB_buffer_storage");
|
||||||
glGetIntegerv(GL_MAX_RENDERBUFFER_SIZE, &glamor_priv->max_fbo_size);
|
glGetIntegerv(GL_MAX_RENDERBUFFER_SIZE, &glamor_priv->max_fbo_size);
|
||||||
|
|
|
@ -213,6 +213,7 @@ typedef struct glamor_screen_private {
|
||||||
enum glamor_gl_flavor gl_flavor;
|
enum glamor_gl_flavor gl_flavor;
|
||||||
int has_pack_invert;
|
int has_pack_invert;
|
||||||
int has_fbo_blit;
|
int has_fbo_blit;
|
||||||
|
int has_map_buffer_range;
|
||||||
int has_buffer_storage;
|
int has_buffer_storage;
|
||||||
int has_khr_debug;
|
int has_khr_debug;
|
||||||
int max_fbo_size;
|
int max_fbo_size;
|
||||||
|
|
|
@ -96,7 +96,7 @@ glamor_get_vbo_space(ScreenPtr screen, unsigned size, char **vbo_offset)
|
||||||
*vbo_offset = (void *)(uintptr_t)glamor_priv->vbo_offset;
|
*vbo_offset = (void *)(uintptr_t)glamor_priv->vbo_offset;
|
||||||
data = glamor_priv->vb + glamor_priv->vbo_offset;
|
data = glamor_priv->vb + glamor_priv->vbo_offset;
|
||||||
glamor_priv->vbo_offset += size;
|
glamor_priv->vbo_offset += size;
|
||||||
} else if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) {
|
} else if (glamor_priv->has_map_buffer_range) {
|
||||||
if (glamor_priv->vbo_size < glamor_priv->vbo_offset + size) {
|
if (glamor_priv->vbo_size < glamor_priv->vbo_offset + size) {
|
||||||
glamor_priv->vbo_size = MAX(GLAMOR_VBO_SIZE, size);
|
glamor_priv->vbo_size = MAX(GLAMOR_VBO_SIZE, size);
|
||||||
glamor_priv->vbo_offset = 0;
|
glamor_priv->vbo_offset = 0;
|
||||||
|
@ -147,7 +147,7 @@ glamor_put_vbo_space(ScreenPtr screen)
|
||||||
* persistent mapping, so we can leave it around until we
|
* persistent mapping, so we can leave it around until we
|
||||||
* reach the end of the buffer.
|
* reach the end of the buffer.
|
||||||
*/
|
*/
|
||||||
} else if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) {
|
} else if (glamor_priv->has_map_buffer_range) {
|
||||||
glUnmapBuffer(GL_ARRAY_BUFFER);
|
glUnmapBuffer(GL_ARRAY_BUFFER);
|
||||||
} else {
|
} else {
|
||||||
glBufferData(GL_ARRAY_BUFFER, glamor_priv->vbo_offset,
|
glBufferData(GL_ARRAY_BUFFER, glamor_priv->vbo_offset,
|
||||||
|
@ -179,7 +179,7 @@ glamor_fini_vbo(ScreenPtr screen)
|
||||||
glamor_get_context(glamor_priv);
|
glamor_get_context(glamor_priv);
|
||||||
|
|
||||||
glDeleteBuffers(1, &glamor_priv->vbo);
|
glDeleteBuffers(1, &glamor_priv->vbo);
|
||||||
if (glamor_priv->gl_flavor != GLAMOR_GL_DESKTOP)
|
if (!glamor_priv->has_map_buffer_range)
|
||||||
free(glamor_priv->vb);
|
free(glamor_priv->vb);
|
||||||
|
|
||||||
glamor_put_context(glamor_priv);
|
glamor_put_context(glamor_priv);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user