surface = (void*)rsc->surface;
// Do the make current
+ if (evgl_engine->api_debug_mode)
+ DBG("Calling make_current(%p, %p)", surface, context);
ret = evgl_engine->funcs->make_current(eng_data, surface, context, 1);
if (!ret)
{
return "GL_STENCIL_INDEX8";
// Depth_Stencil
+ case GL_DEPTH_STENCIL:
+ return "GL_DEPTH_STENCIL";
case GL_DEPTH24_STENCIL8:
return "GL_DEPTH24_STENCIL8";
#endif
char *s = NULL;
int direct_override = 0, direct_mem_opt = 0;
Eina_Bool need_reconfigure = EINA_FALSE;
+ Eina_Bool dbg;
// Check if engine is valid
if (!evgl_engine)
evas_gl_common_error_set(eng_data, EVAS_GL_BAD_ACCESS);
return NULL;
}
+ dbg = evgl_engine->api_debug_mode;
if (!cfg)
{
}
}
+ if (dbg) DBG("Calling make_current(NULL, NULL)");
if (!evgl_engine->funcs->make_current(eng_data, NULL, NULL, 0))
{
ERR("Error doing make_current(NULL, NULL).");
// Keep track of all the created surfaces
LKL(evgl_engine->resource_lock);
evgl_engine->surfaces = eina_list_prepend(evgl_engine->surfaces, sfc);
- LKU(evgl_engine->resource_lock);
if (sfc->direct_fb_opt &&
(sfc->depth_fmt || sfc->stencil_fmt || sfc->depth_stencil_fmt))
evgl_engine->direct_depth_stencil_surfaces =
eina_list_prepend(evgl_engine->direct_depth_stencil_surfaces, sfc);
}
+ LKU(evgl_engine->resource_lock);
if (need_reconfigure)
{
ERR("Surface reconfigure is not implemented yet");
}
+ if (dbg) DBG("Created surface sfc %p (eng %p)", sfc, eng_data);
+
return sfc;
error:
{
EVGL_Surface *sfc = NULL;
void *pbuffer;
+ Eina_Bool dbg;
// Check if engine is valid
if (!evgl_engine)
evas_gl_common_error_set(eng_data, EVAS_GL_BAD_ACCESS);
return NULL;
}
+ dbg = evgl_engine->api_debug_mode;
if (!cfg)
{
sfc->pbuffer.native_surface = pbuffer;
+ if (dbg) DBG("Calling make_current(NULL, NULL)");
if (!evgl_engine->funcs->make_current(eng_data, NULL, NULL, 0))
{
ERR("Error doing make_current(NULL, NULL).");
evgl_engine->surfaces = eina_list_prepend(evgl_engine->surfaces, sfc);
LKU(evgl_engine->resource_lock);
+ if (dbg) DBG("Created PBuffer surface sfc %p:%p (eng %p)", sfc, pbuffer, eng_data);
+
return sfc;
error:
{
EVGL_Resource *rsc;
Eina_Bool need_reconfigure = EINA_FALSE;
+ Eina_Bool dbg;
+
+ // FIXME: This does some make_current(0,0) which may have side effects
// Check input parameter
if ((!evgl_engine) || (!sfc))
return 0;
}
+ if ((dbg = evgl_engine->api_debug_mode))
+ DBG("Destroying surface sfc %p (eng %p)", sfc, eng_data);
+
if ((rsc->current_ctx) && (rsc->current_ctx->current_sfc == sfc) )
{
if (evgl_engine->api_debug_mode)
if (sfc->gles1_indirect)
{
int ret;
+ if (dbg) DBG("sfc %p is used for GLES 1.x indirect rendering", sfc);
+
if (!evgl_engine->funcs->gles1_surface_destroy)
{
ERR("Error destroying GLES 1.x surface");
return 0;
}
- INF("Destroying special surface used for GLES 1.x rendering");
+ DBG("Destroying special surface used for GLES 1.x rendering");
ret = evgl_engine->funcs->gles1_surface_destroy(eng_data, sfc);
if (!ret) ERR("Engine failed to destroy a GLES1.x Surface.");
return ret;
-
}
if (sfc->pbuffer.native_surface)
{
int ret;
+ if (dbg) DBG("Surface sfc %p is a pbuffer: %p", sfc, sfc->pbuffer.native_surface);
if (sfc->pbuffer.fbo)
glDeleteFramebuffers(1, &sfc->pbuffer.fbo);
return ret;
}
+ if (dbg) DBG("Calling make_current(NULL, NULL)");
if (!evgl_engine->funcs->make_current(eng_data, NULL, NULL, 0))
{
ERR("Error doing make_current(NULL, NULL).");
// Remove it from the list
LKL(evgl_engine->resource_lock);
evgl_engine->surfaces = eina_list_remove(evgl_engine->surfaces, sfc);
- LKU(evgl_engine->resource_lock);
if (sfc->direct_fb_opt &&
(sfc->depth_fmt || sfc->stencil_fmt || sfc->depth_stencil_fmt))
evgl_engine->direct_depth_stencil_surfaces =
eina_list_remove_list(evgl_engine->direct_depth_stencil_surfaces, found);
}
+ LKU(evgl_engine->resource_lock);
if (need_reconfigure)
{
return NULL;
}
+ if (evgl_engine->api_debug_mode)
+ DBG("Creating context GLESv%d (eng = %p, shctx = %p)", version, eng_data, share_ctx);
+
// Allocate context object
ctx = calloc(1, sizeof(EVGL_Context));
if (!ctx)
evgl_engine->contexts = eina_list_prepend(evgl_engine->contexts, ctx);
LKU(evgl_engine->resource_lock);
+ if (evgl_engine->api_debug_mode)
+ DBG("Created ctx %p", ctx);
+
return ctx;
}
-
int
evgl_context_destroy(void *eng_data, EVGL_Context *ctx)
{
+ Eina_Bool dbg;
+
// Check the input
if ((!evgl_engine) || (!ctx))
{
ERR("Invalid input data. Engine: %p Context:%p", evgl_engine, ctx);
return 0;
}
+ dbg = evgl_engine->api_debug_mode;
+
+ // FIXME: this calls make_current(0,0) which probably shouldn't be the case
+ // if the context is not current (?)
+
+ if (dbg) DBG("Destroying context (eng = %p, ctx = %p)", eng_data, ctx);
// Set the context current with resource context/surface
if (!_internal_resource_make_current(eng_data, NULL))
glDeleteFramebuffers(1, &ctx->surface_fbo);
// Unset the currrent context
+ if (dbg) DBG("Calling make_current(NULL, NULL)");
if (!evgl_engine->funcs->make_current(eng_data, NULL, NULL, 0))
{
ERR("Error doing make_current(NULL, NULL).");
int
evgl_make_current(void *eng_data, EVGL_Surface *sfc, EVGL_Context *ctx)
{
+ Eina_Bool dbg = EINA_FALSE;
EVGL_Resource *rsc;
int curr_fbo = 0;
}
// Get TLS Resources
- if (!(rsc = _evgl_tls_resource_get())) return 0;
+ rsc = _evgl_tls_resource_get();
+
+ // Abuse debug mode - extra tracing for make_current and friends
+ dbg = evgl_engine->api_debug_mode;
+ if (dbg) DBG("(eng = %p, sfc = %p, ctx = %p), rsc = %p", eng_data, sfc, ctx, rsc);
+
+ if (!rsc) return 0;
// Unset
if ((!sfc) && (!ctx))
evgl_direct_partial_render_end();
}
+ // FIXME: This code path does not properly set the underlying TLS vars.
+ if (dbg) DBG("Calling make_current(NULL, NULL)");
if (!evgl_engine->funcs->make_current(eng_data, NULL, NULL, 0))
{
ERR("Error doing make_current(NULL, NULL).");
return 0;
}
+
//FIXME!!!
if (rsc->current_ctx)
{
rsc->current_ctx = NULL;
rsc->current_eng = NULL;
}
+ if (dbg) DBG("Call to make_current(NULL, NULL) was successful.");
return 1;
}
{
if (_evgl_direct_renderable(rsc, sfc))
{
+ if (dbg) DBG("sfc %p is direct renderable (has buffers: %d).", sfc, sfc->buffers_allocated);
+
// Destroy created resources
if (sfc->buffers_allocated)
{
// Create internal buffers if not yet created
if (!sfc->buffers_allocated)
{
+ if (dbg) DBG("Allocating buffers for sfc %p", sfc);
if (!_surface_buffers_allocate(eng_data, sfc, sfc->w, sfc->h, 1))
{
ERR("Unable Create Specificed Surfaces. Unsupported format!");
if (ctx->version == EVAS_GL_GLES_1_X)
{
+ if (dbg) DBG("ctx %p is GLES 1", ctx);
if (_evgl_direct_renderable(rsc, sfc))
{
+ if (dbg) DBG("sfc %p is direct renderable.", sfc);
rsc->direct.rendered = 1;
}
else
{
+ if (dbg) DBG("Calling make_current(%p, %p)", sfc->gles1_sfc, ctx->context);
evgl_engine->funcs->make_current(eng_data, sfc->gles1_sfc,
ctx->context, EINA_TRUE);
}
// Direct Rendering
if (_evgl_direct_renderable(rsc, sfc))
{
+ if (dbg) DBG("sfc %p is direct renderable.", sfc);
+
// This is to transition from FBO rendering to direct rendering
glGetIntegerv(GL_FRAMEBUFFER_BINDING, &curr_fbo);
if (ctx->surface_fbo == (GLuint)curr_fbo)
}
else if (sfc->pbuffer.native_surface)
{
+ if (dbg) DBG("Surface sfc %p is a pbuffer: %p", sfc, sfc->pbuffer.native_surface);
+
// Call end tiling
if (rsc->direct.partial.enabled)
evgl_direct_partial_render_end();
ERR("Could not detach current FBO");
}
+ if (dbg) DBG("Calling make_current(%p, %p)", sfc->pbuffer.native_surface, ctx->context);
evgl_engine->funcs->make_current(eng_data, sfc->pbuffer.native_surface,
ctx->context, EINA_TRUE);
}
else
{
+ if (dbg) DBG("Surface sfc %p is a normal surface.", sfc);
+
// Attach fbo and the buffers
if ((ctx->current_sfc != sfc) || (ctx != sfc->current_ctx))
{