From cc011415ffb10521260e486a41b56d0080bf2cd9 Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 24 Feb 2015 13:48:09 +0100 Subject: 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.) --- video/out/gl_video.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'video/out') 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]); } -- cgit v1.2.3