diff options
author | wm4 <wm4@nowhere> | 2013-07-18 13:52:38 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-07-18 13:52:38 +0200 |
commit | eb7959e43a0bea2cfa13ff825043cb33878e58b4 (patch) | |
tree | d6df8b1796825d23906bac6cbb3c61993ec4b60b /video/out/gl_video_shaders.glsl | |
parent | a1fd8c6953a6b5b5fba28eca58dd8a49f512f29f (diff) | |
download | mpv-eb7959e43a0bea2cfa13ff825043cb33878e58b4.tar.bz2 mpv-eb7959e43a0bea2cfa13ff825043cb33878e58b4.tar.xz |
gl_video: add support for more rgb formats
Until now, only formats directly supported by OpenGL were supported.
This excludes various permutations of 8-bit RGB[A|0]. But we can simply
permutate the color channels in the shader, so do that. This also adds
support for all these weird RGB0 formats.
Note that we could use libavutil's pixfmt list instead of the
mp_packed_formats array, but trying to decrypt the pixfmt info would
probably end in pain, so this array with duplicated information is
actually better and shorter.
Note: I didn't actually test whether the alpha components are reproduced
correctly with alpha formats.
Diffstat (limited to 'video/out/gl_video_shaders.glsl')
-rw-r--r-- | video/out/gl_video_shaders.glsl | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/video/out/gl_video_shaders.glsl b/video/out/gl_video_shaders.glsl index 55258fd252..8ca6739bf4 100644 --- a/video/out/gl_video_shaders.glsl +++ b/video/out/gl_video_shaders.glsl @@ -330,29 +330,25 @@ void main() { #define USE_CONV 0 #endif #if USE_CONV == CONV_PLANAR - vec3 color = vec3(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); - float alpha = 1.0; + 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 - vec3 color = vec3(SAMPLE_L(texture0, textures_size[0], texcoord).r, - SAMPLE_C(texture1, textures_size[1], chr_texcoord).rg); - float alpha = 1.0; + vec4 acolor = vec4(SAMPLE_L(texture0, textures_size[0], texcoord).r, + SAMPLE_C(texture1, textures_size[1], chr_texcoord).rg, + 1.0); #else vec4 acolor = SAMPLE_L(texture0, textures_size[0], texcoord); - vec3 color = acolor.rgb; - float alpha = acolor.a; #endif #ifdef USE_ALPHA_PLANE - alpha = SAMPLE_L(texture3, - textures_size[3], texcoord).r; -#endif -#ifdef USE_GBRP - color.gbr = color; + acolor.a = SAMPLE_L(texture3, textures_size[3], texcoord).r; #endif -#ifdef USE_SWAP_UV - color.rbg = color; +#ifdef USE_COLOR_SWIZZLE + acolor = acolor. USE_COLOR_SWIZZLE ; #endif + vec3 color = acolor.rgb; + float alpha = acolor.a; #ifdef USE_YGRAY // NOTE: actually slightly wrong for 16 bit input video, and completely // wrong for 9/10 bit input |