[1/3] kmscube: fix build on OpenGL ES 3 dependencies not providing GLES3/gl3ext.h

Message ID 20211210150930.326134-1-quentin.schulz@theobroma-systems.com
State Accepted, archived
Commit b7b6284fbc08452c7ed9ea9180003f043a624ae7
Headers show
Series [1/3] kmscube: fix build on OpenGL ES 3 dependencies not providing GLES3/gl3ext.h | expand

Commit Message

Quentin Schulz Dec. 10, 2021, 3:09 p.m. UTC
According to Khronos documentation[1], gl2ext.h can be used for OpenGL
ES 3. Some vendor implementation of OpenGL ES 3, such as
Rockchip's libmali[2], do not have a gl3ext.h but only a gl2ext.h while
being OpenGL ES 3 compliant.

This fixes the header files to be included from gl3ext.h to gl2ext.h to
be compatible with (hopefully) all OpenGL ES 3 implementations.

[1] https://www.khronos.org/registry/OpenGL/index_es.php#headers
[2] https://github.com/rockchip-linux/libmali

Cc: Quentin Schulz <foss+yocto@0leil.net>
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
---
 ...ator-Use-correct-GL-extension-header.patch | 33 +++++++++++++++++++
 meta/recipes-graphics/kmscube/kmscube_git.bb  |  1 +
 2 files changed, 34 insertions(+)
 create mode 100644 meta/recipes-graphics/kmscube/0001-texturator-Use-correct-GL-extension-header.patch

Comments

Quentin Schulz Dec. 10, 2021, 3:34 p.m. UTC | #1
On Fri, Dec 10, 2021 at 04:09:28PM +0100, Quentin Schulz wrote:
> According to Khronos documentation[1], gl2ext.h can be used for OpenGL
> ES 3. Some vendor implementation of OpenGL ES 3, such as
> Rockchip's libmali[2], do not have a gl3ext.h but only a gl2ext.h while
> being OpenGL ES 3 compliant.
> 
> This fixes the header files to be included from gl3ext.h to gl2ext.h to
> be compatible with (hopefully) all OpenGL ES 3 implementations.
> 
> [1] https://www.khronos.org/registry/OpenGL/index_es.php#headers
> [2] https://github.com/rockchip-linux/libmali
> 
> Cc: Quentin Schulz <foss+yocto@0leil.net>
> Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
> ---
>  ...ator-Use-correct-GL-extension-header.patch | 33 +++++++++++++++++++
>  meta/recipes-graphics/kmscube/kmscube_git.bb  |  1 +
>  2 files changed, 34 insertions(+)
>  create mode 100644 meta/recipes-graphics/kmscube/0001-texturator-Use-correct-GL-extension-header.patch
> 
> diff --git a/meta/recipes-graphics/kmscube/0001-texturator-Use-correct-GL-extension-header.patch b/meta/recipes-graphics/kmscube/0001-texturator-Use-correct-GL-extension-header.patch
> new file mode 100644
> index 0000000000..5965782de7
> --- /dev/null
> +++ b/meta/recipes-graphics/kmscube/0001-texturator-Use-correct-GL-extension-header.patch

Wrong path here, forgot to run a build before sending the patch, will
send a v2 sometime soon but reviews welcome anyway :)

Cheers,
Quentin

Patch

diff --git a/meta/recipes-graphics/kmscube/0001-texturator-Use-correct-GL-extension-header.patch b/meta/recipes-graphics/kmscube/0001-texturator-Use-correct-GL-extension-header.patch
new file mode 100644
index 0000000000..5965782de7
--- /dev/null
+++ b/meta/recipes-graphics/kmscube/0001-texturator-Use-correct-GL-extension-header.patch
@@ -0,0 +1,33 @@ 
+From 2b74e0e32235f6ab2e3e42d53dea985a7ba6227f Mon Sep 17 00:00:00 2001
+From: Damian Hobson-Garcia <dhobsong@igel.co.jp>
+Date: Wed, 16 Dec 2020 11:08:25 +0900
+Subject: [PATCH] texturator: Use correct GL extension header
+
+gl2ext.h is the extenstion header for OpenGL ES 2.0 and all later
+versions according to the Khronos documentation [1].  gl3ext.h is either
+an empty stub, or may not even exist on some platforms.
+
+[1]: https://www.khronos.org/registry/OpenGL/index_es.php#headers
+
+Upstream-Status: Submitted [https://gitlab.freedesktop.org/mesa/kmscube/-/merge_requests/26]
+Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
+---
+ texturator.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/texturator.c b/texturator.c
+index d9335d7..6d97856 100644
+--- a/texturator.c
++++ b/texturator.c
+@@ -30,7 +30,7 @@
+ #include <math.h>
+ 
+ #include <GLES3/gl3.h>
+-#include <GLES3/gl3ext.h>
++#include <GLES2/gl2ext.h>
+ 
+ #ifdef HAVE_LIBPNG
+ #include <png.h>
+-- 
+2.33.1
+
diff --git a/meta/recipes-graphics/kmscube/kmscube_git.bb b/meta/recipes-graphics/kmscube/kmscube_git.bb
index f4e6cd41e7..efaa962704 100644
--- a/meta/recipes-graphics/kmscube/kmscube_git.bb
+++ b/meta/recipes-graphics/kmscube/kmscube_git.bb
@@ -12,6 +12,7 @@  LIC_FILES_CHKSUM = "file://kmscube.c;beginline=1;endline=23;md5=8b309d4ee67b7315
 
 SRCREV = "9f63f359fab1b5d8e862508e4e51c9dfe339ccb0"
 SRC_URI = "git://gitlab.freedesktop.org/mesa/kmscube;branch=master;protocol=https"
+SRC_URI += "file://0001-texturator-Use-correct-GL-extension-header.patch"
 UPSTREAM_CHECK_COMMITS = "1"
 
 S = "${WORKDIR}/git"