[Title] Stabilized ES3.0 Fastpath - trace option & vertex array..
authorHaegeun Park <haegeun.park@samsung.com>
Tue, 26 Nov 2013 07:00:17 +0000 (23:00 -0800)
committerHaegeun Park <haegeun.park@samsung.com>
Tue, 26 Nov 2013 08:14:08 +0000 (00:14 -0800)
[Issue#]
[Problem]
[Cause] Indicator & address bar in the browser app are broken
[Solution]
- Fixed bugs of detecting vertex array object
- Fixed the trace option output mechanism & default value..

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

index 21de2a1..7ee44a5 100644 (file)
@@ -39,7 +39,7 @@ _state_get_texture_states(GLenum pname, GLint *params)
        for (i = 0; i < initial_ctx->gl_num_tex_units[0]; i++)
        {
                _orig_fastpath_glActiveTexture(GL_TEXTURE0 + i);
-               _orig_fastpath_glGetIntegerv(pname, &(((GLint *)params)[i]));
+               _orig_fastpath_glGetIntegerv(pname, (GLint *)&params[i]);
        }
        _orig_fastpath_glActiveTexture(cur_active_tex);
 }
@@ -47,22 +47,13 @@ _state_get_texture_states(GLenum pname, GLint *params)
 static void
 _state_get_draw_buffers(GLenum *params)
 {
-       _orig_fastpath_glGetIntegerv(GL_DRAW_BUFFER0, &(((GLint *)params)[0]));
-       _orig_fastpath_glGetIntegerv(GL_DRAW_BUFFER1, &(((GLint *)params)[1]));
-       _orig_fastpath_glGetIntegerv(GL_DRAW_BUFFER2, &(((GLint *)params)[2]));
-       _orig_fastpath_glGetIntegerv(GL_DRAW_BUFFER3, &(((GLint *)params)[3]));
-       _orig_fastpath_glGetIntegerv(GL_DRAW_BUFFER4, &(((GLint *)params)[4]));
-       _orig_fastpath_glGetIntegerv(GL_DRAW_BUFFER5, &(((GLint *)params)[5]));
-       _orig_fastpath_glGetIntegerv(GL_DRAW_BUFFER6, &(((GLint *)params)[6]));
-       _orig_fastpath_glGetIntegerv(GL_DRAW_BUFFER7, &(((GLint *)params)[7]));
-       _orig_fastpath_glGetIntegerv(GL_DRAW_BUFFER8, &(((GLint *)params)[8]));
-       _orig_fastpath_glGetIntegerv(GL_DRAW_BUFFER9, &(((GLint *)params)[9]));
-       _orig_fastpath_glGetIntegerv(GL_DRAW_BUFFER10, &(((GLint *)params)[10]));
-       _orig_fastpath_glGetIntegerv(GL_DRAW_BUFFER11, &(((GLint *)params)[11]));
-       _orig_fastpath_glGetIntegerv(GL_DRAW_BUFFER12, &(((GLint *)params)[12]));
-       _orig_fastpath_glGetIntegerv(GL_DRAW_BUFFER13, &(((GLint *)params)[13]));
-       _orig_fastpath_glGetIntegerv(GL_DRAW_BUFFER14, &(((GLint *)params)[14]));
-       _orig_fastpath_glGetIntegerv(GL_DRAW_BUFFER15, &(((GLint *)params)[15]));
+       AST(initial_ctx != NULL);
+
+       int i;
+       for (i = 0; i < initial_ctx->gl_num_draw_buffers[0]; i++)
+       {
+               _orig_fastpath_glGetIntegerv(GL_DRAW_BUFFER0 + i, (GLint *)&params[i]);
+       }
 }
 
 static void
@@ -73,7 +64,7 @@ _state_get_transform_feedback_buffer_bindings(GLuint *params)
        int i;
        for (i = 0; i < initial_ctx->gl_num_transform_feedback_separate_attribs[0]; i++)
        {
-               _orig_fastpath_glGetIntegeri_v(GL_TRANSFORM_FEEDBACK_BUFFER_BINDING, i, &(((GLint *)params)[i]));
+               _orig_fastpath_glGetIntegeri_v(GL_TRANSFORM_FEEDBACK_BUFFER_BINDING, i, (GLint *)&params[i]);
        }
 }
 
