[INTERNAL] Approved checking library links & Vertex Pointer...
authorHaegeun Park <haegeun.park@samsung.com>
Fri, 1 Nov 2013 07:29:51 +0000 (00:29 -0700)
committerHaegeun Park <haegeun.park@samsung.com>
Wed, 20 Nov 2013 05:55:41 +0000 (21:55 -0800)
src/headers/sym_gl.h
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
src/modules/tracepath/coregl_tracepath.c
src/modules/tracepath/coregl_tracepath_gl.c

index aaddc18..00bef8d 100644 (file)
@@ -162,15 +162,15 @@ _COREGL_SYMBOL(GL_FALSE, void, glUniformMatrix3fv, (GLint location, GLsizei coun
 _COREGL_SYMBOL(GL_FALSE, void, glUniformMatrix4fv, (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value))
 _COREGL_SYMBOL(GL_FALSE, void, glUseProgram, (GLuint program))
 _COREGL_SYMBOL(GL_FALSE, void, glValidateProgram, (GLuint program))
-_COREGL_SYMBOL(GL_FALSE, void, glVertexAttrib1f, (GLuint indx, GLfloat x))
-_COREGL_SYMBOL(GL_FALSE, void, glVertexAttrib1fv, (GLuint indx, const GLfloat* values))
-_COREGL_SYMBOL(GL_FALSE, void, glVertexAttrib2f, (GLuint indx, GLfloat x, GLfloat y))
-_COREGL_SYMBOL(GL_FALSE, void, glVertexAttrib2fv, (GLuint indx, const GLfloat* values))
-_COREGL_SYMBOL(GL_FALSE, void, glVertexAttrib3f, (GLuint indx, GLfloat x, GLfloat y, GLfloat z))
-_COREGL_SYMBOL(GL_FALSE, void, glVertexAttrib3fv, (GLuint indx, const GLfloat* values))
-_COREGL_SYMBOL(GL_FALSE, void, glVertexAttrib4f, (GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w))
-_COREGL_SYMBOL(GL_FALSE, void, glVertexAttrib4fv, (GLuint indx, const GLfloat* values))
-_COREGL_SYMBOL(GL_FALSE, void, glVertexAttribPointer, (GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr))
+_COREGL_SYMBOL(GL_FALSE, void, glVertexAttrib1f, (GLuint index, GLfloat x))
+_COREGL_SYMBOL(GL_FALSE, void, glVertexAttrib1fv, (GLuint index, const GLfloat* values))
+_COREGL_SYMBOL(GL_FALSE, void, glVertexAttrib2f, (GLuint index, GLfloat x, GLfloat y))
+_COREGL_SYMBOL(GL_FALSE, void, glVertexAttrib2fv, (GLuint index, const GLfloat* values))
+_COREGL_SYMBOL(GL_FALSE, void, glVertexAttrib3f, (GLuint index, GLfloat x, GLfloat y, GLfloat z))
+_COREGL_SYMBOL(GL_FALSE, void, glVertexAttrib3fv, (GLuint index, const GLfloat* values))
+_COREGL_SYMBOL(GL_FALSE, void, glVertexAttrib4f, (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w))
+_COREGL_SYMBOL(GL_FALSE, void, glVertexAttrib4fv, (GLuint index, const GLfloat* values))
+_COREGL_SYMBOL(GL_FALSE, void, glVertexAttribPointer, (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* pointer))
 _COREGL_SYMBOL(GL_FALSE, void, glViewport, (GLint x, GLint y, GLsizei width, GLsizei height))
 
 /* OpenGL ES 3.0 */
index f65de65..4f705e1 100644 (file)
@@ -65,6 +65,78 @@ _state_get_draw_buffers(GLenum *params)
        _orig_fastpath_glGetIntegerv(GL_DRAW_BUFFER15, &(((GLint *)params)[15]));
 }
 
+static void
+_state_get_transform_feedback_buffer_bindings(GLuint *params)
+{
+       AST(initial_ctx != NULL);
+
+       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]));
+       }
+}
+
+static void
+_state_get_transform_feedback_buffer_bindings_offset(GLintptr *params)
+{
+       AST(initial_ctx != NULL);
+
+       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]));
+       }
+}
+
+static void
+_state_get_transform_feedback_buffer_bindings_size(GLsizeiptr *params)
+{
+       AST(initial_ctx != NULL);
+
+       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]));
+       }
+}
+
+static void
+_state_get_uniform_buffer_bindings(GLuint *params)
+{
+       AST(initial_ctx != NULL);
+
+       int i;
+       for (i = 0; i < initial_ctx->gl_num_uniform_buffer_bindings[0]; i++)
+       {
+               _orig_fastpath_glGetIntegeri_v(GL_UNIFORM_BUFFER_BINDING, i, &(((GLint *)params)[i]));
+       }
+}
+
+static void
+_state_get_uniform_buffer_bindings_offset(GLintptr *params)
+{
+       AST(initial_ctx != NULL);
+
+       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]));
+       }
+}
+
+static void
+_state_get_uniform_buffer_bindings_size(GLsizeiptr *params)
+{
+       AST(initial_ctx != NULL);
+
+       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]));
+       }
+}
+
 void
 fastpath_state_get_draw_buffers(GLenum *params)
 {
@@ -1047,6 +1119,8 @@ fastpath_dump_context_states(GLGlueContext *ctx, int force_output)
 #define PRINTF_CHAR_GLsizei "%10u"
 #define PRINTF_CHAR_GLuint "%10u"
 #define PRINTF_CHAR_GLuintmask "0x%8X"
+#define PRINTF_CHAR_GLintptr "0x%8X"
+#define PRINTF_CHAR_GLsizeiptr "%10d"
 
 #define PRINTF_CHAR_GLclampf "%10.6f"
 #define PRINTF_CHAR_GLfloat "%10.6f"
index 13c8bd3..4faf859 100644 (file)
@@ -46,6 +46,8 @@
 
 #define MAX_TEXTURE_UNITS 32
 #define MAX_VERTEX_ATTRIBS 64
+#define MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS 64
+#define MAX_UNIFORM_BUFFER_BINDINGS 64
 
 typedef enum _Fastpath_Opt_Flag
 {
index 2d83a4a..b349027 100644 (file)
@@ -3808,19 +3808,19 @@ finish:
 
 // Optmize?
 void
-fastpath_glVertexAttrib1f(GLuint indx, GLfloat x)
+fastpath_glVertexAttrib1f(GLuint index, GLfloat x)
 {
        DEFINE_FASTPAH_GL_FUNC();
        _COREGL_FASTPATH_FUNC_BEGIN();
        INIT_FASTPATH_GL_FUNC();
 
-       IF_GL_SUCCESS(_orig_fastpath_glVertexAttrib1f(indx, x))
+       IF_GL_SUCCESS(_orig_fastpath_glVertexAttrib1f(index, x))
        {
                current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_attrib_value;
-               current_ctx->gl_vertex_attrib_value[indx * 4 + 0] = x;
-               current_ctx->gl_vertex_attrib_value[indx * 4 + 1] = 0;
-               current_ctx->gl_vertex_attrib_value[indx * 4 + 2] = 0;
-               current_ctx->gl_vertex_attrib_value[indx * 4 + 3] = 1;
+               current_ctx->gl_vertex_attrib_value[index * 4 + 0] = x;
+               current_ctx->gl_vertex_attrib_value[index * 4 + 1] = 0;
+               current_ctx->gl_vertex_attrib_value[index * 4 + 2] = 0;
+               current_ctx->gl_vertex_attrib_value[index * 4 + 3] = 1;
        }
        goto finish;
 
@@ -3831,19 +3831,19 @@ finish:
 
 // Optmize?
 void
-fastpath_glVertexAttrib1fv(GLuint indx, const GLfloat* values)
+fastpath_glVertexAttrib1fv(GLuint index, const GLfloat* values)
 {
        DEFINE_FASTPAH_GL_FUNC();
        _COREGL_FASTPATH_FUNC_BEGIN();
        INIT_FASTPATH_GL_FUNC();
 
-       IF_GL_SUCCESS(_orig_fastpath_glVertexAttrib1fv(indx, values))
+       IF_GL_SUCCESS(_orig_fastpath_glVertexAttrib1fv(index, values))
        {
                current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_attrib_value;
-               current_ctx->gl_vertex_attrib_value[indx * 4 + 0] = values[0];
-               current_ctx->gl_vertex_attrib_value[indx * 4 + 1] = 0;
-               current_ctx->gl_vertex_attrib_value[indx * 4 + 2] = 0;
-               current_ctx->gl_vertex_attrib_value[indx * 4 + 3] = 1;
+               current_ctx->gl_vertex_attrib_value[index * 4 + 0] = values[0];
+               current_ctx->gl_vertex_attrib_value[index * 4 + 1] = 0;
+               current_ctx->gl_vertex_attrib_value[index * 4 + 2] = 0;
+               current_ctx->gl_vertex_attrib_value[index * 4 + 3] = 1;
        }
        goto finish;
 
@@ -3854,19 +3854,19 @@ finish:
 
 // Optmize?
 void
-fastpath_glVertexAttrib2f(GLuint indx, GLfloat x, GLfloat y)
+fastpath_glVertexAttrib2f(GLuint index, GLfloat x, GLfloat y)
 {
        DEFINE_FASTPAH_GL_FUNC();
        _COREGL_FASTPATH_FUNC_BEGIN();
        INIT_FASTPATH_GL_FUNC();
 
-       IF_GL_SUCCESS(_orig_fastpath_glVertexAttrib2f(indx, x, y))
+       IF_GL_SUCCESS(_orig_fastpath_glVertexAttrib2f(index, x, y))
        {
                current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_attrib_value;
-               current_ctx->gl_vertex_attrib_value[indx * 4 + 0] = x;
-               current_ctx->gl_vertex_attrib_value[indx * 4 + 1] = y;
-               current_ctx->gl_vertex_attrib_value[indx * 4 + 2] = 0;
-               current_ctx->gl_vertex_attrib_value[indx * 4 + 3] = 1;
+               current_ctx->gl_vertex_attrib_value[index * 4 + 0] = x;
+               current_ctx->gl_vertex_attrib_value[index * 4 + 1] = y;
+               current_ctx->gl_vertex_attrib_value[index * 4 + 2] = 0;
+               current_ctx->gl_vertex_attrib_value[index * 4 + 3] = 1;
        }
        goto finish;
 
@@ -3877,19 +3877,19 @@ finish:
 
 // Optmize?
 void
-fastpath_glVertexAttrib2fv(GLuint indx, const GLfloat* values)
+fastpath_glVertexAttrib2fv(GLuint index, const GLfloat* values)
 {
        DEFINE_FASTPAH_GL_FUNC();
        _COREGL_FASTPATH_FUNC_BEGIN();
        INIT_FASTPATH_GL_FUNC();
 
-       IF_GL_SUCCESS(_orig_fastpath_glVertexAttrib2fv(indx, values))
+       IF_GL_SUCCESS(_orig_fastpath_glVertexAttrib2fv(index, values))
        {
                current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_attrib_value;
-               current_ctx->gl_vertex_attrib_value[indx * 4 + 0] = values[0];
-               current_ctx->gl_vertex_attrib_value[indx * 4 + 1] = values[1];
-               current_ctx->gl_vertex_attrib_value[indx * 4 + 2] = 0;
-               current_ctx->gl_vertex_attrib_value[indx * 4 + 3] = 1;
+               current_ctx->gl_vertex_attrib_value[index * 4 + 0] = values[0];
+               current_ctx->gl_vertex_attrib_value[index * 4 + 1] = values[1];
+               current_ctx->gl_vertex_attrib_value[index * 4 + 2] = 0;
+               current_ctx->gl_vertex_attrib_value[index * 4 + 3] = 1;
        }
        goto finish;
 
@@ -3900,19 +3900,19 @@ finish:
 
 // Optmize?
 void
-fastpath_glVertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z)
+fastpath_glVertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z)
 {
        DEFINE_FASTPAH_GL_FUNC();
        _COREGL_FASTPATH_FUNC_BEGIN();
        INIT_FASTPATH_GL_FUNC();
 
-       IF_GL_SUCCESS(_orig_fastpath_glVertexAttrib3f(indx, x, y, z))
+       IF_GL_SUCCESS(_orig_fastpath_glVertexAttrib3f(index, x, y, z))
        {
                current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_attrib_value;
-               current_ctx->gl_vertex_attrib_value[indx * 4 + 0] = x;
-               current_ctx->gl_vertex_attrib_value[indx * 4 + 1] = y;
-               current_ctx->gl_vertex_attrib_value[indx * 4 + 2] = z;
-               current_ctx->gl_vertex_attrib_value[indx * 4 + 3] = 1;
+               current_ctx->gl_vertex_attrib_value[index * 4 + 0] = x;
+               current_ctx->gl_vertex_attrib_value[index * 4 + 1] = y;
+               current_ctx->gl_vertex_attrib_value[index * 4 + 2] = z;
+               current_ctx->gl_vertex_attrib_value[index * 4 + 3] = 1;
        }
        goto finish;
 
@@ -3923,19 +3923,19 @@ finish:
 
 // Optmize?
 void
-fastpath_glVertexAttrib3fv(GLuint indx, const GLfloat* values)
+fastpath_glVertexAttrib3fv(GLuint index, const GLfloat* values)
 {
        DEFINE_FASTPAH_GL_FUNC();
        _COREGL_FASTPATH_FUNC_BEGIN();
        INIT_FASTPATH_GL_FUNC();
 
-       IF_GL_SUCCESS(_orig_fastpath_glVertexAttrib3fv(indx, values))
+       IF_GL_SUCCESS(_orig_fastpath_glVertexAttrib3fv(index, values))
        {
                current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_attrib_value;
-               current_ctx->gl_vertex_attrib_value[indx * 4 + 0] = values[0];
-               current_ctx->gl_vertex_attrib_value[indx * 4 + 1] = values[1];
-               current_ctx->gl_vertex_attrib_value[indx * 4 + 2] = values[2];
-               current_ctx->gl_vertex_attrib_value[indx * 4 + 3] = 1;
+               current_ctx->gl_vertex_attrib_value[index * 4 + 0] = values[0];
+               current_ctx->gl_vertex_attrib_value[index * 4 + 1] = values[1];
+               current_ctx->gl_vertex_attrib_value[index * 4 + 2] = values[2];
+               current_ctx->gl_vertex_attrib_value[index * 4 + 3] = 1;
        }
        goto finish;
 
@@ -3946,19 +3946,19 @@ finish:
 
 // Optmize?
 void
-fastpath_glVertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
+fastpath_glVertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
 {
        DEFINE_FASTPAH_GL_FUNC();
        _COREGL_FASTPATH_FUNC_BEGIN();
        INIT_FASTPATH_GL_FUNC();
 
-       IF_GL_SUCCESS(_orig_fastpath_glVertexAttrib4f(indx, x, y, z, w))
+       IF_GL_SUCCESS(_orig_fastpath_glVertexAttrib4f(index, x, y, z, w))
        {
                current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_attrib_value;
-               current_ctx->gl_vertex_attrib_value[indx * 4 + 0] = x;
-               current_ctx->gl_vertex_attrib_value[indx * 4 + 1] = y;
-               current_ctx->gl_vertex_attrib_value[indx * 4 + 2] = z;
-               current_ctx->gl_vertex_attrib_value[indx * 4 + 3] = w;
+               current_ctx->gl_vertex_attrib_value[index * 4 + 0] = x;
+               current_ctx->gl_vertex_attrib_value[index * 4 + 1] = y;
+               current_ctx->gl_vertex_attrib_value[index * 4 + 2] = z;
+               current_ctx->gl_vertex_attrib_value[index * 4 + 3] = w;
        }
        goto finish;
 
@@ -3969,19 +3969,19 @@ finish:
 
 // Optmize?
 void
-fastpath_glVertexAttrib4fv(GLuint indx, const GLfloat* values)
+fastpath_glVertexAttrib4fv(GLuint index, const GLfloat* values)
 {
        DEFINE_FASTPAH_GL_FUNC();
        _COREGL_FASTPATH_FUNC_BEGIN();
        INIT_FASTPATH_GL_FUNC();
 
-       IF_GL_SUCCESS(_orig_fastpath_glVertexAttrib4fv(indx, values))
+       IF_GL_SUCCESS(_orig_fastpath_glVertexAttrib4fv(index, values))
        {
                current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_attrib_value;
-               current_ctx->gl_vertex_attrib_value[indx * 4 + 0] = values[0];
-               current_ctx->gl_vertex_attrib_value[indx * 4 + 1] = values[1];
-               current_ctx->gl_vertex_attrib_value[indx * 4 + 2] = values[2];
-               current_ctx->gl_vertex_attrib_value[indx * 4 + 3] = values[3];
+               current_ctx->gl_vertex_attrib_value[index * 4 + 0] = values[0];
+               current_ctx->gl_vertex_attrib_value[index * 4 + 1] = values[1];
+               current_ctx->gl_vertex_attrib_value[index * 4 + 2] = values[2];
+               current_ctx->gl_vertex_attrib_value[index * 4 + 3] = values[3];
        }
        goto finish;
 
@@ -3993,22 +3993,23 @@ finish:
 
 // Optmize?
 void
-fastpath_glVertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr)
+fastpath_glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* pointer)
 {
        DEFINE_FASTPAH_GL_FUNC();
        _COREGL_FASTPATH_FUNC_BEGIN();
        INIT_FASTPATH_GL_FUNC();
 
-       IF_GL_SUCCESS(_orig_fastpath_glVertexAttribPointer(indx, size, type, normalized, stride, ptr))
+       IF_GL_SUCCESS(_orig_fastpath_glVertexAttribPointer(index, size, type, normalized, stride, pointer))
        {
                current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_array;
 
-               current_ctx->gl_vertex_array_buf_id[indx]     = current_ctx->gl_array_buffer_binding[0];
-               current_ctx->gl_vertex_array_size[indx]       = size;
-               current_ctx->gl_vertex_array_type[indx]       = type;
-               current_ctx->gl_vertex_array_normalized[indx] = normalized;
-               current_ctx->gl_vertex_array_stride[indx]     = stride;
-               current_ctx->gl_vertex_array_pointer[indx]    = (GLvoid *)ptr;
+               current_ctx->gl_vertex_array_buf_id[index]       = current_ctx->gl_array_buffer_binding[0];
+               current_ctx->gl_vertex_array_size[index]         = size;
+               current_ctx->gl_vertex_array_type[index]         = type;
+               current_ctx->gl_vertex_array_normalized[index]   = normalized;
+               current_ctx->gl_vertex_array_normalized[index]   = GL_FALSE;
+               current_ctx->gl_vertex_array_stride[index]       = stride;
+               current_ctx->gl_vertex_array_pointer[index]      = (GLvoid *)pointer;
        }
        goto finish;
 
@@ -4914,8 +4915,9 @@ finish:
 
 ////////////////////////////////////////////////////////////////////////
 
+
 void
-fastpath_glBindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size)
+fastpath_glBindBufferBase(GLenum target, GLuint index, GLuint buffer)
 {
        GLuint real_obj;
 
@@ -4929,14 +4931,38 @@ fastpath_glBindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr
                goto finish;
        }
 
-       if (current_ctx->gl_transform_feedback_binding[0] != real_obj)
+       if (target == GL_TRANSFORM_FEEDBACK_BUFFER)
        {
-               IF_GL_SUCCESS(_orig_fastpath_glBindTransformFeedback(target, real_obj))
+               CURR_STATE_COMPARE(gl_transform_feedback_buffer_binding, real_obj)
                {
-                       current_ctx->_misc_flag3 |= _MISC_FLAG3_BIT_gl_transform_feedback_binding;
-                       current_ctx->gl_transform_feedback_binding[0] = real_obj;
+                       IF_GL_SUCCESS(_orig_fastpath_glBindBufferBase(target, index, real_obj))
+                       {
+                               current_ctx->_bind_flag |= _BIND_FLAG_BIT_gl_transform_feedback_buffer_binding;
+                               current_ctx->gl_transform_feedback_buffer_binding_array[index] = real_obj;
+                               current_ctx->gl_transform_feedback_buffer_binding_array_offset[index] = 0;
+                               current_ctx->gl_transform_feedback_buffer_binding_array_size[index] = 0;
+                       }
                }
        }
+       else if (target == GL_UNIFORM_BUFFER)
+       {
+               CURR_STATE_COMPARE(gl_uniform_buffer_binding, real_obj)
+               {
+                       IF_GL_SUCCESS(_orig_fastpath_glBindBufferBase(target, index, real_obj))
+                       {
+                               current_ctx->_bind_flag |= _BIND_FLAG_BIT_gl_uniform_buffer_binding;
+                               current_ctx->gl_uniform_buffer_binding_array[index] = real_obj;
+                               current_ctx->gl_uniform_buffer_binding_array_offset[index] = 0;
+                               current_ctx->gl_uniform_buffer_binding_array_size[index] = 0;
+                       }
+               }
+       }
+       else
+       {
+               _set_gl_error(GL_INVALID_ENUM);
+               goto finish;
+       }
+
        goto finish;
 
 finish:
@@ -4945,17 +4971,52 @@ finish:
 
 
 
-/* ES 3.0 BLOCK (UNTIL SUPPORT) */
-#define SIGILL_ERROR() \
-       COREGL_ERR("\E[40;31;1mFASTPATH can't support ES3.0 API '%s' (will be terminated with Illegal instruction!)\E[0m\n", __func__); \
-       kill(getpid(), SIGILL)
-
-
 void
-fastpath_glBindBufferBase(GLenum target, GLuint index, GLuint buffer)
+fastpath_glBindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size)
 {
-       _COREGL_FASTPATH_FUNC_BEGIN();  SIGILL_ERROR(); // BLOCK API
-       _orig_fastpath_glBindBufferBase(target, index, buffer);
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_BUFFER, buffer, &real_obj) != 1)
+       {
+               _set_gl_error(GL_OUT_OF_MEMORY);
+               goto finish;
+       }
+
+       if (target == GL_TRANSFORM_FEEDBACK_BUFFER)
+       {
+               CURR_STATE_COMPARE(gl_transform_feedback_buffer_binding, real_obj)
+               {
+                       IF_GL_SUCCESS(_orig_fastpath_glBindBufferRange(target, index, real_obj, offset, size))
+                       {
+                               current_ctx->_bind_flag |= _BIND_FLAG_BIT_gl_transform_feedback_buffer_binding;
+                               current_ctx->gl_transform_feedback_buffer_binding_array[index] = real_obj;
+                               current_ctx->gl_transform_feedback_buffer_binding_array_offset[index] = offset;
+                               current_ctx->gl_transform_feedback_buffer_binding_array_size[index] = size;
+                       }
+               }
+       }
+       else if (target == GL_UNIFORM_BUFFER)
+       {
+               CURR_STATE_COMPARE(gl_uniform_buffer_binding, real_obj)
+               {
+                       IF_GL_SUCCESS(_orig_fastpath_glBindBufferRange(target, index, real_obj, offset, size))
+                       {
+                               current_ctx->_bind_flag |= _BIND_FLAG_BIT_gl_uniform_buffer_binding;
+                               current_ctx->gl_uniform_buffer_binding_array[index] = real_obj;
+                               current_ctx->gl_uniform_buffer_binding_array_offset[index] = offset;
+                               current_ctx->gl_uniform_buffer_binding_array_size[index] = size;
+                       }
+               }
+       }
+       else
+       {
+               _set_gl_error(GL_INVALID_ENUM);
+               goto finish;
+       }
 
        goto finish;
 
@@ -4963,42 +5024,85 @@ finish:
        _COREGL_FASTPATH_FUNC_END();
 }
 
+
 void
 fastpath_glTransformFeedbackVaryings(GLuint program, GLsizei count, const GLchar* const* varyings, GLenum bufferMode)
 {
-       _COREGL_FASTPATH_FUNC_BEGIN();  SIGILL_ERROR(); // BLOCK API
-       _orig_fastpath_glTransformFeedbackVaryings(program, count, varyings, bufferMode);
+       GLuint real_obj;
 
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
+       {
+               _set_gl_error(GL_INVALID_VALUE);
+               goto finish;
+       }
+
+       _orig_fastpath_glTransformFeedbackVaryings(real_obj, count, varyings, bufferMode);
        goto finish;
 
 finish:
        _COREGL_FASTPATH_FUNC_END();
 }
 
+
 void
 fastpath_glGetTransformFeedbackVarying(GLuint program, GLuint index, GLsizei bufSize, GLsizei* length, GLsizei* size, GLenum* type, GLchar* name)
 {
-       _COREGL_FASTPATH_FUNC_BEGIN();  SIGILL_ERROR(); // BLOCK API
-       _orig_fastpath_glGetTransformFeedbackVarying(program, index, bufSize, length, size, type, name);
+       GLuint real_obj;
 
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
+       {
+               _set_gl_error(GL_INVALID_VALUE);
+               goto finish;
+       }
+
+       _orig_fastpath_glGetTransformFeedbackVarying(real_obj, index, bufSize, length, size, type, name);
        goto finish;
 
 finish:
        _COREGL_FASTPATH_FUNC_END();
 }
 
+
 void
 fastpath_glVertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid* pointer)
 {
-       _COREGL_FASTPATH_FUNC_BEGIN();  SIGILL_ERROR(); // BLOCK API
-       _orig_fastpath_glVertexAttribIPointer(index, size, type, stride, pointer);
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
 
+       IF_GL_SUCCESS(_orig_fastpath_glVertexAttribIPointer(index, size, type, stride, pointer))
+       {
+               current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_array;
+
+               current_ctx->gl_vertex_array_buf_id[index]       = current_ctx->gl_array_buffer_binding[0];
+               current_ctx->gl_vertex_array_size[index]         = size;
+               current_ctx->gl_vertex_array_type[index]         = type;
+               current_ctx->gl_vertex_array_normalized[index]   = GL_FALSE;
+               current_ctx->gl_vertex_array_integer[index]      = GL_TRUE;
+               current_ctx->gl_vertex_array_stride[index]       = stride;
+               current_ctx->gl_vertex_array_pointer[index]      = (GLvoid *)pointer;
+       }
        goto finish;
 
 finish:
        _COREGL_FASTPATH_FUNC_END();
 }
 
+
+
+/* ES 3.0 BLOCK (UNTIL SUPPORT) */
+#define SIGILL_ERROR() \
+       COREGL_ERR("\E[40;31;1mFASTPATH can't support ES3.0 API '%s' (will be terminated with Illegal instruction!)\E[0m\n", __func__); \
+       kill(getpid(), SIGILL)
+
 void
 fastpath_glGetVertexAttribIiv(GLuint index, GLenum pname, GLint* params)
 {
index 9e7d66a..22cd0c1 100644 (file)
@@ -24,6 +24,14 @@ GLUE_STATE(GLuint, gl_num_vertex_attribs, 1, 1,
            _sym_glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, (GLint *)value); /* DEFAULT NOT EFFECT */,
            _sym_glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, (GLint *)value);)
 
+GLUE_STATE(GLuint, gl_num_transform_feedback_separate_attribs, 1, 1,
+           _sym_glGetIntegerv(GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS, (GLint *)value); /* DEFAULT NOT EFFECT */,
+           _sym_glGetIntegerv(GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS, (GLint *)value);)
+
+GLUE_STATE(GLuint, gl_num_uniform_buffer_bindings, 1, 1,
+           _sym_glGetIntegerv(GL_MAX_UNIFORM_BUFFER_BINDINGS, (GLint *)value); /* DEFAULT NOT EFFECT */,
+           _sym_glGetIntegerv(GL_MAX_UNIFORM_BUFFER_BINDINGS, (GLint *)value);)
+
 GLUE_STATE(GLuint, gl_array_buffer_binding, 1, 1, SET_1(0), _sym_glGetIntegerv(GL_ARRAY_BUFFER_BINDING, (GLint *)value);)
 GLUE_STATE(GLuint, gl_copy_read_buffer_binding, 1, 1, SET_1(0), _sym_glGetIntegerv(GL_COPY_READ_BUFFER_BINDING, (GLint *)value);)
 GLUE_STATE(GLuint, gl_copy_write_buffer_binding, 1, 1, SET_1(0), _sym_glGetIntegerv(GL_COPY_WRITE_BUFFER_BINDING, (GLint *)value);)
@@ -32,6 +40,31 @@ GLUE_STATE(GLuint, gl_pixel_pack_buffer_binding, 1, 1, SET_1(0), _sym_glGetInteg
 GLUE_STATE(GLuint, gl_pixel_unpack_buffer_binding, 1, 1, SET_1(0), _sym_glGetIntegerv(GL_PIXEL_UNPACK_BUFFER_BINDING, (GLint *)value);)
 GLUE_STATE(GLuint, gl_transform_feedback_buffer_binding, 1, 1, SET_1(0), _sym_glGetIntegerv(GL_TRANSFORM_FEEDBACK_BUFFER_BINDING, (GLint *)value);)
 GLUE_STATE(GLuint, gl_uniform_buffer_binding, 1, 1, SET_1(0), _sym_glGetIntegerv(GL_UNIFORM_BUFFER_BINDING, (GLint *)value);)
+
+GLUE_STATE(GLuint, gl_transform_feedback_buffer_binding_array, INITIAL_CTX->gl_num_transform_feedback_separate_attribs[0], MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS,
+       _state_get_transform_feedback_buffer_bindings(value); /* DEFAULT NOT EFFECT */,
+       _state_get_transform_feedback_buffer_bindings(value);)
+
+GLUE_STATE(GLintptr, gl_transform_feedback_buffer_binding_array_offset, INITIAL_CTX->gl_num_transform_feedback_separate_attribs[0], MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS,
+       _state_get_transform_feedback_buffer_bindings_offset(value); /* DEFAULT NOT EFFECT */,
+       _state_get_transform_feedback_buffer_bindings_offset(value);)
+
+GLUE_STATE(GLsizeiptr, gl_transform_feedback_buffer_binding_array_size, INITIAL_CTX->gl_num_transform_feedback_separate_attribs[0], MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS,
+       _state_get_transform_feedback_buffer_bindings_size(value); /* DEFAULT NOT EFFECT */,
+       _state_get_transform_feedback_buffer_bindings_size(value);)
+
+GLUE_STATE(GLuint, gl_uniform_buffer_binding_array, INITIAL_CTX->gl_num_uniform_buffer_bindings[0], MAX_UNIFORM_BUFFER_BINDINGS,
+       _state_get_uniform_buffer_bindings(value); /* DEFAULT NOT EFFECT */,
+       _state_get_uniform_buffer_bindings(value);)
+
+GLUE_STATE(GLintptr, gl_uniform_buffer_binding_array_offset, INITIAL_CTX->gl_num_uniform_buffer_bindings[0], MAX_UNIFORM_BUFFER_BINDINGS,
+       _state_get_uniform_buffer_bindings_offset(value); /* DEFAULT NOT EFFECT */,
+       _state_get_uniform_buffer_bindings_offset(value);)
+
+GLUE_STATE(GLsizeiptr, gl_uniform_buffer_binding_array_size, INITIAL_CTX->gl_num_uniform_buffer_bindings[0], MAX_UNIFORM_BUFFER_BINDINGS,
+       _state_get_uniform_buffer_bindings_size(value); /* DEFAULT NOT EFFECT */,
+       _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);)
@@ -141,13 +174,15 @@ GLUE_STATE(GLenum, gl_vertex_array_type, INITIAL_CTX->gl_num_vertex_attribs[0],
 GLUE_STATE(GLboolean, gl_vertex_array_normalized, INITIAL_CTX->gl_num_vertex_attribs[0], MAX_VERTEX_ATTRIBS,
            SET_N(INITIAL_CTX->gl_num_vertex_attribs[0], 1, SET_1(GL_FALSE)),
            SET_N(INITIAL_CTX->gl_num_vertex_attribs[0], 1, _sym_glGetVertexAttribiv(i, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, (GLint *)value);))
+GLUE_STATE(GLboolean, gl_vertex_array_integer, INITIAL_CTX->gl_num_vertex_attribs[0], MAX_VERTEX_ATTRIBS,
+           SET_N(INITIAL_CTX->gl_num_vertex_attribs[0], 1, SET_1(GL_FALSE)),
+           SET_N(INITIAL_CTX->gl_num_vertex_attribs[0], 1, _sym_glGetVertexAttribiv(i, GL_VERTEX_ATTRIB_ARRAY_INTEGER, (GLint *)value);))
 GLUE_STATE(GLsizei, gl_vertex_array_stride, INITIAL_CTX->gl_num_vertex_attribs[0], MAX_VERTEX_ATTRIBS,
            SET_N(INITIAL_CTX->gl_num_vertex_attribs[0], 1, SET_1(GL_FALSE)),
            SET_N(INITIAL_CTX->gl_num_vertex_attribs[0], 1, _sym_glGetVertexAttribiv(i, GL_VERTEX_ATTRIB_ARRAY_STRIDE, (GLint *)value);))
 GLUE_STATE(GLvoidptr, gl_vertex_array_pointer, INITIAL_CTX->gl_num_vertex_attribs[0], MAX_VERTEX_ATTRIBS,
            SET_N(INITIAL_CTX->gl_num_vertex_attribs[0], 1, SET_1(NULL)),
            SET_N(INITIAL_CTX->gl_num_vertex_attribs[0], 1, _sym_glGetVertexAttribPointerv(i, GL_VERTEX_ATTRIB_ARRAY_POINTER, (GLvoidptr *)value);))
-
 GLUE_STATE(GLfloat, gl_vertex_attrib_value, 4 * INITIAL_CTX->gl_num_vertex_attribs[0], MAX_VERTEX_ATTRIBS,
            SET_N(INITIAL_CTX->gl_num_vertex_attribs[0], 4, SET_4(0, 0, 0, 1)),
            SET_N(INITIAL_CTX->gl_num_vertex_attribs[0], 4, _sym_glGetVertexAttribfv(i, GL_CURRENT_VERTEX_ATTRIB, (GLfloat *)value);))
index badf592..ec34b73 100755 (executable)
@@ -66,6 +66,8 @@ typedef struct _GLGlueFakeContext
 {
        GLuint gl_num_tex_units[1];
        GLuint gl_num_vertex_attribs[1];
+       GLuint gl_num_transform_feedback_separate_attribs[1];
+       GLuint gl_num_uniform_buffer_bindings[1];
 } GLGlueFakeContext;
 
 GLGlueFakeContext initial_fake_ctx_real;
@@ -122,6 +124,78 @@ _state_get_draw_buffers(GLenum *params)
        _orig_tracepath_glGetIntegerv(GL_DRAW_BUFFER15, &(((GLint *)params)[15]));
 }
 
+static void
+_state_get_transform_feedback_buffer_bindings(GLuint *params)
+{
+       AST(initial_fake_ctx != NULL);
+
+       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]));
+       }
+}
+
+static void
+_state_get_transform_feedback_buffer_bindings_offset(GLintptr *params)
+{
+       AST(initial_fake_ctx != NULL);
+
+       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]));
+       }
+}
+
+static void
+_state_get_transform_feedback_buffer_bindings_size(GLsizeiptr *params)
+{
+       AST(initial_fake_ctx != NULL);
+
+       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]));
+       }
+}
+
+static void
+_state_get_uniform_buffer_bindings(GLuint *params)
+{
+       AST(initial_fake_ctx != NULL);
+
+       int i;
+       for (i = 0; i < initial_fake_ctx->gl_num_uniform_buffer_bindings[0]; i++)
+       {
+               _orig_tracepath_glGetIntegeri_v(GL_UNIFORM_BUFFER_BINDING, i, &(((GLint *)params)[i]));
+       }
+}
+
+static void
+_state_get_uniform_buffer_bindings_offset(GLintptr *params)
+{
+       AST(initial_fake_ctx != NULL);
+
+       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]));
+       }
+}
+
+static void
+_state_get_uniform_buffer_bindings_size(GLsizeiptr *params)
+{
+       AST(initial_fake_ctx != NULL);
+
+       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]));
+       }
+}
+
 void
 init_modules_tracepath()
 {
@@ -362,6 +436,8 @@ tracepath_dump_context_states(int force_output)
 #define PRINTF_CHAR_GLsizei "%10u"
 #define PRINTF_CHAR_GLuint "%10u"
 #define PRINTF_CHAR_GLuintmask "0x%8X"
+#define PRINTF_CHAR_GLintptr "0x%8X"
+#define PRINTF_CHAR_GLsizeiptr "%10d"
 
 #define PRINTF_CHAR_GLclampf "%10.6f"
 #define PRINTF_CHAR_GLfloat "%10.6f"
index 267ea45..94a4ec8 100644 (file)
@@ -2210,10 +2210,10 @@ finish:
 }
 
 void
