jpeg pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=ae91db021bc9817afd28968660e8a9067b358f41

commit ae91db021bc9817afd28968660e8a9067b358f41
Author: Dongyeon Kim <dy5....@samsung.com>
Date:   Mon May 11 19:57:22 2015 +0900

    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
---
 .../evas/engines/gl_common/evas_gl_api_ext.c       | 64 +++++++++++++++++++++-
 .../evas/engines/gl_common/evas_gl_api_ext_def.h   |  7 ++-
 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 639f60c..5506ae1 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 f20c3a7..79d5f19 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)
 

-- 


Reply via email to