diff options
Diffstat (limited to 'video/out')
-rw-r--r-- | video/out/gl_osd.c | 4 | ||||
-rw-r--r-- | video/out/gl_video.c | 26 | ||||
-rw-r--r-- | video/out/gl_video_shaders.glsl | 16 |
3 files changed, 18 insertions, 28 deletions
diff --git a/video/out/gl_osd.c b/video/out/gl_osd.c index 2276dc9f71..f0917c364e 100644 --- a/video/out/gl_osd.c +++ b/video/out/gl_osd.c @@ -48,8 +48,8 @@ static const struct osd_fmt_entry osd_to_gles3_formats[SUBBITMAP_COUNT] = { }; static const struct osd_fmt_entry osd_to_gl_legacy_formats[SUBBITMAP_COUNT] = { - [SUBBITMAP_LIBASS] = {GL_ALPHA, GL_ALPHA, GL_UNSIGNED_BYTE}, - [SUBBITMAP_RGBA] = {GL_RGBA, GL_BGRA, GL_UNSIGNED_BYTE}, + [SUBBITMAP_LIBASS] = {GL_LUMINANCE, GL_LUMINANCE, GL_UNSIGNED_BYTE}, + [SUBBITMAP_RGBA] = {GL_RGBA, GL_BGRA, GL_UNSIGNED_BYTE}, }; struct mpgl_osd *mpgl_osd_init(GL *gl, struct mp_log *log, struct osd_state *osd) diff --git a/video/out/gl_video.c b/video/out/gl_video.c index e7c2c46450..126decf4e7 100644 --- a/video/out/gl_video.c +++ b/video/out/gl_video.c @@ -245,18 +245,14 @@ static const struct fmt_entry gl_byte_formats_gles3[] = { }; static const struct fmt_entry gl_byte_formats_legacy[] = { - {0, GL_ALPHA, GL_ALPHA, GL_UNSIGNED_BYTE}, // 1 x 8 - {0, GL_LUMINANCE_ALPHA, - GL_LUMINANCE_ALPHA, - GL_UNSIGNED_BYTE}, // 2 x 8 - {0, GL_RGB, GL_RGB, GL_UNSIGNED_BYTE}, // 3 x 8 - {0, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE}, // 4 x 8 - {0, GL_ALPHA16, GL_ALPHA, GL_UNSIGNED_SHORT}, // 1 x 16 - {0, GL_LUMINANCE16_ALPHA16, - GL_LUMINANCE_ALPHA, - GL_UNSIGNED_SHORT}, // 2 x 16 - {0, GL_RGB16, GL_RGB, GL_UNSIGNED_SHORT}, // 3 x 16 - {0, GL_RGBA16, GL_RGBA, GL_UNSIGNED_SHORT}, // 4 x 16 + {0, GL_LUMINANCE, GL_LUMINANCE, GL_UNSIGNED_BYTE}, // 1 x 8 + {0, GL_LUMINANCE_ALPHA, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE}, // 2 x 8 + {0, GL_RGB, GL_RGB, GL_UNSIGNED_BYTE}, // 3 x 8 + {0, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE}, // 4 x 8 + {0, GL_LUMINANCE16, GL_LUMINANCE, GL_UNSIGNED_SHORT},// 1 x 16 + {0, GL_LUMINANCE16_ALPHA16, GL_LUMINANCE_ALPHA, GL_UNSIGNED_SHORT},// 2 x 16 + {0, GL_RGB16, GL_RGB, GL_UNSIGNED_SHORT},// 3 x 16 + {0, GL_RGBA16, GL_RGBA, GL_UNSIGNED_SHORT},// 4 x 16 }; static const struct fmt_entry gl_float16_formats[] = { @@ -2246,11 +2242,9 @@ static void packed_fmt_swizzle(char w[5], const struct fmt_entry *texfmt, { const char *comp = "rgba"; - // Normally, we work with GL_RED and GL_RG + // Normally, we work with GL_RG if (texfmt && texfmt->internal_format == GL_LUMINANCE_ALPHA) comp = "ragb"; - if (texfmt && texfmt->internal_format == GL_ALPHA) - comp = "argb"; for (int c = 0; c < 4; c++) w[c] = comp[MPMAX(fmt->components[c] - 1, 0)]; @@ -2290,8 +2284,6 @@ static bool init_format(int fmt, struct gl_video *init) plane_format[0] = find_tex_format(gl, (bits + 7) / 8, 1); for (int p = 1; p < desc.num_planes; p++) plane_format[p] = plane_format[0]; - if (!(init->gl->mpgl_caps & MPGL_CAP_TEX_RG) && desc.num_planes < 2) - snprintf(init->color_swizzle, sizeof(init->color_swizzle), "argb"); goto supported; } } diff --git a/video/out/gl_video_shaders.glsl b/video/out/gl_video_shaders.glsl index 7f77be0421..322c91fd13 100644 --- a/video/out/gl_video_shaders.glsl +++ b/video/out/gl_video_shaders.glsl @@ -46,10 +46,8 @@ precision mediump float; #endif #if HAVE_RG -#define R r #define RG rg #else -#define R a #define RG ra #endif @@ -145,7 +143,7 @@ in vec4 color; DECLARE_FRAGPARMS void main() { - out_color = vec4(color.rgb, color.a * texture(texture0, texcoord).R); + out_color = vec4(color.rgb, color.a * texture(texture0, texcoord).r); } #!section frag_osd_rgba @@ -338,12 +336,12 @@ void main() { #define USE_CONV 0 #endif #if USE_CONV == CONV_PLANAR - vec4 acolor = vec4(SAMPLE_L(texture0, textures_size[0], texcoord).R, - SAMPLE_C(texture1, textures_size[1], chr_texcoord).R, - SAMPLE_C(texture2, textures_size[2], chr_texcoord).R, + vec4 acolor = vec4(SAMPLE_L(texture0, textures_size[0], texcoord).r, + SAMPLE_C(texture1, textures_size[1], chr_texcoord).r, + SAMPLE_C(texture2, textures_size[2], chr_texcoord).r, 1.0); #elif USE_CONV == CONV_NV12 - vec4 acolor = vec4(SAMPLE_L(texture0, textures_size[0], texcoord).R, + vec4 acolor = vec4(SAMPLE_L(texture0, textures_size[0], texcoord).r, SAMPLE_C(texture1, textures_size[1], chr_texcoord).RG, 1.0); #else @@ -353,7 +351,7 @@ void main() { acolor = acolor. USE_COLOR_SWIZZLE ; #endif #ifdef USE_ALPHA_PLANE - acolor.a = SAMPLE_L(texture3, textures_size[3], texcoord).R; + acolor.a = SAMPLE_L(texture3, textures_size[3], texcoord).r; #endif vec3 color = acolor.rgb; float alpha = acolor.a; @@ -464,7 +462,7 @@ void main() { #ifdef USE_TEMPORAL_DITHER dither_pos = dither_trafo * dither_pos; #endif - float dither_value = texture(dither, dither_pos).R; + float dither_value = texture(dither, dither_pos).r; color = floor(color * dither_quantization + dither_value + dither_center) / dither_quantization; #endif |