-tracepath_glVertexAttrib1f(GLuint indx, GLfloat x)
+tracepath_glVertexAttrib1f(GLuint index, GLfloat x)
 {
        _COREGL_TRACEPATH_FUNC_BEGIN();
-       _orig_tracepath_glVertexAttrib1f(indx, x);
+       _orig_tracepath_glVertexAttrib1f(index, x);
 
        goto finish;
 
@@ -2222,10 +2222,10 @@ finish:
 }
 
 void
-tracepath_glVertexAttrib1fv(GLuint indx, const GLfloat* values)
+tracepath_glVertexAttrib1fv(GLuint index, const GLfloat* values)
 {
        _COREGL_TRACEPATH_FUNC_BEGIN();
-       _orig_tracepath_glVertexAttrib1fv(indx, values);
+       _orig_tracepath_glVertexAttrib1fv(index, values);
 
        goto finish;
 
@@ -2234,10 +2234,10 @@ finish:
 }
 
 void
-tracepath_glVertexAttrib2f(GLuint indx, GLfloat x, GLfloat y)
+tracepath_glVertexAttrib2f(GLuint index, GLfloat x, GLfloat y)
 {
        _COREGL_TRACEPATH_FUNC_BEGIN();
-       _orig_tracepath_glVertexAttrib2f(indx, x, y);
+       _orig_tracepath_glVertexAttrib2f(index, x, y);
 
        goto finish;
 
@@ -2246,10 +2246,10 @@ finish:
 }
 
 void
