vo_gl: fix 10 bit with Mesa drivers (Intel/Nouveau on Linux)
commit046692d90b3282ae99c9470aec711158eb2f1c40
authorwm4 <wm4@mplayer2.org>
Tue, 8 Nov 2011 19:21:00 +0000 (8 20:21 +0100)
committerUoti Urpala <uau@mplayer2.org>
Fri, 25 Nov 2011 21:59:49 +0000 (25 23:59 +0200)
treeac84c653d187d008237880947e0a791d3a2ed268
parentb65ee1f5ac0b8634b6b79c81deeea86ef39c4069
vo_gl: fix 10 bit with Mesa drivers (Intel/Nouveau on Linux)

The GL_LUMINANCE16 texture format had only 8 bit precision on Mesa
based drivers. This caused heavy degradation of the image when playing
formats with more than 8 bits per pixel, such as 10 bit h264. Use
GL_R16 instead, which at least Mesa and Nvidia drivers actually
implement as 16 bit textures. Since sampling from this texture format
doesn't return anything meaningful in the other color components
(unlike luminance textures), the shader code has to be slightly
changed.

GL_R16 requires the GL_ARB_texture_rg extension. Check for it, and fall
back to the old texture format if it's not available.

The low precision of the GL_LUMINANCE16 format has just been fixed in
upstream Mesa, but it'll take a while before that fix is available in
distros.
libvo/gl_common.c
libvo/gl_common.h
libvo/vo_gl.c