aboutsummaryrefslogtreecommitdiffhomepage
path: root/libvo/gl_common.h
diff options
context:
space:
mode:
authorGravatar wm4 <wm4@mplayer2.org>2011-11-08 20:21:00 +0100
committerGravatar Uoti Urpala <uau@mplayer2.org>2011-11-25 23:59:49 +0200
commit046692d90b3282ae99c9470aec711158eb2f1c40 (patch)
treeac84c653d187d008237880947e0a791d3a2ed268 /libvo/gl_common.h
parentb65ee1f5ac0b8634b6b79c81deeea86ef39c4069 (diff)
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.
Diffstat (limited to 'libvo/gl_common.h')
-rw-r--r--libvo/gl_common.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/libvo/gl_common.h b/libvo/gl_common.h
index d1d034b99a..f2e07e7e8b 100644
--- a/libvo/gl_common.h
+++ b/libvo/gl_common.h
@@ -218,6 +218,9 @@
#ifndef GL_LUMINANCE16
#define GL_LUMINANCE16 0x8042
#endif
+#ifndef GL_R16
+#define GL_R16 0x822A
+#endif
#ifndef GL_UNPACK_CLIENT_STORAGE_APPLE
#define GL_UNPACK_CLIENT_STORAGE_APPLE 0x85B2
#endif
@@ -245,8 +248,8 @@ void glAdjustAlignment(GL *gl, int stride);
const char *glValName(GLint value);
-int glFindFormat(uint32_t format, int *bpp, GLint *gl_texfmt,
- GLenum *gl_format, GLenum *gl_type);
+int glFindFormat(uint32_t format, int have_texture_rg, int *bpp,
+ GLint *gl_texfmt, GLenum *gl_format, GLenum *gl_type);
int glFmt2bpp(GLenum format, GLenum type);
void glCreateClearTex(GL *gl, GLenum target, GLenum fmt, GLenum format,
GLenum type, GLint filter, int w, int h,