summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiels De Graef <niels.degraef@barco.com>2019-06-24 15:05:15 +0200
committerNiels De Graef <niels.degraef@barco.com>2019-06-24 15:14:01 +0200
commit1fd5e9bb0bb27da8ca8e497751fb260016d380e9 (patch)
treef5bb3d8adcd69ec99891631776969fc7b33bee83
parent940a4852062d73ff24cdb0bc0db139b13798cb79 (diff)
downloadmutter-wip/nielsdg/add-yuv-support.tar.gz
-rw-r--r--cogl/cogl/driver/gl/gles/cogl-driver-gles.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/cogl/cogl/driver/gl/gles/cogl-driver-gles.c b/cogl/cogl/driver/gl/gles/cogl-driver-gles.c
index 26607e096..562bcbe24 100644
--- a/cogl/cogl/driver/gl/gles/cogl-driver-gles.c
+++ b/cogl/cogl/driver/gl/gles/cogl-driver-gles.c
@@ -87,10 +87,17 @@ _cogl_driver_pixel_format_to_gl (CoglContext *context,
gltype = GL_UNSIGNED_BYTE;
break;
- /* GLES doesn't have GL_RED, so use GL_ALPHA and use a swizzle later */
case COGL_PIXEL_FORMAT_R_8:
- glintformat = GL_ALPHA;
- glformat = GL_ALPHA;
+ if (cogl_has_feature (context, COGL_FEATURE_ID_TEXTURE_RG))
+ {
+ glintformat = GL_RED;
+ glformat = GL_R8;
+ }
+ else
+ {
+ glintformat = GL_LUMINANCE;
+ glformat = GL_LUMINANCE;
+ }
gltype = GL_UNSIGNED_BYTE;
break;