summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-02-24 13:48:09 +0100
committerwm4 <wm4@nowhere>2015-02-24 13:48:09 +0100
commitcc011415ffb10521260e486a41b56d0080bf2cd9 (patch)
tree532e7fb3f3fc80e7e831fc046f0d094b0023a94d /video
parent2c8d16d89f6f64a587222dd53a3d27b2a218ee01 (diff)
downloadmpv-cc011415ffb10521260e486a41b56d0080bf2cd9.tar.bz2
mpv-cc011415ffb10521260e486a41b56d0080bf2cd9.tar.xz
vo_opengl: another GLES2 issue
GLES2 randomly does not support the transpose parameter in matrix uniform calls. So we have to do this manually. Sure it was worth to mutilate the standard just so all these shitty SoC vendors can safe 3 lines of code. (Obviously trying to handle all of GLES2 to GL 4.x in a single codebase was a mistake.)
Diffstat (limited to 'video')
-rw-r--r--video/out/gl_video.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/video/out/gl_video.c b/video/out/gl_video.c
index f72ca6a8ab..82b5a24287 100644
--- a/video/out/gl_video.c
+++ b/video/out/gl_video.c
@@ -506,6 +506,13 @@ static void draw_quad(struct gl_video *p,
debug_check_gl(p, "after rendering");
}
+static void transpose3x3(float r[3][3])
+{
+ MPSWAP(float, r[0][1], r[1][0]);
+ MPSWAP(float, r[0][2], r[2][0]);
+ MPSWAP(float, r[1][2], r[2][1]);
+}
+
static void update_uniforms(struct gl_video *p, GLuint program)
{
GL *gl = p->gl;
@@ -551,7 +558,8 @@ static void update_uniforms(struct gl_video *p, GLuint program)
} else {
mp_get_yuv2rgb_coeffs(&cparams, &m);
}
- gl->UniformMatrix3fv(loc, 1, GL_TRUE, &m.m[0][0]);
+ transpose3x3(m.m); // GLES2 can not transpose in glUniformMatrix3fv
+ gl->UniformMatrix3fv(loc, 1, GL_FALSE, &m.m[0][0]);
loc = gl->GetUniformLocation(program, "colormatrix_c");
gl->Uniform3f(loc, m.c[0], m.c[1], m.c[2]);
}