coregl_fastpath: Separate glColorMask state from glColorMaski and glColorMaskiOES 85/95585/5
authorxing.huang <xing.huang@samsung.com>
Fri, 4 Nov 2016 01:57:35 +0000 (09:57 +0800)
committerGwan-gyeong Mun <kk.moon@samsung.com>
Mon, 7 Nov 2016 05:01:49 +0000 (21:01 -0800)
Fix showing of black screen while efl_webview_app renders aquarium.html page. ( test command: COREGL_FASTPATH=1 /usr/apps/org.tizen.chromium-efl/bin/efl_webview_app http://webglsamples.org/aquarium/aquarium.html )

- Reason:
   glColorMask, glColorMaski and glColorMaskiOES share common gl_color_writemask
   state, gl_color_writemask's size was obtained by glGetIntegerv(GL_MAX_COLOR_ATTACHMENTS).
   But, tm1 gl driver does not support GL_MAX_COLOR_ATTACHMENTS.
   So, if "gl_color_writemask_num = 0" in the fastpath_glColorMask, it bypasses the calling of glColorMask to GLES/EGL Driver.

- Solution:
   Separate the glColorMask from glColorMaski and glColorMaskiOES.
   And assign another array to store state of glColorMask.

Signed-off-by: xing.huang <xing.huang@samsung.com>
Change-Id: Ia9250ece2ffa5f6ea750f92b68bf3bbcfb577bc8

src/modules/fastpath/coregl_fastpath.c
src/modules/fastpath/coregl_fastpath.h
src/modules/fastpath/coregl_fastpath_gl.c
src/modules/fastpath/coregl_fastpath_state.h

index a1b2f24..30b2df6 100644 (file)
@@ -2157,6 +2157,12 @@ fastpath_make_context_current(GLGlueContext *oldctx, GLGlueContext *newctx)
                                                           (newctx->gl_color_writemask + i)[3]))
                        }
                }
+               if STATES_COMPARE(gl_color_writemask_for_glColorMask, 4 * sizeof(GLboolean)) {
+                       CHECK_GL_ERROR(_orig_fastpath_glColorMask(newctx->gl_color_writemask_for_glColorMask[0],
+                                                  newctx->gl_color_writemask_for_glColorMask[1],
+                                                  newctx->gl_color_writemask_for_glColorMask[2],
+                                                  newctx->gl_color_writemask_for_glColorMask[3]))
+               }
                if STATES_COMPARE(gl_depth_range, 2 * sizeof(GLclampf)) {
                        CHECK_GL_ERROR(_orig_fastpath_glDepthRangef(newctx->gl_depth_range[0],
                                                   newctx->gl_depth_range[1]))
index bb7a837..19322ab 100644 (file)
@@ -276,6 +276,8 @@ typedef struct _GLGlueContext {
 #define _CLEAR_FLAG2_BIT_gl_depth_func          FLAG_BIT_3
 #define _CLEAR_FLAG2_BIT_gl_depth_writemask     FLAG_BIT_4
 #define _CLEAR_FLAG2_BIT_gl_cull_face_mode      FLAG_BIT_5
+#define _CLEAR_FLAG2_BIT_gl_color_writemask_for_glColorMask     FLAG_BIT_6
+
 
        unsigned char           _tex_flag1;
 #define _TEX_FLAG1_BIT_gl_active_texture         FLAG_BIT_0
index 57c7d5e..035854d 100644 (file)
@@ -3153,26 +3153,17 @@ fastpath_glColorMask(GLboolean red, GLboolean green, GLboolean blue,
        DEFINE_FASTPAH_GL_FUNC();
        _COREGL_FASTPATH_FUNC_BEGIN();
        INIT_FASTPATH_GL_FUNC();
-       GLint index;
-       GLboolean changed = GL_FALSE;
 
-       for (index = 0; index < current_ctx->gl_color_writemask_num[0]; index++) {
-               if (CURR_STATE_COMPARE(gl_color_writemask, 0 + 4 * index, red) ||
-                               CURR_STATE_COMPARE(gl_color_writemask, 1 + 4 * index, green) ||
-                               CURR_STATE_COMPARE(gl_color_writemask, 2 + 4 * index, blue) ||
-                               CURR_STATE_COMPARE(gl_color_writemask, 3 + 4 * index, alpha))
-                       changed = GL_TRUE;
-       }
-
-       if (changed) {
+       if (CURR_STATE_COMPARE(gl_color_writemask_for_glColorMask, 0, red) ||
+                       CURR_STATE_COMPARE(gl_color_writemask_for_glColorMask, 1, green) ||
+                       CURR_STATE_COMPARE(gl_color_writemask_for_glColorMask, 2, blue) ||
+                       CURR_STATE_COMPARE(gl_color_writemask_for_glColorMask, 3, alpha)) {
                IF_GL_SUCCESS(_orig_fastpath_glColorMask(red, green, blue, alpha)) {
-                       current_ctx->_clear_flag2 |= _CLEAR_FLAG2_BIT_gl_color_writemask;
-                       for (index = 0; index < current_ctx->gl_color_writemask_num[0]; index++) {
-                               CURR_STATE_UPDATE(gl_color_writemask, 0 + 4 * index, red)
-                               CURR_STATE_UPDATE(gl_color_writemask, 1 + 4 * index, green)
-                               CURR_STATE_UPDATE(gl_color_writemask, 2 + 4 * index, blue)
-                               CURR_STATE_UPDATE(gl_color_writemask, 3 + 4 * index, alpha)
-                       }
+                       current_ctx->_clear_flag2 |= _CLEAR_FLAG2_BIT_gl_color_writemask_for_glColorMask;
+                       CURR_STATE_UPDATE(gl_color_writemask_for_glColorMask, 0, red)
+                       CURR_STATE_UPDATE(gl_color_writemask_for_glColorMask, 1, green)
+                       CURR_STATE_UPDATE(gl_color_writemask_for_glColorMask, 2, blue)
+                       CURR_STATE_UPDATE(gl_color_writemask_for_glColorMask, 3, alpha)
                }
        }
        goto finish;
index 570ee5b..855fd32 100644 (file)
@@ -298,6 +298,10 @@ GLUE_STATE(GLboolean, gl_color_writemask,
                   4 * INITIAL_CTX->gl_color_writemask_num[0],
                   SET_N(4 * INITIAL_CTX->gl_color_writemask_num[0], 1, SET_1(GL_TRUE)),
                   _sym_glGetBooleanv(GL_COLOR_WRITEMASK, (GLboolean *)value);)
+
+GLUE_STATE(GLboolean, gl_color_writemask_for_glColorMask, 4, 4, SET_4(GL_TRUE, GL_TRUE, GL_TRUE,
+                  GL_TRUE), _sym_glGetBooleanv(GL_COLOR_WRITEMASK, (GLboolean *)value);)
+
 GLUE_STATE(GLclampf, gl_depth_range, 2, 2, SET_2(0.0f, 1.0f),
                   _sym_glGetFloatv(GL_DEPTH_RANGE, (GLfloat *)value);)
 GLUE_STATE(GLclampf, gl_depth_clear_value, 1, 1, SET_1(1.0f),