summaryrefslogtreecommitdiffstats
path: root/video/out/gl_video.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-12-18 14:46:19 +0100
committerwm4 <wm4@nowhere>2014-12-18 14:46:59 +0100
commit541f6731a02c9b1b82770630a159a76e75c060ef (patch)
tree679784d130f3b4d482a62887d6687eaaacb09087 /video/out/gl_video.c
parentd910a0faa82f064ebe0cfbae56a9c82a0c18f32f (diff)
downloadmpv-541f6731a02c9b1b82770630a159a76e75c060ef.tar.bz2
mpv-541f6731a02c9b1b82770630a159a76e75c060ef.tar.xz
vo_opengl: simplify the case without texture_rg
If GL_RED was not available, we used GL_ALPHA. But this is an unnecessary complication, and it's easier to use GL_LUMINANCE instead. With the latter, a texture will return the .r component set, and as long as the shader doesn't look at the other components, the shader doesn't need any changes. Some of the changes added in 0e8fbdbd are now unneeeded. Also, realign the entire gl_byte_formats_legacy table.
Diffstat (limited to 'video/out/gl_video.c')
-rw-r--r--video/out/gl_video.c26
1 files changed, 9 insertions, 17 deletions
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;
}
}