summaryrefslogtreecommitdiffstats
path: root/video/out/opengl/gl_utils.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2017-08-15 18:45:22 +0200
committerwm4 <wm4@nowhere>2017-08-15 18:59:59 +0200
commitb44e81d9c3c7a1597ba825997622d93033025aab (patch)
tree4fbccff8059224467c18897d817a25fe83a38540 /video/out/opengl/gl_utils.c
parent72a8120daac8136b8db7c720621bbe09e43cfe6c (diff)
downloadmpv-b44e81d9c3c7a1597ba825997622d93033025aab.tar.bz2
mpv-b44e81d9c3c7a1597ba825997622d93033025aab.tar.xz
vo_opengl: fix dangling pointers when VAOs are not available
This is for legacy GL: if VAOs are not available, the helper has to specify vertex attributes again on every rendering. gl_vao_init() keeps the vertex array for this purpose. Unfortunately, a temporary argument was passed to the function, instead of the permanent copy. Also, it didn't use num_entries (instead expected the array being terminated by a {0} entry). Fix that source code indentation too.
Diffstat (limited to 'video/out/opengl/gl_utils.c')
-rw-r--r--video/out/opengl/gl_utils.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/video/out/opengl/gl_utils.c b/video/out/opengl/gl_utils.c
index ab34eea2e5..6c0537febc 100644
--- a/video/out/opengl/gl_utils.c
+++ b/video/out/opengl/gl_utils.c
@@ -139,7 +139,7 @@ static void gl_vao_enable_attribs(struct gl_vao *vao)
GLenum type = 0;
bool normalized = false;
switch (e->type) {
- case RA_VARTYPE_INT:
+ case RA_VARTYPE_INT:
type = GL_INT;
break;
case RA_VARTYPE_FLOAT:
@@ -221,7 +221,7 @@ static void gl_vao_unbind(struct gl_vao *vao)
if (gl->BindVertexArray) {
gl->BindVertexArray(0);
} else {
- for (int n = 0; vao->entries[n].name; n++)
+ for (int n = 0; n < vao->num_entries; n++)
gl->DisableVertexAttribArray(n);
}
}