-tracepath_glVertexAttrib2fv(GLuint indx, const GLfloat* values)
+tracepath_glVertexAttrib2fv(GLuint index, const GLfloat* values)
 {
        _COREGL_TRACEPATH_FUNC_BEGIN();
-       _orig_tracepath_glVertexAttrib2fv(indx, values);
+       _orig_tracepath_glVertexAttrib2fv(index, values);
 
        goto finish;
 
@@ -2258,10 +2258,10 @@ finish:
 }
 
 void
-tracepath_glVertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z)
+tracepath_glVertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z)
 {
        _COREGL_TRACEPATH_FUNC_BEGIN();
-       _orig_tracepath_glVertexAttrib3f(indx, x, y, z);
+       _orig_tracepath_glVertexAttrib3f(index, x, y, z);
 
        goto finish;
 
@@ -2270,10 +2270,10 @@ finish:
 }
 
 void
-tracepath_glVertexAttrib3fv(GLuint indx, const GLfloat* values)
+tracepath_glVertexAttrib3fv(GLuint index, const GLfloat* values)
 {
        _COREGL_TRACEPATH_FUNC_BEGIN();
-       _orig_tracepath_glVertexAttrib3fv(indx, values);
+       _orig_tracepath_glVertexAttrib3fv(index, values);
 
        goto finish;
 
@@ -2282,10 +2282,10 @@ finish:
 }
 
 void
-tracepath_glVertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
+tracepath_glVertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
 {
        _COREGL_TRACEPATH_FUNC_BEGIN();
-       _orig_tracepath_glVertexAttrib4f(indx, x, y, z, w);
+       _orig_tracepath_glVertexAttrib4f(index, x, y, z, w);
 
        goto finish;
 
@@ -2294,10 +2294,10 @@ finish:
 }
 
 void
-tracepath_glVertexAttrib4fv(GLuint indx, const GLfloat* values)
+tracepath_glVertexAttrib4fv(GLuint index, const GLfloat* values)
 {
        _COREGL_TRACEPATH_FUNC_BEGIN();
-       _orig_tracepath_glVertexAttrib4fv(indx, values);
+       _orig_tracepath_glVertexAttrib4fv(index, values);
 
        goto finish;
 
@@ -2306,10 +2306,10 @@ finish:
 }
 
 void
-tracepath_glVertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr)
+tracepath_glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* pointer)
 {
        _COREGL_TRACEPATH_FUNC_BEGIN();
-       _orig_tracepath_glVertexAttribPointer(indx, size, type, normalized, stride, ptr);
+       _orig_tracepath_glVertexAttribPointer(index, size, type, normalized, stride, pointer);
 
        goto finish;