aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/evas/canvas/evas_gl.c
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2014-09-22 17:53:06 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2014-10-20 12:16:08 +0900
commit3f9caaf16d4b016304e177e1f9e9d30545ae7bec (patch)
tree599ce8d31524652ddcace901a19593cba0e1035c /src/lib/evas/canvas/evas_gl.c
parentEvas GL: Fix sigsegv with recent Nvidia EGL driver (diff)
downloadefl-3f9caaf16d4b016304e177e1f9e9d30545ae7bec.tar.gz
Evas GL: Add support for OpenGL-ES 1.1 (part 1)
This commit adds lots of required definitions (GL_ stuff), new API entries in the Evas_GL_API struct, and basic new APIs to create OpenGL-ES 1.1 contexts. @feature
Diffstat (limited to 'src/lib/evas/canvas/evas_gl.c')
-rw-r--r--src/lib/evas/canvas/evas_gl.c45
1 files changed, 37 insertions, 8 deletions
diff --git a/src/lib/evas/canvas/evas_gl.c b/src/lib/evas/canvas/evas_gl.c
index 2eefa1a75b..6e5e7afd41 100644
--- a/src/lib/evas/canvas/evas_gl.c
+++ b/src/lib/evas/canvas/evas_gl.c
@@ -20,6 +20,7 @@ struct _Evas_GL
struct _Evas_GL_Context
{
void *data;
+ Evas_GL_Context_Version version;
};
struct _Evas_GL_Surface
@@ -326,7 +327,8 @@ evas_gl_surface_destroy(Evas_GL *evas_gl, Evas_GL_Surface *surf)
}
EAPI Evas_GL_Context *
-evas_gl_context_create(Evas_GL *evas_gl, Evas_GL_Context *share_ctx)
+evas_gl_context_version_create(Evas_GL *evas_gl, Evas_GL_Context *share_ctx,
+ Evas_GL_Context_Version version)
{
Evas_GL_Context *ctx;
@@ -335,6 +337,14 @@ evas_gl_context_create(Evas_GL *evas_gl, Evas_GL_Context *share_ctx)
return NULL;
MAGIC_CHECK_END();
+ if ((version != EVAS_GL_GLES_1_X) && (version != EVAS_GL_GLES_2_X))
+ {
+ ERR("Can not create an OpenGL-ES %d.x context (not supported).",
+ (int) version);
+ _evas_gl_internal_error_set(evas_gl, EVAS_GL_BAD_PARAMETER);
+ return NULL;
+ }
+
// Allocate a context object
ctx = calloc(1, sizeof(Evas_GL_Context));
if (!ctx)
@@ -345,14 +355,11 @@ evas_gl_context_create(Evas_GL *evas_gl, Evas_GL_Context *share_ctx)
}
// Call engine->gl_create_context
+ ctx->version = version;
if (share_ctx)
- {
- ctx->data = evas_gl->evas->engine.func->gl_context_create(evas_gl->evas->engine.data.output, share_ctx->data);
- }
+ ctx->data = evas_gl->evas->engine.func->gl_context_create(evas_gl->evas->engine.data.output, share_ctx->data, version);
else
- {
- ctx->data = evas_gl->evas->engine.func->gl_context_create(evas_gl->evas->engine.data.output, NULL);
- }
+ ctx->data = evas_gl->evas->engine.func->gl_context_create(evas_gl->evas->engine.data.output, NULL, version);
// Set a few variables
if (!ctx->data)
@@ -370,6 +377,12 @@ evas_gl_context_create(Evas_GL *evas_gl, Evas_GL_Context *share_ctx)
return ctx;
}
+EAPI Evas_GL_Context *
+evas_gl_context_create(Evas_GL *evas_gl, Evas_GL_Context *share_ctx)
+{
+ return evas_gl_context_version_create(evas_gl, share_ctx, EVAS_GL_GLES_2_X);
+}
+
EAPI void
evas_gl_context_destroy(Evas_GL *evas_gl, Evas_GL_Context *ctx)
{
@@ -549,7 +562,23 @@ evas_gl_api_get(Evas_GL *evas_gl)
return NULL;
MAGIC_CHECK_END();
- return (Evas_GL_API*)evas_gl->evas->engine.func->gl_api_get(evas_gl->evas->engine.data.output);
+ return (Evas_GL_API*)evas_gl->evas->engine.func->gl_api_get(evas_gl->evas->engine.data.output, EVAS_GL_GLES_2_X);
+}
+
+EAPI Evas_GL_API *
+evas_gl_context_api_get(Evas_GL *evas_gl, Evas_GL_Context *ctx)
+{
+ MAGIC_CHECK(evas_gl, Evas_GL, MAGIC_EVAS_GL);
+ return NULL;
+ MAGIC_CHECK_END();
+
+ if (!ctx)
+ {
+ _evas_gl_internal_error_set(evas_gl, EVAS_GL_BAD_CONTEXT);
+ return NULL;
+ }
+
+ return (Evas_GL_API*)evas_gl->evas->engine.func->gl_api_get(evas_gl->evas->engine.data.output, ctx->version);
}
EAPI int