@@ -85,7 +76,7 @@ _state_get_transform_feedback_buffer_bindings_offset(GLintptr *params)
        int i;
        for (i = 0; i < initial_ctx->gl_num_transform_feedback_separate_attribs[0]; i++)
        {
-               _orig_fastpath_glGetIntegeri_v(GL_TRANSFORM_FEEDBACK_BUFFER_START, i, &(((GLint *)params)[i]));
+               _orig_fastpath_glGetIntegeri_v(GL_TRANSFORM_FEEDBACK_BUFFER_START, i, (GLint *)&params[i]);
        }
 }
 
@@ -97,7 +88,7 @@ _state_get_transform_feedback_buffer_bindings_size(GLsizeiptr *params)
        int i;
        for (i = 0; i < initial_ctx->gl_num_transform_feedback_separate_attribs[0]; i++)
        {
-               _orig_fastpath_glGetIntegeri_v(GL_TRANSFORM_FEEDBACK_BUFFER_SIZE, i, &(((GLint *)params)[i]));
+               _orig_fastpath_glGetIntegeri_v(GL_TRANSFORM_FEEDBACK_BUFFER_SIZE, i, (GLint *)&params[i]);
        }
 }
 
@@ -112,7 +103,7 @@ _state_get_uniform_buffer_bindings(GLuint *params)
 /////////////////////////////////////////////////////////////////////////////////
 // XXXX : AVOID SEGFAULT in ADRENO
                ((GLint *)params)[i] = 0;
-//             _orig_fastpath_glGetIntegeri_v(GL_UNIFORM_BUFFER_BINDING, i, &(((GLint *)params)[i]));
+//             _orig_fastpath_glGetIntegeri_v(GL_UNIFORM_BUFFER_BINDING, i, (GLint *)&params[i]);
 /////////////////////////////////////////////////////////////////////////////////
        }
 }
@@ -125,7 +116,7 @@ _state_get_uniform_buffer_bindings_offset(GLintptr *params)
        int i;
        for (i = 0; i < initial_ctx->gl_num_uniform_buffer_bindings[0]; i++)
        {
-               _orig_fastpath_glGetIntegeri_v(GL_UNIFORM_BUFFER_START, i, &(((GLint *)params)[i]));
+               _orig_fastpath_glGetIntegeri_v(GL_UNIFORM_BUFFER_START, i, (GLint *)&params[i]);
        }
 }
 
@@ -137,7 +128,7 @@ _state_get_uniform_buffer_bindings_size(GLsizeiptr *params)
        int i;
        for (i = 0; i < initial_ctx->gl_num_uniform_buffer_bindings[0]; i++)
        {
-               _orig_fastpath_glGetIntegeri_v(GL_UNIFORM_BUFFER_SIZE, i, &(((GLint *)params)[i]));
+               _orig_fastpath_glGetIntegeri_v(GL_UNIFORM_BUFFER_SIZE, i, (GLint *)&params[i]);
        }
 }
 
@@ -1204,7 +1195,7 @@ fastpath_dump_context_states(GLGlueContext *ctx, int force_output)
        TRACE("\E[40;32;1m  State info \E[1;37;1m: <PID = %d> GlueCTX = %p\E[0m\n", getpid(), ctx);
        TRACE("\E[0;40;34m========================================================================================================================\E[0m\n");
 
-#define PRINTF_CHAR_GLenum "%10d"
+#define PRINTF_CHAR_GLenum "0x%8X"
 #define PRINTF_CHAR_GLboolean "%10d"
 #define PRINTF_CHAR_GLint "%10d"
 #define PRINTF_CHAR_GLsizei "%10u"
@@ -1235,8 +1226,10 @@ fastpath_dump_context_states(GLGlueContext *ctx, int force_output)
             else \
                TRACE(", "); \
          } \
+         if (ctx->NAME[i] != value[i]) { TRACE("\E[40;31;1m"); } \
          TRACE(PRINTF_CHAR(TYPE), ctx->NAME[i]); \
          TRACE("["PRINTF_CHAR(TYPE)"]", value[i]); \
+         if (ctx->NAME[i] != value[i]) { TRACE("\E[0m"); } \
       } \
       TRACE(" \E[40;37;1m)\E[0m\n"); \
    }
