[mutter/wip/nielsdg/add-yuv-support: 22/23] WIP
- From: Niels De Graef <nielsdg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/nielsdg/add-yuv-support: 22/23] WIP
- Date: Mon, 24 Jun 2019 14:57:59 +0000 (UTC)
commit 940a4852062d73ff24cdb0bc0db139b13798cb79
Author: Niels De Graef <niels degraef barco com>
Date: Sat Jun 22 11:07:05 2019 +0200
WIP
cogl/cogl/driver/gl/gles/cogl-driver-gles.c | 6 ++++--
cogl/cogl/driver/gl/gles/cogl-texture-driver-gles.c | 10 ++++++++++
2 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/cogl/cogl/driver/gl/gles/cogl-driver-gles.c b/cogl/cogl/driver/gl/gles/cogl-driver-gles.c
index 9646e4516..26607e096 100644
--- a/cogl/cogl/driver/gl/gles/cogl-driver-gles.c
+++ b/cogl/cogl/driver/gl/gles/cogl-driver-gles.c
@@ -86,9 +86,11 @@ _cogl_driver_pixel_format_to_gl (CoglContext *context,
glformat = GL_ALPHA;
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_RED;
- glformat = GL_RED;
+ glintformat = GL_ALPHA;
+ glformat = GL_ALPHA;
gltype = GL_UNSIGNED_BYTE;
break;
diff --git a/cogl/cogl/driver/gl/gles/cogl-texture-driver-gles.c
b/cogl/cogl/driver/gl/gles/cogl-texture-driver-gles.c
index 21e6cfa78..22db84823 100644
--- a/cogl/cogl/driver/gl/gles/cogl-texture-driver-gles.c
+++ b/cogl/cogl/driver/gl/gles/cogl-texture-driver-gles.c
@@ -96,6 +96,16 @@ _cogl_texture_driver_gen (CoglContext *ctx,
g_assert_not_reached();
}
+ /* GL-ES doesn't have GL_RED, so swizzle the alpha into a red component */
+ if (internal_format == COGL_PIXEL_FORMAT_R_8)
+ {
+ static const GLint alpha_swizzle[] = { GL_ALPHA, GL_ZERO, GL_ZERO, GL_ZERO };
+
+ GE( ctx, glTexParameteriv (gl_target,
+ GL_TEXTURE_SWIZZLE_RGBA,
+ alpha_swizzle) );
+ }
+
return tex;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]