[Cogl] [PATCH 2/3] Adds "webgl" driver
Robert Bragg
robert at sixbynine.org
Thu May 30 10:08:27 PDT 2013
From: Robert Bragg <robert at linux.intel.com>
This adds a COGL_DRIVER_WEBGL enum and a new driver description for
webgl in cogl-renderer.c. This also adds a COGL_DRIVER_FLAG_OPENGL_WEB
driver flag and a HAVE_COGL_WEBGL define which we can start to use to
handle special cases where webgl differs from gles2.
---
cogl/cogl-private.h | 3 ++-
cogl/cogl-renderer.c | 16 ++++++++++++++++
cogl/cogl-renderer.h | 4 +++-
configure.ac | 1 +
4 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/cogl/cogl-private.h b/cogl/cogl-private.h
index cc01379..54689aa 100644
--- a/cogl/cogl-private.h
+++ b/cogl/cogl-private.h
@@ -67,7 +67,8 @@ typedef enum
COGL_PRIVATE_FEATURE_ANY_GL = 1L<<25,
COGL_PRIVATE_FEATURE_GL_FIXED = 1L<<26,
COGL_PRIVATE_FEATURE_GL_PROGRAMMABLE = 1L<<27,
- COGL_PRIVATE_FEATURE_GL_EMBEDDED = 1L<<28
+ COGL_PRIVATE_FEATURE_GL_EMBEDDED = 1L<<28,
+ COGL_PRIVATE_FEATURE_GL_WEB = 1L<<29
} CoglPrivateFeatureFlags;
/* Sometimes when evaluating pipelines, either during comparisons or
diff --git a/cogl/cogl-renderer.c b/cogl/cogl-renderer.c
index c3148eb..d808382 100644
--- a/cogl/cogl-renderer.c
+++ b/cogl/cogl-renderer.c
@@ -156,6 +156,20 @@ static CoglDriverDescription _cogl_drivers[] =
COGL_GLES1_LIBNAME,
},
#endif
+#ifdef USING_EMSCRIPTEN
+ {
+ COGL_DRIVER_WEBGL,
+ "webgl",
+ 0,
+ COGL_PRIVATE_FEATURE_ANY_GL |
+ COGL_PRIVATE_FEATURE_GL_EMBEDDED |
+ COGL_PRIVATE_FEATURE_GL_PROGRAMMABLE |
+ COGL_PRIVATE_FEATURE_GL_WEB,
+ &_cogl_driver_gles,
+ &_cogl_texture_driver_gles,
+ NULL,
+ },
+#endif
{
COGL_DRIVER_NOP,
"nop",
@@ -421,6 +435,8 @@ driver_id_to_name (CoglDriver id)
return "gles1";
case COGL_DRIVER_GLES2:
return "gles2";
+ case COGL_DRIVER_WEBGL:
+ return "webgl";
case COGL_DRIVER_NOP:
return "nop";
case COGL_DRIVER_ANY:
diff --git a/cogl/cogl-renderer.h b/cogl/cogl-renderer.h
index 7921784..a3b4fc2 100644
--- a/cogl/cogl-renderer.h
+++ b/cogl/cogl-renderer.h
@@ -332,6 +332,7 @@ cogl_renderer_remove_constraint (CoglRenderer *renderer,
* @COGL_DRIVER_GL3: An OpenGL driver using the core GL 3.1 profile
* @COGL_DRIVER_GLES1: An OpenGL ES 1.1 driver.
* @COGL_DRIVER_GLES2: An OpenGL ES 2.0 driver.
+ * @COGL_DRIVER_WEBGL: A WebGL driver.
*
* Identifiers for underlying hardware drivers that may be used by
* Cogl for rendering.
@@ -346,7 +347,8 @@ typedef enum
COGL_DRIVER_GL,
COGL_DRIVER_GL3,
COGL_DRIVER_GLES1,
- COGL_DRIVER_GLES2
+ COGL_DRIVER_GLES2,
+ COGL_DRIVER_WEBGL
} CoglDriver;
/**
diff --git a/configure.ac b/configure.ac
index 1700bbb..76ee592 100644
--- a/configure.ac
+++ b/configure.ac
@@ -696,6 +696,7 @@ AS_IF([test "x$enable_gles2" = "xyes"],
[
GL_LIBRARY_DIRECTLY_LINKED=yes
COGL_GLES2_LIBNAME=""
+ AC_DEFINE([HAVE_COGL_WEBGL], 1, [Have WebGL for rendering])
],
[
--
1.8.2.1
More information about the Cogl
mailing list