forked from enlightenment/efl
Fixed Evas GL direct rendering bug from refactoring. The conditions
weren't set properly where if a program uses evas_gl to do GL rendering in direct rendering mode and then use a pixmap to do native GL rendering in the same program, native pixmap rendering would also fall into the direct rendering path and not render anything for image object. It's been fixed. SVN revision: 79493
This commit is contained in:
parent
2f2ef8042b
commit
995e0a6613
|
@ -68,7 +68,7 @@ _evgl_glBindFramebuffer(GLenum target, GLuint framebuffer)
|
||||||
// Take care of BindFramebuffer 0 issue
|
// Take care of BindFramebuffer 0 issue
|
||||||
if (framebuffer==0)
|
if (framebuffer==0)
|
||||||
{
|
{
|
||||||
if (evgl_direct_enabled(evgl_engine))
|
if (_evgl_direct_enabled(evgl_engine))
|
||||||
glBindFramebuffer(target, 0);
|
glBindFramebuffer(target, 0);
|
||||||
else
|
else
|
||||||
glBindFramebuffer(target, ctx->surface_fbo);
|
glBindFramebuffer(target, ctx->surface_fbo);
|
||||||
|
@ -270,7 +270,7 @@ _evgl_glClear(GLbitfield mask)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (evgl_direct_enabled(evgl_engine))
|
if (_evgl_direct_enabled(evgl_engine))
|
||||||
{
|
{
|
||||||
if (!(rsc->current_ctx->current_fbo))
|
if (!(rsc->current_ctx->current_fbo))
|
||||||
{
|
{
|
||||||
|
@ -351,7 +351,7 @@ _evgl_glGetIntegerv(GLenum pname, GLint* params)
|
||||||
EVGL_Context *ctx;
|
EVGL_Context *ctx;
|
||||||
Evas_Object_Protected_Data *img;
|
Evas_Object_Protected_Data *img;
|
||||||
|
|
||||||
if (evgl_direct_enabled(evgl_engine))
|
if (_evgl_direct_enabled(evgl_engine))
|
||||||
{
|
{
|
||||||
if (!params)
|
if (!params)
|
||||||
{
|
{
|
||||||
|
@ -423,7 +423,7 @@ _evgl_glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum forma
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (evgl_direct_enabled(evgl_engine))
|
if (_evgl_direct_enabled(evgl_engine))
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!(rsc->current_ctx->current_fbo))
|
if (!(rsc->current_ctx->current_fbo))
|
||||||
|
@ -468,7 +468,7 @@ _evgl_glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (evgl_direct_enabled(evgl_engine))
|
if (_evgl_direct_enabled(evgl_engine))
|
||||||
{
|
{
|
||||||
if (!(rsc->current_ctx->current_fbo))
|
if (!(rsc->current_ctx->current_fbo))
|
||||||
{
|
{
|
||||||
|
@ -548,7 +548,7 @@ _evgl_glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (evgl_direct_enabled(evgl_engine))
|
if (_evgl_direct_enabled(evgl_engine))
|
||||||
{
|
{
|
||||||
if (!(rsc->current_ctx->current_fbo))
|
if (!(rsc->current_ctx->current_fbo))
|
||||||
{
|
{
|
||||||
|
|
|
@ -950,12 +950,8 @@ _internal_config_set(EVGL_Engine *ee, EVGL_Surface *sfc, Evas_GL_Config *cfg)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
_evgl_direct_renderable(EVGL_Engine *ee, EVGL_Context *ctx, EVGL_Surface *sfc)
|
_evgl_direct_renderable(EVGL_Engine *ee, EVGL_Resource *rsc, EVGL_Context *ctx, EVGL_Surface *sfc)
|
||||||
{
|
{
|
||||||
EVGL_Resource *rsc;
|
|
||||||
|
|
||||||
if (!(rsc=_evgl_tls_resource_get(ee))) return 0;
|
|
||||||
|
|
||||||
if (ee->force_direct_off) return 0;
|
if (ee->force_direct_off) return 0;
|
||||||
if (rsc->id != ee->main_tid) return 0;
|
if (rsc->id != ee->main_tid) return 0;
|
||||||
if (!ctx) return 0;
|
if (!ctx) return 0;
|
||||||
|
@ -966,7 +962,7 @@ _evgl_direct_renderable(EVGL_Engine *ee, EVGL_Context *ctx, EVGL_Surface *sfc)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------//
|
//---------------------------------------------------------------//
|
||||||
// Retrieve the internal resource object from TLS
|
// Functions used by Evas GL module
|
||||||
//---------------------------------------------------------------//
|
//---------------------------------------------------------------//
|
||||||
EVGL_Resource *
|
EVGL_Resource *
|
||||||
_evgl_tls_resource_get(EVGL_Engine *ee)
|
_evgl_tls_resource_get(EVGL_Engine *ee)
|
||||||
|
@ -1009,6 +1005,37 @@ _evgl_current_context_get()
|
||||||
return rsc->current_ctx;
|
return rsc->current_ctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
_evgl_not_in_pixel_get(EVGL_Engine *ee)
|
||||||
|
{
|
||||||
|
EVGL_Resource *rsc;
|
||||||
|
|
||||||
|
if (!(rsc=_evgl_tls_resource_get(ee))) return 1;
|
||||||
|
|
||||||
|
EVGL_Context *ctx = rsc->current_ctx;
|
||||||
|
|
||||||
|
if ((!ee->force_direct_off) && (rsc->id == ee->main_tid) &&
|
||||||
|
(ctx) && (ctx->current_sfc) && (ctx->current_sfc->direct_fb_opt) &&
|
||||||
|
(!rsc->direct_img_obj))
|
||||||
|
return 1;
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
_evgl_direct_enabled(EVGL_Engine *ee)
|
||||||
|
{
|
||||||
|
EVGL_Resource *rsc;
|
||||||
|
EVGL_Context *ctx;
|
||||||
|
EVGL_Surface *sfc;
|
||||||
|
|
||||||
|
if (!(rsc=_evgl_tls_resource_get(ee))) return 0;
|
||||||
|
if (!(ctx=rsc->current_ctx)) return 0;
|
||||||
|
if (!(sfc=rsc->current_ctx->current_sfc)) return 0;
|
||||||
|
|
||||||
|
return _evgl_direct_renderable(ee, rsc, ctx, sfc);
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------//
|
//---------------------------------------------------------------//
|
||||||
// Exported functions for evas_engine to use
|
// Exported functions for evas_engine to use
|
||||||
|
|
||||||
|
@ -1153,9 +1180,6 @@ int evgl_engine_destroy(EVGL_Engine *ee)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------//
|
|
||||||
// Exported functions for evas_engine to use
|
|
||||||
// - We just need to implement these functions and have evas_engine load them :)
|
|
||||||
void *
|
void *
|
||||||
evgl_surface_create(EVGL_Engine *ee, Evas_GL_Config *cfg, int w, int h)
|
evgl_surface_create(EVGL_Engine *ee, Evas_GL_Config *cfg, int w, int h)
|
||||||
{
|
{
|
||||||
|
@ -1426,7 +1450,7 @@ evgl_make_current(EVGL_Engine *ee, EVGL_Surface *sfc, EVGL_Context *ctx)
|
||||||
glGenFramebuffers(1, &ctx->surface_fbo);
|
glGenFramebuffers(1, &ctx->surface_fbo);
|
||||||
|
|
||||||
// Direct Rendering
|
// Direct Rendering
|
||||||
if (_evgl_direct_renderable(ee, ctx, sfc))
|
if (_evgl_direct_renderable(ee, rsc, ctx, sfc))
|
||||||
{
|
{
|
||||||
// This is to transition from FBO rendering to direct rendering
|
// This is to transition from FBO rendering to direct rendering
|
||||||
glGetIntegerv(GL_FRAMEBUFFER_BINDING, &curr_fbo);
|
glGetIntegerv(GL_FRAMEBUFFER_BINDING, &curr_fbo);
|
||||||
|
@ -1435,7 +1459,7 @@ evgl_make_current(EVGL_Engine *ee, EVGL_Surface *sfc, EVGL_Context *ctx)
|
||||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||||
ctx->current_fbo = 0;
|
ctx->current_fbo = 0;
|
||||||
}
|
}
|
||||||
rsc->direct_enabled = 1;
|
rsc->direct_rendered = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1452,8 +1476,7 @@ evgl_make_current(EVGL_Engine *ee, EVGL_Surface *sfc, EVGL_Context *ctx)
|
||||||
if (ctx->current_fbo)
|
if (ctx->current_fbo)
|
||||||
glBindFramebuffer(GL_FRAMEBUFFER, ctx->current_fbo);
|
glBindFramebuffer(GL_FRAMEBUFFER, ctx->current_fbo);
|
||||||
}
|
}
|
||||||
|
rsc->direct_rendered = 0;
|
||||||
rsc->direct_enabled = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx->current_sfc = sfc;
|
ctx->current_sfc = sfc;
|
||||||
|
@ -1507,30 +1530,13 @@ evgl_native_surface_get(EVGL_Engine *ee, EVGL_Surface *sfc, Evas_Native_Surface
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
_evgl_not_in_pixel_get(EVGL_Engine *ee)
|
evgl_direct_rendered(EVGL_Engine *ee)
|
||||||
{
|
|
||||||
EVGL_Resource *rsc;
|
|
||||||
|
|
||||||
if (!(rsc=_evgl_tls_resource_get(ee))) return 1;
|
|
||||||
|
|
||||||
EVGL_Context *ctx = rsc->current_ctx;
|
|
||||||
|
|
||||||
if ((!ee->force_direct_off) && (rsc->id == ee->main_tid) &&
|
|
||||||
(ctx) && (ctx->current_sfc) && (ctx->current_sfc->direct_fb_opt) &&
|
|
||||||
(!rsc->direct_img_obj))
|
|
||||||
return 1;
|
|
||||||
else
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
evgl_direct_enabled(EVGL_Engine *ee)
|
|
||||||
{
|
{
|
||||||
EVGL_Resource *rsc;
|
EVGL_Resource *rsc;
|
||||||
|
|
||||||
if (!(rsc=_evgl_tls_resource_get(ee))) return 0;
|
if (!(rsc=_evgl_tls_resource_get(ee))) return 0;
|
||||||
|
|
||||||
return rsc->direct_enabled;
|
return rsc->direct_rendered;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -31,7 +31,7 @@ extern void *evgl_proc_address_get(const char *name);
|
||||||
extern int evgl_native_surface_get(EVGL_Engine *ee, EVGL_Surface *sfc, Evas_Native_Surface *ns);
|
extern int evgl_native_surface_get(EVGL_Engine *ee, EVGL_Surface *sfc, Evas_Native_Surface *ns);
|
||||||
extern Evas_GL_API *evgl_api_get(EVGL_Engine *ee);
|
extern Evas_GL_API *evgl_api_get(EVGL_Engine *ee);
|
||||||
|
|
||||||
extern int evgl_direct_enabled(EVGL_Engine *ee);
|
extern int evgl_direct_rendered(EVGL_Engine *ee);
|
||||||
extern void evgl_direct_img_obj_set(EVGL_Engine *ee, Evas_Object *img);
|
extern void evgl_direct_img_obj_set(EVGL_Engine *ee, Evas_Object *img);
|
||||||
extern Evas_Object *evgl_direct_img_obj_get(EVGL_Engine *ee);
|
extern Evas_Object *evgl_direct_img_obj_get(EVGL_Engine *ee);
|
||||||
|
|
||||||
|
|
|
@ -200,7 +200,7 @@ struct _EVGL_Resource
|
||||||
|
|
||||||
EVGL_Context *current_ctx;
|
EVGL_Context *current_ctx;
|
||||||
|
|
||||||
int direct_enabled;
|
int direct_rendered;
|
||||||
Evas_Object *direct_img_obj;
|
Evas_Object *direct_img_obj;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -249,5 +249,6 @@ extern void _evgl_api_get(Evas_GL_API *api, int debug);
|
||||||
extern EVGL_Resource *_evgl_tls_resource_get(EVGL_Engine *ee);
|
extern EVGL_Resource *_evgl_tls_resource_get(EVGL_Engine *ee);
|
||||||
extern EVGL_Context *_evgl_current_context_get();
|
extern EVGL_Context *_evgl_current_context_get();
|
||||||
extern int _evgl_not_in_pixel_get();
|
extern int _evgl_not_in_pixel_get();
|
||||||
|
extern int _evgl_direct_enabled(EVGL_Engine *ee);
|
||||||
|
|
||||||
#endif //_EVAS_GL_CORE_PRIVATE_H
|
#endif //_EVAS_GL_CORE_PRIVATE_H
|
||||||
|
|
|
@ -2491,10 +2491,12 @@ eng_image_draw(void *data, void *context, void *surface, void *image, int src_x,
|
||||||
Render_Engine *re;
|
Render_Engine *re;
|
||||||
re = (Render_Engine *)data;
|
re = (Render_Engine *)data;
|
||||||
Evas_GL_Image *im = image;
|
Evas_GL_Image *im = image;
|
||||||
|
Native *n;
|
||||||
|
|
||||||
if (!im) return;
|
if (!im) return;
|
||||||
|
n = im->native.data;
|
||||||
|
|
||||||
if ((im->native.data) && evgl_direct_enabled(re->evgl_engine))
|
if ((n) && (n->ns.type == EVAS_NATIVE_SURFACE_OPENGL) && (evgl_direct_rendered(re->evgl_engine)))
|
||||||
{
|
{
|
||||||
DBG("Rendering Directly to the window");
|
DBG("Rendering Directly to the window");
|
||||||
evas_object_image_pixels_dirty_set(evgl_direct_img_obj_get(re->evgl_engine), EINA_TRUE);
|
evas_object_image_pixels_dirty_set(evgl_direct_img_obj_get(re->evgl_engine), EINA_TRUE);
|
||||||
|
|
Loading…
Reference in New Issue