From 9c54b224d8cdf05dcb1df73b6e8af1c868eca053 Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 17 Feb 2017 15:46:11 +0100 Subject: vo_opengl: handle GL_LUMINANCE_ALPHA and integer textures differently GL_LUMINANCE_ALPHA is the only reason why per-plane swizzles exist. Remove per-plane swizzles (again), and regrettably handle them as special cases (again). Carry along the logical texture format (called gl_format in some parts of the code, including the new one). We also don't need a use_integer flag, since the new gl_format member implies whether it's an integer texture. (Yes, the there are separate logical GL formats for integer textures. This aspect of the OpenGL API is hysteric at best.) This should change nothing about actual rendering logic and GL API usage. --- video/out/opengl/hwdec_osx.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'video/out/opengl/hwdec_osx.c') diff --git a/video/out/opengl/hwdec_osx.c b/video/out/opengl/hwdec_osx.c index 734e3a2e0e..eb1634b930 100644 --- a/video/out/opengl/hwdec_osx.c +++ b/video/out/opengl/hwdec_osx.c @@ -32,7 +32,6 @@ struct vt_gl_plane_format { GLenum gl_format; GLenum gl_type; GLenum gl_internal_format; - char swizzle[5]; }; struct vt_format { @@ -40,6 +39,7 @@ struct vt_format { int imgfmt; int planes; struct vt_gl_plane_format gl[MP_MAX_PLANES]; + char swizzle[5]; }; struct priv { @@ -64,8 +64,9 @@ static struct vt_format vt_formats[] = { .imgfmt = IMGFMT_UYVY, .planes = 1, .gl = { - { GL_RGB_422_APPLE, GL_UNSIGNED_SHORT_8_8_APPLE, GL_RGB, "gbra" } - } + { GL_RGB_422_APPLE, GL_UNSIGNED_SHORT_8_8_APPLE, GL_RGB } + }, + .swizzle = "gbra", }, { .cvpixfmt = kCVPixelFormatType_420YpCbCr8Planar, @@ -205,10 +206,10 @@ static int map_frame(struct gl_hwdec *hw, struct mp_image *hw_image, .tex_w = IOSurfaceGetWidthOfPlane(surface, i), .tex_h = IOSurfaceGetHeightOfPlane(surface, i), }; - snprintf(out_frame->planes[i].swizzle, sizeof(out_frame->planes[i].swizzle), - "%s", f->gl[i].swizzle); } + snprintf(out_frame->swizzle, sizeof(out_frame->swizzle), "%s", f->swizzle); + return 0; } -- cgit v1.2.3