*/
typedef enum _Evas_GL_Context_Version
{
- EVAS_GL_GLES_1_X = 1, /**< OpenGL-ES 1.x */
- EVAS_GL_GLES_2_X = 2, /**< OpenGL-ES 2.x is the default */
- EVAS_GL_GLES_3_X = 3 /**< OpenGL-ES 3.x (@b Since: 2.4) */
+ EVAS_GL_GLES_1_X = 1, /**< OpenGL-ES 1.x */
+ EVAS_GL_GLES_2_X = 2, /**< OpenGL-ES 2.x is the default */
+ EVAS_GL_GLES_3_X = 3, /**< OpenGL-ES 3.x (@b Since: 2.4) */
+ EVAS_GL_DEBUG = 0x1000 /**< Enable debug mode on this context (See GL_KHR_debug) (@b Since: 4.0) */
} Evas_GL_Context_Version;
/**
#include "evas_private.h"
#include "Evas_GL.h"
+#define CONTEXT_VERSION_MASK 0xFF
typedef struct _Evas_GL_TLS_data Evas_GL_TLS_data;
/* since 1.16: store current evas gl - this TLS is never destroyed */
{
void *data;
Evas_GL_Context_Version version;
+ int ctx_flag;
};
struct _Evas_GL_Surface
Evas_GL_Context_Version version)
{
Evas_GL_Context *ctx;
+ int ctx_flag;
// Magic
MAGIC_CHECK(evas_gl, Evas_GL, MAGIC_EVAS_GL);
return NULL;
MAGIC_CHECK_END();
+ ctx_flag = version & EVAS_GL_DEBUG;
+ version &= CONTEXT_VERSION_MASK;
+
if ((version < EVAS_GL_GLES_1_X) || (version > EVAS_GL_GLES_3_X))
{
ERR("Can not create an OpenGL-ES %d.x context (not supported).",
// Call engine->gl_create_context
ctx->version = version;
+ ctx->ctx_flag = ctx_flag;
ctx->data = evas_gl->evas->engine.func->gl_context_create
(evas_gl->evas->engine.data.output, share_ctx ? share_ctx->data : NULL,
- version, &evas_gl_native_context_get, &evas_gl_engine_data_get);
+ version, ctx_flag, &evas_gl_native_context_get, &evas_gl_engine_data_get);
// Set a few variables
if (!ctx->data)
void *(*gl_surface_create) (void *data, void *config, int w, int h);
void *(*gl_pbuffer_surface_create) (void *data, void *config, int w, int h, int const *attrib_list);
int (*gl_surface_destroy) (void *data, void *surface);
- void *(*gl_context_create) (void *data, void *share_context, int version, void *(*native_context_get)(void *ctx), void *(*engine_data_get)(void *evasgl));
+ void *(*gl_context_create) (void *data, void *share_context, int version, int ctx_flag, void *(*native_context_get)(void *ctx), void *(*engine_data_get)(void *evasgl));
int (*gl_context_destroy) (void *data, void *context);
int (*gl_make_current) (void *data, void *surface, void *context);
const char *(*gl_string_query) (void *data, int name);
_EVASGL_EXT_END()
+_EVASGL_EXT_BEGIN(EGL_KHR_create_context)
+ _EVASGL_EXT_DRVNAME(EGL_KHR_create_context)
+_EVASGL_EXT_END()
#if 0
_EVASGL_EXT_BEGIN(EGL_SEC_map_image)
if (!rsc->context)
{
// Create a resource context
- rsc->context = evgl_engine->funcs->context_create(eng_data, NULL, EVAS_GL_GLES_2_X);
+ rsc->context = evgl_engine->funcs->context_create(eng_data, NULL, EVAS_GL_GLES_2_X, 0);
if (!rsc->context)
{
ERR("Internal resource context creation failed.");
void *
evgl_context_create(void *eng_data, EVGL_Context *share_ctx,
- Evas_GL_Context_Version version,
+ Evas_GL_Context_Version version, int ctx_flag,
void *(*native_context_get)(void *),
void *(*engine_data_get)(void *))
{
// Call engine create context
if (share_ctx)
- ctx->context = evgl_engine->funcs->context_create(eng_data, share_ctx->context, version);
+ ctx->context = evgl_engine->funcs->context_create(eng_data, share_ctx->context, version, ctx_flag);
else
- ctx->context = evgl_engine->funcs->context_create(eng_data, NULL, version);
+ ctx->context = evgl_engine->funcs->context_create(eng_data, NULL, version, ctx_flag);
// Call engine create context
if (!ctx->context)
void *evgl_surface_create(void *eng_data, Evas_GL_Config *cfg, int w, int h);
void *evgl_pbuffer_surface_create(void *eng_data, Evas_GL_Config *cfg, int w, int h, const int *attrib_list);
int evgl_surface_destroy(void *eng_data, EVGL_Surface *sfc);
-void *evgl_context_create(void *eng_data, EVGL_Context *share_ctx, Evas_GL_Context_Version version, void *(*native_context_get)(void *), void *(*engine_data_get)(void *));
+void *evgl_context_create(void *eng_data, EVGL_Context *share_ctx, Evas_GL_Context_Version version, int ctx_flag, void *(*native_context_get)(void *), void *(*engine_data_get)(void *));
int evgl_context_destroy(void *eng_data, EVGL_Context *ctx);
int evgl_make_current(void *eng_data, EVGL_Surface *sfc, EVGL_Context *ctx);
int (*surface_destroy)(void *data, void *surface);
// Creates/Destroys the native surface from evas engine.
- void *(*context_create)(void *data, void *share_ctx, Evas_GL_Context_Version version);
+ void *(*context_create)(void *data, void *share_ctx, Evas_GL_Context_Version version, int ctx_flag);
int (*context_destroy)(void *data, void *context);
// Calls the make_current from evas_engine.
static int evgl_eng_native_window_destroy(void *data, void *native_window);
static void *evgl_eng_window_surface_create(void *data, void *native_window);
static int evgl_eng_window_surface_destroy(void *data, void *surface);
-static void *evgl_eng_context_create(void *data, void *share_ctx, Evas_GL_Context_Version version);
+static void *evgl_eng_context_create(void *data, void *share_ctx, Evas_GL_Context_Version version, int ctx_flag);
static int evgl_eng_context_destroy(void *data, void *context);
static const char *evgl_eng_string_get(void *data);
static void *evgl_eng_proc_address_get(const char *name);
}
static void *
-evgl_eng_context_create(void *data, void *share_ctx, Evas_GL_Context_Version version)
+evgl_eng_context_create(void *data, void *share_ctx, Evas_GL_Context_Version version, int ctx_flag EINA_UNUSED)
{
Render_Engine *re;
EGLContext context = EGL_NO_CONTEXT;
}
static void *
-eng_gl_context_create(void *data, void *share_context, int version,
+eng_gl_context_create(void *data, void *share_context, int version, int ctx_flag,
void *(*native_context_get)(void *),
void *(*engine_data_get)(void *))
{
EVGL_Context *sctx = (EVGL_Context *)share_context;
EVGLINIT(data, NULL);
- return evgl_context_create(data, sctx, version, native_context_get, engine_data_get);
+ return evgl_context_create(data, sctx, version, ctx_flag, native_context_get, engine_data_get);
}
static int
}
static void *
-evgl_eng_context_create(void *data, void *share_ctx EINA_UNUSED, int version)
+evgl_eng_context_create(void *data, void *share_ctx EINA_UNUSED, int version, int ctx_flag EINA_UNUSED)
{
Render_Engine *re = data;
static int evgl_eng_native_window_destroy(void *data, void *native_window);
static void *evgl_eng_window_surface_create(void *data, void *native_window);
static int evgl_eng_window_surface_destroy(void *data, void *surface);
-static void *evgl_eng_context_create(void *data, void *share_ctx, Evas_GL_Context_Version version);
+static void *evgl_eng_context_create(void *data, void *share_ctx, Evas_GL_Context_Version version, int ctx_flag);
static int evgl_eng_context_destroy(void *data, void *context);
static const char *evgl_eng_string_get(void *data);
static void *evgl_eng_proc_address_get(const char *name);
}
static void *
-evgl_eng_context_create(void *data, void *ctxt, Evas_GL_Context_Version version)
+evgl_eng_context_create(void *data, void *ctxt, Evas_GL_Context_Version version, int ctx_flag EINA_UNUSED)
{
Render_Engine *re;
Outbuf *ob;
}
static void *
-evgl_eng_context_create(void *data, void *share_ctx, Evas_GL_Context_Version version)
+evgl_eng_context_create(void *data, void *share_ctx, Evas_GL_Context_Version version, int ctx_flag EINA_UNUSED )
{
Render_Engine *re = (Render_Engine *)data;
}
static void *
-eng_gl_context_create(void *data EINA_UNUSED, void *share_context, int version,
+eng_gl_context_create(void *data EINA_UNUSED, void *share_context, int version, int ctx_flag EINA_UNUSED,
void *(*native_context_get)(void *) EINA_UNUSED,
void *(*engine_data_get)(void *) EINA_UNUSED)
{
}
static void *
-evgl_eng_context_create(void *data, void *ctxt, Evas_GL_Context_Version version)
+evgl_eng_context_create(void *data, void *ctxt, Evas_GL_Context_Version version, int ctx_flag)
{
Render_Engine *re;
Outbuf *ob;
EGLContext context = EGL_NO_CONTEXT;
- int attrs[3];
+ int attrs[5] = {0};
if (!(re = (Render_Engine *)data))
{
attrs[0] = EGL_CONTEXT_CLIENT_VERSION;
attrs[1] = version;
- attrs[2] = EGL_NONE;
+
+ if (ctx_flag & EVAS_GL_DEBUG)
+ {
+ attrs[2] = EGL_CONTEXT_FLAGS_KHR;
+ attrs[3] |= EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR;
+ attrs[4] = EGL_NONE;
+ }
+ else
+ attrs[2] = EGL_NONE;
if (ctxt)
{