summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDongyeon Kim <dy5.kim@samsung.com>2015-05-11 19:57:22 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2015-06-03 11:30:22 +0900
commitae91db021bc9817afd28968660e8a9067b358f41 (patch)
treec43a0acc00f35e6f065e68c70ddcfe206a625392
parente4e67732c26d581ff0cf3ae3ef4d5f460b574e60 (diff)
downloadefl-ae91db021bc9817afd28968660e8a9067b358f41.tar.gz
Evas GL: Pass correct attachment enum for glDiscardFramebufferEXT
Summary: When default framebuffer(0) is bound, attachment should contain COLOR, DEPTH or STENCIL for glDiscardFramebufferEXT. When a framebuffer object is bound, attachment should contain COLOR_ATTACHMENT0, DEPTH_ATTACHMENT or STENCIL_ATTACHMENT. This should be correctly taken into account for indirect rendering, where internal FBO is used. @fix
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_api_ext.c64
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_api_ext_def.h7
2 files changed, 69 insertions, 2 deletions
diff --git a/src/modules/evas/engines/gl_common/evas_gl_api_ext.c b/src/modules/evas/engines/gl_common/evas_gl_api_ext.c
index 639f60cf5b..5506ae1488 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_api_ext.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_api_ext.c
@@ -311,10 +311,72 @@ evgl_evasglQueryWaylandBuffer(Evas_GL *evas_gl EINA_UNUSED,
return EXT_FUNC_EGL(eglQueryWaylandBufferWL)(dpy, buffer, attribute, value);
}
-
#else
#endif
+static void
+evgl_glDiscardFramebufferEXT(GLenum target, GLsizei numAttachments, const GLenum* attachments)
+{
+ EVGL_Resource *rsc;
+ EVGL_Context *ctx;
+ Eina_Bool target_is_fbo = EINA_FALSE;
+
+ if (!(rsc=_evgl_tls_resource_get()))
+ {
+ ERR("Unable to execute GL command. Error retrieving tls");
+ return;
+ }
+
+ if (!rsc->current_eng)
+ {
+ ERR("Unable to retrive Current Engine");
+ return;
+ }
+
+ ctx = rsc->current_ctx;
+ if (!ctx)
+ {
+ ERR("Unable to retrive Current Context");
+ return;
+ }
+
+ if (!_evgl_direct_enabled())
+ {
+ if (ctx->current_fbo == 0)
+ target_is_fbo = EINA_TRUE;
+ }
+
+ if (target_is_fbo && numAttachments)
+ {
+ GLenum *att;
+ int i = 0;
+ att = (GLenum *)calloc(1, numAttachments * sizeof(GLenum));
+ if (!att)
+ return;
+
+ memcpy(att, attachments, numAttachments * sizeof(GLenum));
+ while (i < numAttachments)
+ {
+ if (att[i] == GL_COLOR_EXT)
+ att[i] = GL_COLOR_ATTACHMENT0;
+ else if (att[i] == GL_DEPTH_EXT)
+ att[i] = GL_DEPTH_ATTACHMENT;
+ else if (att[i] == GL_STENCIL_EXT)
+ att[i] = GL_STENCIL_ATTACHMENT;
+ i++;
+ }
+ EXT_FUNC(glDiscardFramebuffer)(target, numAttachments, att);
+ free(att);
+ }
+ else
+ {
+ EXT_FUNC(glDiscardFramebuffer)(target, numAttachments, attachments);
+ }
+}
+
+
+
+
// 0: not initialized,
// 1: GLESv2 initialized,
// 3: GLESv1 and GLESv2 initialized,
diff --git a/src/modules/evas/engines/gl_common/evas_gl_api_ext_def.h b/src/modules/evas/engines/gl_common/evas_gl_api_ext_def.h
index f20c3a7893..79d5f19906 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_api_ext_def.h
+++ b/src/modules/evas/engines/gl_common/evas_gl_api_ext_def.h
@@ -183,13 +183,18 @@ _EVASGL_EXT_END()
_EVASGL_EXT_BEGIN(discard_framebuffer)
_EVASGL_EXT_DRVNAME(GL_EXT_discard_framebuffer)
- _EVASGL_EXT_FUNCTION_BEGIN(void, glDiscardFramebufferEXT, (GLenum target, GLsizei numAttachments, const GLenum* attachments))
+ _EVASGL_EXT_FUNCTION_PRIVATE_BEGIN(void, glDiscardFramebuffer, (GLenum target, GLsizei numAttachments, const GLenum* attachments))
_EVASGL_EXT_FUNCTION_DRVFUNC_PROCADDR("glDiscardFramebuffer")
_EVASGL_EXT_FUNCTION_DRVFUNC_PROCADDR("glDiscardFramebufferEXT")
+ _EVASGL_EXT_FUNCTION_PRIVATE_END()
+
+ _EVASGL_EXT_FUNCTION_BEGIN(void, glDiscardFramebufferEXT, (GLenum target, GLsizei numAttachments, const GLenum* attachments))
+ _EVASGL_EXT_FUNCTION_DRVFUNC(evgl_glDiscardFramebufferEXT)
_EVASGL_EXT_FUNCTION_END()
_EVASGL_EXT_END()
+
_EVASGL_EXT_BEGIN(multi_draw_arrays)
_EVASGL_EXT_DRVNAME(GL_EXT_multi_draw_arrays)