@@ -1577,7 +1570,6 @@ fastpath_make_context_current(GLGlueContext *oldctx, GLGlueContext *newctx)
                {
                        CHECK_GL_ERROR(_orig_fastpath_glBindBuffer(GL_UNIFORM_BUFFER, newctx->gl_uniform_buffer_binding[0]))
                }
-               // ANGLE_framebuffer_blit BEGIN
                if (newctx->gl_framebuffer_binding_read_used == 1)
                {
                        STATE_COMPARE(gl_framebuffer_binding_read[0])
@@ -1590,7 +1582,6 @@ fastpath_make_context_current(GLGlueContext *oldctx, GLGlueContext *newctx)
                        }
                }
                else
-               // ANGLE_framebuffer_blit END
                {
                        STATE_COMPARE(gl_framebuffer_binding[0])
                        {
index aaf5114..902741c 100644 (file)
@@ -33,7 +33,7 @@ int kill(pid_t pid, int sig);
    GET_MY_TSTATE(tstate, get_current_thread_state()); \
    if (tstate == NULL || tstate->cstate == NULL) \
    { \
-               COREGL_WRN("\E[40;31;1m'%s' called when GLES2 context is not binded (Check MakeCurrent)!\E[0m\n", __func__); \
+               COREGL_WRN("\E[40;31;1m'%s' called when GLES context is not binded (Check MakeCurrent)!\E[0m\n", __func__); \
                goto finish; \
    } \
    current_ctx = (GLGlueContext *)tstate->cstate->data; \
@@ -3119,7 +3119,7 @@ fastpath_glDisableVertexAttribArray(GLuint index)
 
        IF_GL_SUCCESS(_orig_fastpath_glDisableVertexAttribArray(index))
        {
-               if (current_ctx->gl_vertex_array_binding == 0)
+               if (current_ctx->gl_vertex_array_binding[0] == 0)
                {
                        current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_array;
                        current_ctx->gl_vertex_array_enabled[index] = GL_FALSE;
@@ -3206,7 +3206,7 @@ fastpath_glEnableVertexAttribArray(GLuint index)
 
        IF_GL_SUCCESS(_orig_fastpath_glEnableVertexAttribArray(index))
        {
-               if (current_ctx->gl_vertex_array_binding == 0)
+               if (current_ctx->gl_vertex_array_binding[0] == 0)
                {
                        current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_array;
                        current_ctx->gl_vertex_array_enabled[index] = GL_TRUE;
@@ -3722,7 +3722,7 @@ fastpath_glVertexAttrib1f(GLuint index, GLfloat x)
 
        IF_GL_SUCCESS(_orig_fastpath_glVertexAttrib1f(index, x))
        {
-               if (current_ctx->gl_vertex_array_binding == 0)
+               if (current_ctx->gl_vertex_array_binding[0] == 0)
                {
                        current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_attrib_value;
                        current_ctx->gl_vertex_array_size[index] = 0;
@@ -3750,7 +3750,7 @@ fastpath_glVertexAttrib1fv(GLuint index, const GLfloat* values)
 
        IF_GL_SUCCESS(_orig_fastpath_glVertexAttrib1fv(index, values))
        {
-               if (current_ctx->gl_vertex_array_binding == 0)
+               if (current_ctx->gl_vertex_array_binding[0] == 0)
                {
                        current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_attrib_value;
                        current_ctx->gl_vertex_array_size[index] = 0;
@@ -3778,7 +3778,7 @@ fastpath_glVertexAttrib2f(GLuint index, GLfloat x, GLfloat y)
 
        IF_GL_SUCCESS(_orig_fastpath_glVertexAttrib2f(index, x, y))
        {
-               if (current_ctx->gl_vertex_array_binding == 0)
+               if (current_ctx->gl_vertex_array_binding[0] == 0)
                {
                        current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_attrib_value;
                        current_ctx->gl_vertex_array_size[index] = 0;
@@ -3806,7 +3806,7 @@ fastpath_glVertexAttrib2fv(GLuint index, const GLfloat* values)
 
        IF_GL_SUCCESS(_orig_fastpath_glVertexAttrib2fv(index, values))
        {
-               if (current_ctx->gl_vertex_array_binding == 0)
+               if (current_ctx->gl_vertex_array_binding[0] == 0)
                {
                        current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_attrib_value;
                        current_ctx->gl_vertex_array_size[index] = 0;
@@ -3834,7 +3834,7 @@ fastpath_glVertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z)
 
        IF_GL_SUCCESS(_orig_fastpath_glVertexAttrib3f(index, x, y, z))
        {
-               if (current_ctx->gl_vertex_array_binding == 0)
+               if (current_ctx->gl_vertex_array_binding[0] == 0)
                {
                        current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_attrib_value;
                        current_ctx->gl_vertex_array_size[index] = 0;
@@ -3862,7 +3862,7 @@ fastpath_glVertexAttrib3fv(GLuint index, const GLfloat* values)
 
        IF_GL_SUCCESS(_orig_fastpath_glVertexAttrib3fv(index, values))
        {
-               if (current_ctx->gl_vertex_array_binding == 0)
+               if (current_ctx->gl_vertex_array_binding[0] == 0)
                {
                        current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_attrib_value;
                        current_ctx->gl_vertex_array_size[index] = 0;
@@ -3890,7 +3890,7 @@ fastpath_glVertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat
 
        IF_GL_SUCCESS(_orig_fastpath_glVertexAttrib4f(index, x, y, z, w))
        {
-               if (current_ctx->gl_vertex_array_binding == 0)
+               if (current_ctx->gl_vertex_array_binding[0] == 0)
                {
                        current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_attrib_value;
                        current_ctx->gl_vertex_array_size[index] = 0;
@@ -3918,7 +3918,7 @@ fastpath_glVertexAttrib4fv(GLuint index, const GLfloat* values)
 
        IF_GL_SUCCESS(_orig_fastpath_glVertexAttrib4fv(index, values))
        {
-               if (current_ctx->gl_vertex_array_binding == 0)
+               if (current_ctx->gl_vertex_array_binding[0] == 0)
                {
                        current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_attrib_value;
                        current_ctx->gl_vertex_array_size[index] = 0;
@@ -3946,7 +3946,7 @@ fastpath_glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean
 
        IF_GL_SUCCESS(_orig_fastpath_glVertexAttribPointer(index, size, type, normalized, stride, pointer))
        {
-               if (current_ctx->gl_vertex_array_binding == 0)
+               if (current_ctx->gl_vertex_array_binding[0] == 0)
                {
                        current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_array;
 
@@ -5101,7 +5101,7 @@ fastpath_glVertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei s
 
        IF_GL_SUCCESS(_orig_fastpath_glVertexAttribIPointer(index, size, type, stride, pointer))
        {
-               if (current_ctx->gl_vertex_array_binding == 0)
+               if (current_ctx->gl_vertex_array_binding[0] == 0)
                {
                        current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_array;
 
@@ -5130,7 +5130,7 @@ fastpath_glVertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w)
 
        IF_GL_SUCCESS(_orig_fastpath_glVertexAttribI4i(index, x, y, z, w))
        {
-               if (current_ctx->gl_vertex_array_binding == 0)
+               if (current_ctx->gl_vertex_array_binding[0] == 0)
                {
                        current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_attrib_value;
                        current_ctx->gl_vertex_array_size[index] = 0;
@@ -5159,7 +5159,7 @@ fastpath_glVertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w
 
        IF_GL_SUCCESS(_orig_fastpath_glVertexAttribI4ui(index, x, y, z, w))
        {
-               if (current_ctx->gl_vertex_array_binding == 0)
+               if (current_ctx->gl_vertex_array_binding[0] == 0)
                {
                        current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_attrib_value;
                        current_ctx->gl_vertex_array_size[index] = 0;
@@ -5188,7 +5188,7 @@ fastpath_glVertexAttribI4iv(GLuint index, const GLint* v)
 
        IF_GL_SUCCESS(_orig_fastpath_glVertexAttribI4iv(index, v))
        {
-               if (current_ctx->gl_vertex_array_binding == 0)
+               if (current_ctx->gl_vertex_array_binding[0] == 0)
                {
                        current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_attrib_value;
                        current_ctx->gl_vertex_array_size[index] = 0;
@@ -5217,7 +5217,7 @@ fastpath_glVertexAttribI4uiv(GLuint index, const GLuint* v)
 
        IF_GL_SUCCESS(_orig_fastpath_glVertexAttribI4uiv(index, v))
        {
-               if (current_ctx->gl_vertex_array_binding == 0)
+               if (current_ctx->gl_vertex_array_binding[0] == 0)
                {
                        current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_attrib_value;
                        current_ctx->gl_vertex_array_size[index] = 0;
@@ -5809,7 +5809,7 @@ fastpath_glVertexAttribDivisor(GLuint index, GLuint divisor)
 
        IF_GL_SUCCESS(_orig_fastpath_glVertexAttribDivisor(index, divisor))
        {
-               if (current_ctx->gl_vertex_array_binding == 0)
+               if (current_ctx->gl_vertex_array_binding[0] == 0)
                {
                        current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_array;
                        current_ctx->gl_vertex_array_divisor[index] = divisor;
index 7a2cfb6..76fda11 100644 (file)
       } \
    }
 
+GLUE_STATE(GLuint, gl_num_draw_buffers, 1, 1,
+           _sym_glGetIntegerv(GL_MAX_DRAW_BUFFERS, (GLint *)value); /* DEFAULT NOT EFFECT */,
+           _sym_glGetIntegerv(GL_MAX_DRAW_BUFFERS, (GLint *)value);)
+
 GLUE_STATE(GLuint, gl_num_tex_units, 1, 1,
            _sym_glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, (GLint *)value); /* DEFAULT NOT EFFECT */,
            _sym_glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, (GLint *)value);)
@@ -66,10 +70,8 @@ GLUE_STATE(GLsizeiptr, gl_uniform_buffer_binding_array_size, INITIAL_CTX->gl_num
        _state_get_uniform_buffer_bindings_size(value);)
 
 GLUE_STATE(GLuint, gl_framebuffer_binding, 1, 1, SET_1(0), _sym_glGetIntegerv(GL_FRAMEBUFFER_BINDING, (GLint *)value);)
-// ANGLE_framebuffer_blit BEGIN (check gl_framebuffer_binding_read_used)
 GLUE_STATE(GLuint, gl_framebuffer_binding_read, 1, 1, SET_1(0), _sym_glGetIntegerv(GL_READ_FRAMEBUFFER_BINDING_ANGLE, (GLint *)value);)
 GLUE_STATE(GLuint, gl_framebuffer_binding_draw, 1, 1, SET_1(0), _sym_glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING_ANGLE, (GLint *)value);)
-// ANGLE_framebuffer_blit END
 GLUE_STATE(GLuint, gl_renderbuffer_binding, 1, 1, SET_1(0), _sym_glGetIntegerv(GL_RENDERBUFFER_BINDING, (GLint *)value);)
 
 GLUE_STATE(GLboolean, gl_blend, 1, 1, SET_1(GL_FALSE), _sym_glGetBooleanv(GL_BLEND, (GLboolean *)value);)
@@ -218,8 +220,8 @@ GLUE_STATE(GLuint, gl_vertex_attrib_value_unsigned_integer, 4 * INITIAL_CTX->gl_
 
 // MISC FLAG 3
 GLUE_STATE(GLenum, gl_read_buffer, 1, 1, SET_1(GL_BACK), _sym_glGetIntegerv(GL_READ_BUFFER, (GLint *)value);)
-GLUE_STATE(GLenum, gl_draw_buffers, 16, 16,
-           _state_get_draw_buffers(value); /* DEFAULT NOT EFFECT */,
+GLUE_STATE(GLenum, gl_draw_buffers, INITIAL_CTX->gl_num_draw_buffers[0], 16,
+           SET_1(GL_BACK); value++; SET_N(INITIAL_CTX->gl_num_draw_buffers[0] - 1, 1, SET_1(GL_NONE)),
            _state_get_draw_buffers(value);)
 GLUE_STATE(GLuint, gl_vertex_array_binding, 1, 1, SET_1(0), _sym_glGetIntegerv(GL_VERTEX_ARRAY_BINDING, (GLint *)value);)
 GLUE_STATE(GLuint, gl_transform_feedback_binding, 1, 1, SET_1(0), _sym_glGetIntegerv(GL_TRANSFORM_FEEDBACK_BINDING, (GLint *)value);)
index af6a512..00b5939 100755 (executable)
@@ -64,6 +64,7 @@ struct _Surface_Data
 
 typedef struct _GLGlueFakeContext
 {
+       GLuint gl_num_draw_buffers[1];
        GLuint gl_num_tex_units[1];
        GLuint gl_num_vertex_attribs[1];
        GLuint gl_num_transform_feedback_separate_attribs[1];
@@ -98,7 +99,7 @@ _state_get_texture_states(GLenum pname, GLint *params)
        for (i = 0; i < initial_fake_ctx->gl_num_tex_units[0]; i++)
        {
                _orig_tracepath_glActiveTexture(GL_TEXTURE0 + i);
-               _orig_tracepath_glGetIntegerv(pname, &(((GLint *)params)[i]));
+               _orig_tracepath_glGetIntegerv(pname, (GLint *)&params[i]);
        }
        _orig_tracepath_glActiveTexture(cur_active_tex);
 }
@@ -106,22 +107,13 @@ _state_get_texture_states(GLenum pname, GLint *params)
 static void
 _state_get_draw_buffers(GLenum *params)
 {
-       _orig_tracepath_glGetIntegerv(GL_DRAW_BUFFER0, &(((GLint *)params)[0]));
-       _orig_tracepath_glGetIntegerv(GL_DRAW_BUFFER1, &(((GLint *)params)[1]));
-       _orig_tracepath_glGetIntegerv(GL_DRAW_BUFFER2, &(((GLint *)params)[2]));
-       _orig_tracepath_glGetIntegerv(GL_DRAW_BUFFER3, &(((GLint *)params)[3]));
-       _orig_tracepath_glGetIntegerv(GL_DRAW_BUFFER4, &(((GLint *)params)[4]));
-       _orig_tracepath_glGetIntegerv(GL_DRAW_BUFFER5, &(((GLint *)params)[5]));
-       _orig_tracepath_glGetIntegerv(GL_DRAW_BUFFER6, &(((GLint *)params)[6]));
-       _orig_tracepath_glGetIntegerv(GL_DRAW_BUFFER7, &(((GLint *)params)[7]));
-       _orig_tracepath_glGetIntegerv(GL_DRAW_BUFFER8, &(((GLint *)params)[8]));
-       _orig_tracepath_glGetIntegerv(GL_DRAW_BUFFER9, &(((GLint *)params)[9]));
-       _orig_tracepath_glGetIntegerv(GL_DRAW_BUFFER10, &(((GLint *)params)[10]));
-       _orig_tracepath_glGetIntegerv(GL_DRAW_BUFFER11, &(((GLint *)params)[11]));
-       _orig_tracepath_glGetIntegerv(GL_DRAW_BUFFER12, &(((GLint *)params)[12]));
-       _orig_tracepath_glGetIntegerv(GL_DRAW_BUFFER13, &(((GLint *)params)[13]));
-       _orig_tracepath_glGetIntegerv(GL_DRAW_BUFFER14, &(((GLint *)params)[14]));
-       _orig_tracepath_glGetIntegerv(GL_DRAW_BUFFER15, &(((GLint *)params)[15]));
+       AST(initial_fake_ctx != NULL);
+
+       int i;
+       for (i = 0; i < initial_fake_ctx->gl_num_draw_buffers[0]; i++)
+       {
+               _orig_tracepath_glGetIntegerv(GL_DRAW_BUFFER0 + i, (GLint *)&params[i]);
+       }
 }
 
 static void
@@ -132,7 +124,7 @@ _state_get_transform_feedback_buffer_bindings(GLuint *params)
        int i;
        for (i = 0; i < initial_fake_ctx->gl_num_transform_feedback_separate_attribs[0]; i++)
        {
-               _orig_tracepath_glGetIntegeri_v(GL_TRANSFORM_FEEDBACK_BUFFER_BINDING, i, &(((GLint *)params)[i]));
+               _orig_tracepath_glGetIntegeri_v(GL_TRANSFORM_FEEDBACK_BUFFER_BINDING, i, (GLint *)&params[i]);
        }
 }
 
@@ -144,7 +136,7 @@ _state_get_transform_feedback_buffer_bindings_offset(GLintptr *params)
        int i;
        for (i = 0; i < initial_fake_ctx->gl_num_transform_feedback_separate_attribs[0]; i++)
        {
-               _orig_tracepath_glGetIntegeri_v(GL_TRANSFORM_FEEDBACK_BUFFER_START, i, &(((GLint *)params)[i]));
+               _orig_tracepath_glGetIntegeri_v(GL_TRANSFORM_FEEDBACK_BUFFER_START, i, (GLint *)&params[i]);
        }
 }
 
@@ -156,7 +148,7 @@ _state_get_transform_feedback_buffer_bindings_size(GLsizeiptr *params)
        int i;
        for (i = 0; i < initial_fake_ctx->gl_num_transform_feedback_separate_attribs[0]; i++)
        {
-               _orig_tracepath_glGetIntegeri_v(GL_TRANSFORM_FEEDBACK_BUFFER_SIZE, i, &(((GLint *)params)[i]));
+               _orig_tracepath_glGetIntegeri_v(GL_TRANSFORM_FEEDBACK_BUFFER_SIZE, i, (GLint *)&params[i]);
        }
 }
 
@@ -171,7 +163,7 @@ _state_get_uniform_buffer_bindings(GLuint *params)
 /////////////////////////////////////////////////////////////////////////////////
 // XXXX : AVOID SEGFAULT in ADRENO
                ((GLint *)params)[i] = 0;
-//             _orig_tracepath_glGetIntegeri_v(GL_UNIFORM_BUFFER_BINDING, i, &(((GLint *)params)[i]));
+//             _orig_tracepath_glGetIntegeri_v(GL_UNIFORM_BUFFER_BINDING, i, (GLint *)&params[i]);
 /////////////////////////////////////////////////////////////////////////////////
        }
 }
@@ -184,7 +176,7 @@ _state_get_uniform_buffer_bindings_offset(GLintptr *params)
        int i;
        for (i = 0; i < initial_fake_ctx->gl_num_uniform_buffer_bindings[0]; i++)
        {
-               _orig_tracepath_glGetIntegeri_v(GL_UNIFORM_BUFFER_START, i, &(((GLint *)params)[i]));
+               _orig_tracepath_glGetIntegeri_v(GL_UNIFORM_BUFFER_START, i, (GLint *)&params[i]);
        }
 }
 
@@ -196,7 +188,7 @@ _state_get_uniform_buffer_bindings_size(GLsizeiptr *params)
        int i;
        for (i = 0; i < initial_fake_ctx->gl_num_uniform_buffer_bindings[0]; i++)
        {
-               _orig_tracepath_glGetIntegeri_v(GL_UNIFORM_BUFFER_SIZE, i, &(((GLint *)params)[i]));
+               _orig_tracepath_glGetIntegeri_v(GL_UNIFORM_BUFFER_SIZE, i, (GLint *)&params[i]);
        }
 }
 
@@ -415,8 +407,11 @@ tracepath_dump_context_states(int force_output)
 
        if (unlikely(trace_state_flag != 1)) return;
 
+       _sym_glGetIntegerv(GL_MAX_DRAW_BUFFERS, (GLint *)initial_fake_ctx->gl_num_draw_buffers);
        _sym_glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, (GLint *)initial_fake_ctx->gl_num_tex_units);
        _sym_glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, (GLint *)initial_fake_ctx->gl_num_vertex_attribs);
+       _sym_glGetIntegerv(GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS, (GLint *)initial_fake_ctx->gl_num_transform_feedback_separate_attribs);
+       _sym_glGetIntegerv(GL_MAX_UNIFORM_BUFFER_BINDINGS, (GLint *)initial_fake_ctx->gl_num_uniform_buffer_bindings);
 
        if (!force_output)
        {
@@ -434,7 +429,7 @@ tracepath_dump_context_states(int force_output)
        TRACE("\E[40;32;1m  State info \E[1;37;1m: <PID = %d> (CURRENT BINDED CONTEXT)\E[0m\n", getpid());
        TRACE("\E[0;40;34m===================================================================================================================\E[0m\n");
 
-#define PRINTF_CHAR_GLenum "%10d"
+#define PRINTF_CHAR_GLenum "0x%8X"
 #define PRINTF_CHAR_GLboolean "%10d"
 #define PRINTF_CHAR_GLint "%10d"
 #define PRINTF_CHAR_GLsizei "%10u"