From a37c81cf22f7cc47860c7b61f3e3df5b945876c3 Mon Sep 17 00:00:00 2001 From: Stanislav Vorobiov Date: Wed, 13 Nov 2013 11:55:43 +0400 Subject: [PATCH] YaGL: Transform feedback initial support Change-Id: Iec5c848a8d478e2e0f4dc47debbd79030ab6b60b --- hw/yagl_apis/gles/yagl_gles_calls.c | 278 +++++++++++++++++++++++-------- hw/yagl_apis/gles/yagl_host_gles_calls.c | 107 ++++++++++++ hw/yagl_apis/gles/yagl_host_gles_calls.h | 13 ++ hw/yagl_drivers/gles_ogl/yagl_gles_ogl.c | 9 + hw/yagl_gles_driver.h | 25 ++- hw/yagl_transport.c | 40 +++++ hw/yagl_transport.h | 4 + 7 files changed, 399 insertions(+), 77 deletions(-) diff --git a/hw/yagl_apis/gles/yagl_gles_calls.c b/hw/yagl_apis/gles/yagl_gles_calls.c index b1ae0f6..8fff18c 100644 --- a/hw/yagl_apis/gles/yagl_gles_calls.c +++ b/hw/yagl_apis/gles/yagl_gles_calls.c @@ -2426,7 +2426,139 @@ static bool yagl_func_glIsEnabled(struct yagl_transport *t) } /* - * glDeleteObjects dispatcher. id = 118 + * glGenTransformFeedbacks dispatcher. id = 118 + */ +static bool yagl_func_glGenTransformFeedbacks(struct yagl_transport *t) +{ + const GLuint *ids; + int32_t ids_count; + if (!yagl_transport_get_out_array(t, sizeof(GLuint), (const void**)&ids, &ids_count)) { + return false; + } + YAGL_LOG_FUNC_ENTER_SPLIT1(glGenTransformFeedbacks, void*, ids); + (void)yagl_host_glGenTransformFeedbacks(ids, ids_count); + YAGL_LOG_FUNC_EXIT(NULL); + + return true; +} + +/* + * glBindTransformFeedback dispatcher. id = 119 + */ +static bool yagl_func_glBindTransformFeedback(struct yagl_transport *t) +{ + GLenum target; + GLuint id; + target = yagl_transport_get_out_GLenum(t); + id = yagl_transport_get_out_GLuint(t); + YAGL_LOG_FUNC_ENTER_SPLIT2(glBindTransformFeedback, GLenum, GLuint, target, id); + (void)yagl_host_glBindTransformFeedback(target, id); + YAGL_LOG_FUNC_EXIT(NULL); + + return true; +} + +/* + * glBeginTransformFeedback dispatcher. id = 120 + */ +static bool yagl_func_glBeginTransformFeedback(struct yagl_transport *t) +{ + GLenum primitiveMode; + primitiveMode = yagl_transport_get_out_GLenum(t); + YAGL_LOG_FUNC_ENTER_SPLIT1(glBeginTransformFeedback, GLenum, primitiveMode); + (void)yagl_host_glBeginTransformFeedback(primitiveMode); + YAGL_LOG_FUNC_EXIT(NULL); + + return true; +} + +/* + * glEndTransformFeedback dispatcher. id = 121 + */ +static bool yagl_func_glEndTransformFeedback(struct yagl_transport *t) +{ + YAGL_LOG_FUNC_ENTER_SPLIT0(glEndTransformFeedback); + (void)yagl_host_glEndTransformFeedback(); + YAGL_LOG_FUNC_EXIT(NULL); + + return true; +} + +/* + * glPauseTransformFeedback dispatcher. id = 122 + */ +static bool yagl_func_glPauseTransformFeedback(struct yagl_transport *t) +{ + YAGL_LOG_FUNC_ENTER_SPLIT0(glPauseTransformFeedback); + (void)yagl_host_glPauseTransformFeedback(); + YAGL_LOG_FUNC_EXIT(NULL); + + return true; +} + +/* + * glResumeTransformFeedback dispatcher. id = 123 + */ +static bool yagl_func_glResumeTransformFeedback(struct yagl_transport *t) +{ + YAGL_LOG_FUNC_ENTER_SPLIT0(glResumeTransformFeedback); + (void)yagl_host_glResumeTransformFeedback(); + YAGL_LOG_FUNC_EXIT(NULL); + + return true; +} + +/* + * glTransformFeedbackVaryings dispatcher. id = 124 + */ +static bool yagl_func_glTransformFeedbackVaryings(struct yagl_transport *t) +{ + GLuint program; + const GLchar *varyings; + int32_t varyings_count; + GLenum bufferMode; + program = yagl_transport_get_out_GLuint(t); + if (!yagl_transport_get_out_array(t, sizeof(GLchar), (const void**)&varyings, &varyings_count)) { + return false; + } + bufferMode = yagl_transport_get_out_GLenum(t); + YAGL_LOG_FUNC_ENTER_SPLIT3(glTransformFeedbackVaryings, GLuint, void*, GLenum, program, varyings, bufferMode); + (void)yagl_host_glTransformFeedbackVaryings(program, varyings, varyings_count, bufferMode); + YAGL_LOG_FUNC_EXIT(NULL); + + return true; +} + +/* + * glGetTransformFeedbackVaryings dispatcher. id = 125 + */ +static bool yagl_func_glGetTransformFeedbackVaryings(struct yagl_transport *t) +{ + GLuint program; + GLsizei *sizes; + int32_t sizes_maxcount; + int32_t *sizes_count; + GLenum *types; + int32_t types_maxcount; + int32_t *types_count; + program = yagl_transport_get_out_GLuint(t); + if (!yagl_transport_get_in_array(t, sizeof(GLsizei), (void**)&sizes, &sizes_maxcount, &sizes_count)) { + return false; + } + if (!yagl_transport_get_in_array(t, sizeof(GLenum), (void**)&types, &types_maxcount, &types_count)) { + return false; + } + YAGL_LOG_FUNC_ENTER_SPLIT3(glGetTransformFeedbackVaryings, GLuint, void*, void*, program, sizes, types); + *sizes_count = 0; + *types_count = 0; + (void)yagl_host_glGetTransformFeedbackVaryings(program, sizes, sizes_maxcount, sizes_count, types, types_maxcount, types_count); + YAGL_LOG_FUNC_EXIT(NULL); + + return true; +} + +/* + * glDeleteObjects dispatcher. id = 126 */ static bool yagl_func_glDeleteObjects(struct yagl_transport *t) { @@ -2443,7 +2575,7 @@ static bool yagl_func_glDeleteObjects(struct yagl_transport *t) } /* - * glBlendEquation dispatcher. id = 119 + * glBlendEquation dispatcher. id = 127 */ static bool yagl_func_glBlendEquation(struct yagl_transport *t) { @@ -2457,7 +2589,7 @@ static bool yagl_func_glBlendEquation(struct yagl_transport *t) } /* - * glBlendEquationSeparate dispatcher. id = 120 + * glBlendEquationSeparate dispatcher. id = 128 */ static bool yagl_func_glBlendEquationSeparate(struct yagl_transport *t) { @@ -2473,7 +2605,7 @@ static bool yagl_func_glBlendEquationSeparate(struct yagl_transport *t) } /* - * glBlendFunc dispatcher. id = 121 + * glBlendFunc dispatcher. id = 129 */ static bool yagl_func_glBlendFunc(struct yagl_transport *t) { @@ -2489,7 +2621,7 @@ static bool yagl_func_glBlendFunc(struct yagl_transport *t) } /* - * glBlendFuncSeparate dispatcher. id = 122 + * glBlendFuncSeparate dispatcher. id = 130 */ static bool yagl_func_glBlendFuncSeparate(struct yagl_transport *t) { @@ -2509,7 +2641,7 @@ static bool yagl_func_glBlendFuncSeparate(struct yagl_transport *t) } /* - * glBlendColor dispatcher. id = 123 + * glBlendColor dispatcher. id = 131 */ static bool yagl_func_glBlendColor(struct yagl_transport *t) { @@ -2529,7 +2661,7 @@ static bool yagl_func_glBlendColor(struct yagl_transport *t) } /* - * glClear dispatcher. id = 124 + * glClear dispatcher. id = 132 */ static bool yagl_func_glClear(struct yagl_transport *t) { @@ -2543,7 +2675,7 @@ static bool yagl_func_glClear(struct yagl_transport *t) } /* - * glClearColor dispatcher. id = 125 + * glClearColor dispatcher. id = 133 */ static bool yagl_func_glClearColor(struct yagl_transport *t) { @@ -2563,7 +2695,7 @@ static bool yagl_func_glClearColor(struct yagl_transport *t) } /* - * glClearDepthf dispatcher. id = 126 + * glClearDepthf dispatcher. id = 134 */ static bool yagl_func_glClearDepthf(struct yagl_transport *t) { @@ -2577,7 +2709,7 @@ static bool yagl_func_glClearDepthf(struct yagl_transport *t) } /* - * glClearStencil dispatcher. id = 127 + * glClearStencil dispatcher. id = 135 */ static bool yagl_func_glClearStencil(struct yagl_transport *t) { @@ -2591,7 +2723,7 @@ static bool yagl_func_glClearStencil(struct yagl_transport *t) } /* - * glColorMask dispatcher. id = 128 + * glColorMask dispatcher. id = 136 */ static bool yagl_func_glColorMask(struct yagl_transport *t) { @@ -2611,7 +2743,7 @@ static bool yagl_func_glColorMask(struct yagl_transport *t) } /* - * glCullFace dispatcher. id = 129 + * glCullFace dispatcher. id = 137 */ static bool yagl_func_glCullFace(struct yagl_transport *t) { @@ -2625,7 +2757,7 @@ static bool yagl_func_glCullFace(struct yagl_transport *t) } /* - * glDepthFunc dispatcher. id = 130 + * glDepthFunc dispatcher. id = 138 */ static bool yagl_func_glDepthFunc(struct yagl_transport *t) { @@ -2639,7 +2771,7 @@ static bool yagl_func_glDepthFunc(struct yagl_transport *t) } /* - * glDepthMask dispatcher. id = 131 + * glDepthMask dispatcher. id = 139 */ static bool yagl_func_glDepthMask(struct yagl_transport *t) { @@ -2653,7 +2785,7 @@ static bool yagl_func_glDepthMask(struct yagl_transport *t) } /* - * glDepthRangef dispatcher. id = 132 + * glDepthRangef dispatcher. id = 140 */ static bool yagl_func_glDepthRangef(struct yagl_transport *t) { @@ -2669,7 +2801,7 @@ static bool yagl_func_glDepthRangef(struct yagl_transport *t) } /* - * glEnable dispatcher. id = 133 + * glEnable dispatcher. id = 141 */ static bool yagl_func_glEnable(struct yagl_transport *t) { @@ -2683,7 +2815,7 @@ static bool yagl_func_glEnable(struct yagl_transport *t) } /* - * glDisable dispatcher. id = 134 + * glDisable dispatcher. id = 142 */ static bool yagl_func_glDisable(struct yagl_transport *t) { @@ -2697,7 +2829,7 @@ static bool yagl_func_glDisable(struct yagl_transport *t) } /* - * glFlush dispatcher. id = 135 + * glFlush dispatcher. id = 143 */ static bool yagl_func_glFlush(struct yagl_transport *t) { @@ -2709,7 +2841,7 @@ static bool yagl_func_glFlush(struct yagl_transport *t) } /* - * glFrontFace dispatcher. id = 136 + * glFrontFace dispatcher. id = 144 */ static bool yagl_func_glFrontFace(struct yagl_transport *t) { @@ -2723,7 +2855,7 @@ static bool yagl_func_glFrontFace(struct yagl_transport *t) } /* - * glGenerateMipmap dispatcher. id = 137 + * glGenerateMipmap dispatcher. id = 145 */ static bool yagl_func_glGenerateMipmap(struct yagl_transport *t) { @@ -2737,7 +2869,7 @@ static bool yagl_func_glGenerateMipmap(struct yagl_transport *t) } /* - * glHint dispatcher. id = 138 + * glHint dispatcher. id = 146 */ static bool yagl_func_glHint(struct yagl_transport *t) { @@ -2753,7 +2885,7 @@ static bool yagl_func_glHint(struct yagl_transport *t) } /* - * glLineWidth dispatcher. id = 139 + * glLineWidth dispatcher. id = 147 */ static bool yagl_func_glLineWidth(struct yagl_transport *t) { @@ -2767,7 +2899,7 @@ static bool yagl_func_glLineWidth(struct yagl_transport *t) } /* - * glPixelStorei dispatcher. id = 140 + * glPixelStorei dispatcher. id = 148 */ static bool yagl_func_glPixelStorei(struct yagl_transport *t) { @@ -2783,7 +2915,7 @@ static bool yagl_func_glPixelStorei(struct yagl_transport *t) } /* - * glPolygonOffset dispatcher. id = 141 + * glPolygonOffset dispatcher. id = 149 */ static bool yagl_func_glPolygonOffset(struct yagl_transport *t) { @@ -2799,7 +2931,7 @@ static bool yagl_func_glPolygonOffset(struct yagl_transport *t) } /* - * glScissor dispatcher. id = 142 + * glScissor dispatcher. id = 150 */ static bool yagl_func_glScissor(struct yagl_transport *t) { @@ -2819,7 +2951,7 @@ static bool yagl_func_glScissor(struct yagl_transport *t) } /* - * glStencilFunc dispatcher. id = 143 + * glStencilFunc dispatcher. id = 151 */ static bool yagl_func_glStencilFunc(struct yagl_transport *t) { @@ -2837,7 +2969,7 @@ static bool yagl_func_glStencilFunc(struct yagl_transport *t) } /* - * glStencilMask dispatcher. id = 144 + * glStencilMask dispatcher. id = 152 */ static bool yagl_func_glStencilMask(struct yagl_transport *t) { @@ -2851,7 +2983,7 @@ static bool yagl_func_glStencilMask(struct yagl_transport *t) } /* - * glStencilOp dispatcher. id = 145 + * glStencilOp dispatcher. id = 153 */ static bool yagl_func_glStencilOp(struct yagl_transport *t) { @@ -2869,7 +3001,7 @@ static bool yagl_func_glStencilOp(struct yagl_transport *t) } /* - * glSampleCoverage dispatcher. id = 146 + * glSampleCoverage dispatcher. id = 154 */ static bool yagl_func_glSampleCoverage(struct yagl_transport *t) { @@ -2885,7 +3017,7 @@ static bool yagl_func_glSampleCoverage(struct yagl_transport *t) } /* - * glViewport dispatcher. id = 147 + * glViewport dispatcher. id = 155 */ static bool yagl_func_glViewport(struct yagl_transport *t) { @@ -2905,7 +3037,7 @@ static bool yagl_func_glViewport(struct yagl_transport *t) } /* - * glStencilFuncSeparate dispatcher. id = 148 + * glStencilFuncSeparate dispatcher. id = 156 */ static bool yagl_func_glStencilFuncSeparate(struct yagl_transport *t) { @@ -2925,7 +3057,7 @@ static bool yagl_func_glStencilFuncSeparate(struct yagl_transport *t) } /* - * glStencilMaskSeparate dispatcher. id = 149 + * glStencilMaskSeparate dispatcher. id = 157 */ static bool yagl_func_glStencilMaskSeparate(struct yagl_transport *t) { @@ -2941,7 +3073,7 @@ static bool yagl_func_glStencilMaskSeparate(struct yagl_transport *t) } /* - * glStencilOpSeparate dispatcher. id = 150 + * glStencilOpSeparate dispatcher. id = 158 */ static bool yagl_func_glStencilOpSeparate(struct yagl_transport *t) { @@ -2961,7 +3093,7 @@ static bool yagl_func_glStencilOpSeparate(struct yagl_transport *t) } /* - * glPointSize dispatcher. id = 151 + * glPointSize dispatcher. id = 159 */ static bool yagl_func_glPointSize(struct yagl_transport *t) { @@ -2975,7 +3107,7 @@ static bool yagl_func_glPointSize(struct yagl_transport *t) } /* - * glAlphaFunc dispatcher. id = 152 + * glAlphaFunc dispatcher. id = 160 */ static bool yagl_func_glAlphaFunc(struct yagl_transport *t) { @@ -2991,7 +3123,7 @@ static bool yagl_func_glAlphaFunc(struct yagl_transport *t) } /* - * glMatrixMode dispatcher. id = 153 + * glMatrixMode dispatcher. id = 161 */ static bool yagl_func_glMatrixMode(struct yagl_transport *t) { @@ -3005,7 +3137,7 @@ static bool yagl_func_glMatrixMode(struct yagl_transport *t) } /* - * glLoadIdentity dispatcher. id = 154 + * glLoadIdentity dispatcher. id = 162 */ static bool yagl_func_glLoadIdentity(struct yagl_transport *t) { @@ -3017,7 +3149,7 @@ static bool yagl_func_glLoadIdentity(struct yagl_transport *t) } /* - * glPopMatrix dispatcher. id = 155 + * glPopMatrix dispatcher. id = 163 */ static bool yagl_func_glPopMatrix(struct yagl_transport *t) { @@ -3029,7 +3161,7 @@ static bool yagl_func_glPopMatrix(struct yagl_transport *t) } /* - * glPushMatrix dispatcher. id = 156 + * glPushMatrix dispatcher. id = 164 */ static bool yagl_func_glPushMatrix(struct yagl_transport *t) { @@ -3041,7 +3173,7 @@ static bool yagl_func_glPushMatrix(struct yagl_transport *t) } /* - * glRotatef dispatcher. id = 157 + * glRotatef dispatcher. id = 165 */ static bool yagl_func_glRotatef(struct yagl_transport *t) { @@ -3061,7 +3193,7 @@ static bool yagl_func_glRotatef(struct yagl_transport *t) } /* - * glTranslatef dispatcher. id = 158 + * glTranslatef dispatcher. id = 166 */ static bool yagl_func_glTranslatef(struct yagl_transport *t) { @@ -3079,7 +3211,7 @@ static bool yagl_func_glTranslatef(struct yagl_transport *t) } /* - * glScalef dispatcher. id = 159 + * glScalef dispatcher. id = 167 */ static bool yagl_func_glScalef(struct yagl_transport *t) { @@ -3097,7 +3229,7 @@ static bool yagl_func_glScalef(struct yagl_transport *t) } /* - * glOrthof dispatcher. id = 160 + * glOrthof dispatcher. id = 168 */ static bool yagl_func_glOrthof(struct yagl_transport *t) { @@ -3121,7 +3253,7 @@ static bool yagl_func_glOrthof(struct yagl_transport *t) } /* - * glColor4f dispatcher. id = 161 + * glColor4f dispatcher. id = 169 */ static bool yagl_func_glColor4f(struct yagl_transport *t) { @@ -3141,7 +3273,7 @@ static bool yagl_func_glColor4f(struct yagl_transport *t) } /* - * glColor4ub dispatcher. id = 162 + * glColor4ub dispatcher. id = 170 */ static bool yagl_func_glColor4ub(struct yagl_transport *t) { @@ -3161,7 +3293,7 @@ static bool yagl_func_glColor4ub(struct yagl_transport *t) } /* - * glNormal3f dispatcher. id = 163 + * glNormal3f dispatcher. id = 171 */ static bool yagl_func_glNormal3f(struct yagl_transport *t) { @@ -3179,7 +3311,7 @@ static bool yagl_func_glNormal3f(struct yagl_transport *t) } /* - * glPointParameterf dispatcher. id = 164 + * glPointParameterf dispatcher. id = 172 */ static bool yagl_func_glPointParameterf(struct yagl_transport *t) { @@ -3195,7 +3327,7 @@ static bool yagl_func_glPointParameterf(struct yagl_transport *t) } /* - * glPointParameterfv dispatcher. id = 165 + * glPointParameterfv dispatcher. id = 173 */ static bool yagl_func_glPointParameterfv(struct yagl_transport *t) { @@ -3214,7 +3346,7 @@ static bool yagl_func_glPointParameterfv(struct yagl_transport *t) } /* - * glFogf dispatcher. id = 166 + * glFogf dispatcher. id = 174 */ static bool yagl_func_glFogf(struct yagl_transport *t) { @@ -3230,7 +3362,7 @@ static bool yagl_func_glFogf(struct yagl_transport *t) } /* - * glFogfv dispatcher. id = 167 + * glFogfv dispatcher. id = 175 */ static bool yagl_func_glFogfv(struct yagl_transport *t) { @@ -3249,7 +3381,7 @@ static bool yagl_func_glFogfv(struct yagl_transport *t) } /* - * glFrustumf dispatcher. id = 168 + * glFrustumf dispatcher. id = 176 */ static bool yagl_func_glFrustumf(struct yagl_transport *t) { @@ -3273,7 +3405,7 @@ static bool yagl_func_glFrustumf(struct yagl_transport *t) } /* - * glLightf dispatcher. id = 169 + * glLightf dispatcher. id = 177 */ static bool yagl_func_glLightf(struct yagl_transport *t) { @@ -3291,7 +3423,7 @@ static bool yagl_func_glLightf(struct yagl_transport *t) } /* - * glLightfv dispatcher. id = 170 + * glLightfv dispatcher. id = 178 */ static bool yagl_func_glLightfv(struct yagl_transport *t) { @@ -3312,7 +3444,7 @@ static bool yagl_func_glLightfv(struct yagl_transport *t) } /* - * glGetLightfv dispatcher. id = 171 + * glGetLightfv dispatcher. id = 179 */ static bool yagl_func_glGetLightfv(struct yagl_transport *t) { @@ -3335,7 +3467,7 @@ static bool yagl_func_glGetLightfv(struct yagl_transport *t) } /* - * glLightModelf dispatcher. id = 172 + * glLightModelf dispatcher. id = 180 */ static bool yagl_func_glLightModelf(struct yagl_transport *t) { @@ -3351,7 +3483,7 @@ static bool yagl_func_glLightModelf(struct yagl_transport *t) } /* - * glLightModelfv dispatcher. id = 173 + * glLightModelfv dispatcher. id = 181 */ static bool yagl_func_glLightModelfv(struct yagl_transport *t) { @@ -3370,7 +3502,7 @@ static bool yagl_func_glLightModelfv(struct yagl_transport *t) } /* - * glMaterialf dispatcher. id = 174 + * glMaterialf dispatcher. id = 182 */ static bool yagl_func_glMaterialf(struct yagl_transport *t) { @@ -3388,7 +3520,7 @@ static bool yagl_func_glMaterialf(struct yagl_transport *t) } /* - * glMaterialfv dispatcher. id = 175 + * glMaterialfv dispatcher. id = 183 */ static bool yagl_func_glMaterialfv(struct yagl_transport *t) { @@ -3409,7 +3541,7 @@ static bool yagl_func_glMaterialfv(struct yagl_transport *t) } /* - * glGetMaterialfv dispatcher. id = 176 + * glGetMaterialfv dispatcher. id = 184 */ static bool yagl_func_glGetMaterialfv(struct yagl_transport *t) { @@ -3432,7 +3564,7 @@ static bool yagl_func_glGetMaterialfv(struct yagl_transport *t) } /* - * glShadeModel dispatcher. id = 177 + * glShadeModel dispatcher. id = 185 */ static bool yagl_func_glShadeModel(struct yagl_transport *t) { @@ -3446,7 +3578,7 @@ static bool yagl_func_glShadeModel(struct yagl_transport *t) } /* - * glLogicOp dispatcher. id = 178 + * glLogicOp dispatcher. id = 186 */ static bool yagl_func_glLogicOp(struct yagl_transport *t) { @@ -3460,7 +3592,7 @@ static bool yagl_func_glLogicOp(struct yagl_transport *t) } /* - * glMultMatrixf dispatcher. id = 179 + * glMultMatrixf dispatcher. id = 187 */ static bool yagl_func_glMultMatrixf(struct yagl_transport *t) { @@ -3477,7 +3609,7 @@ static bool yagl_func_glMultMatrixf(struct yagl_transport *t) } /* - * glLoadMatrixf dispatcher. id = 180 + * glLoadMatrixf dispatcher. id = 188 */ static bool yagl_func_glLoadMatrixf(struct yagl_transport *t) { @@ -3494,7 +3626,7 @@ static bool yagl_func_glLoadMatrixf(struct yagl_transport *t) } /* - * glClipPlanef dispatcher. id = 181 + * glClipPlanef dispatcher. id = 189 */ static bool yagl_func_glClipPlanef(struct yagl_transport *t) { @@ -3513,7 +3645,7 @@ static bool yagl_func_glClipPlanef(struct yagl_transport *t) } /* - * glGetClipPlanef dispatcher. id = 182 + * glGetClipPlanef dispatcher. id = 190 */ static bool yagl_func_glGetClipPlanef(struct yagl_transport *t) { @@ -3534,7 +3666,7 @@ static bool yagl_func_glGetClipPlanef(struct yagl_transport *t) } /* - * glUpdateOffscreenImageYAGL dispatcher. id = 183 + * glUpdateOffscreenImageYAGL dispatcher. id = 191 */ static bool yagl_func_glUpdateOffscreenImageYAGL(struct yagl_transport *t) { @@ -3559,7 +3691,7 @@ static bool yagl_func_glUpdateOffscreenImageYAGL(struct yagl_transport *t) } /* - * glGenUniformLocationYAGL dispatcher. id = 184 + * glGenUniformLocationYAGL dispatcher. id = 192 */ static bool yagl_func_glGenUniformLocationYAGL(struct yagl_transport *t) { @@ -3580,7 +3712,7 @@ static bool yagl_func_glGenUniformLocationYAGL(struct yagl_transport *t) } /* - * glDeleteUniformLocationsYAGL dispatcher. id = 185 + * glDeleteUniformLocationsYAGL dispatcher. id = 193 */ static bool yagl_func_glDeleteUniformLocationsYAGL(struct yagl_transport *t) { @@ -3596,7 +3728,7 @@ static bool yagl_func_glDeleteUniformLocationsYAGL(struct yagl_transport *t) return true; } -const uint32_t yagl_gles_api_num_funcs = 185; +const uint32_t yagl_gles_api_num_funcs = 193; yagl_api_func yagl_gles_api_funcs[] = { &yagl_func_glDrawArrays, @@ -3716,6 +3848,14 @@ yagl_api_func yagl_gles_api_funcs[] = { &yagl_func_glGetFloatv, &yagl_func_glGetString, &yagl_func_glIsEnabled, + &yagl_func_glGenTransformFeedbacks, + &yagl_func_glBindTransformFeedback, + &yagl_func_glBeginTransformFeedback, + &yagl_func_glEndTransformFeedback, + &yagl_func_glPauseTransformFeedback, + &yagl_func_glResumeTransformFeedback, + &yagl_func_glTransformFeedbackVaryings, + &yagl_func_glGetTransformFeedbackVaryings, &yagl_func_glDeleteObjects, &yagl_func_glBlendEquation, &yagl_func_glBlendEquationSeparate, diff --git a/hw/yagl_apis/gles/yagl_host_gles_calls.c b/hw/yagl_apis/gles/yagl_host_gles_calls.c index 75b20fd..fa05d79 100644 --- a/hw/yagl_apis/gles/yagl_host_gles_calls.c +++ b/hw/yagl_apis/gles/yagl_host_gles_calls.c @@ -10,6 +10,7 @@ #include "yagl_thread.h" #include "yagl_vector.h" #include "yagl_object_map.h" +#include "yagl_transport.h" static YAGL_DEFINE_TLS(struct yagl_gles_api_ts*, gles_api_ts); @@ -323,6 +324,21 @@ static void yagl_gles_vertex_array_destroy(struct yagl_object *obj) YAGL_LOG_FUNC_EXIT(NULL); } +static void yagl_gles_transform_feedback_destroy(struct yagl_object *obj) +{ + struct yagl_gles_object *gles_obj = (struct yagl_gles_object*)obj; + + YAGL_LOG_FUNC_ENTER(yagl_gles_transform_feedback_destroy, "%u", obj->global_name); + + yagl_ensure_ctx(gles_obj->ctx_id); + gles_obj->driver->DeleteTransformFeedbacks(1, &obj->global_name); + yagl_unensure_ctx(gles_obj->ctx_id); + + g_free(gles_obj); + + YAGL_LOG_FUNC_EXIT(NULL); +} + static __inline GLuint yagl_gles_object_get(GLuint local_name) { return (local_name > 0) ? yagl_object_map_get(cur_ts->ps->object_map, local_name) : 0; @@ -1844,6 +1860,97 @@ GLboolean yagl_host_glIsEnabled(GLenum cap) return gles_api_ts->driver->IsEnabled(cap); } +void yagl_host_glGenTransformFeedbacks(const GLuint *ids, int32_t ids_count) +{ + int i; + + for (i = 0; i < ids_count; ++i) { + GLuint global_name; + + gles_api_ts->driver->GenTransformFeedbacks(1, &global_name); + + yagl_gles_object_add(ids[i], + global_name, + yagl_get_ctx_id(), + &yagl_gles_transform_feedback_destroy); + } +} + +void yagl_host_glBindTransformFeedback(GLenum target, + GLuint id) +{ + gles_api_ts->driver->BindTransformFeedback(target, + yagl_gles_object_get(id)); +} + +void yagl_host_glBeginTransformFeedback(GLenum primitiveMode) +{ + gles_api_ts->driver->BeginTransformFeedback(primitiveMode); +} + +void yagl_host_glEndTransformFeedback(void) +{ + gles_api_ts->driver->EndTransformFeedback(); +} + +void yagl_host_glPauseTransformFeedback(void) +{ + gles_api_ts->driver->PauseTransformFeedback(); +} + +void yagl_host_glResumeTransformFeedback(void) +{ + gles_api_ts->driver->ResumeTransformFeedback(); +} + +void yagl_host_glTransformFeedbackVaryings(GLuint program, + const GLchar *varyings, int32_t varyings_count, + GLenum bufferMode) +{ + const char **strings; + int32_t num_strings = 0; + + strings = yagl_transport_get_out_string_array(varyings, + varyings_count, + &num_strings); + + gles_api_ts->driver->TransformFeedbackVaryings(yagl_gles_object_get(program), + num_strings, + strings, + bufferMode); + + g_free(strings); +} + +void yagl_host_glGetTransformFeedbackVaryings(GLuint program, + GLsizei *sizes, int32_t sizes_maxcount, int32_t *sizes_count, + GLenum *types, int32_t types_maxcount, int32_t *types_count) +{ + GLuint obj = yagl_gles_object_get(program); + int32_t i; + + if (sizes_maxcount != types_maxcount) { + return; + } + + for (i = 0; i < sizes_maxcount; ++i) { + GLsizei length = -1; + GLchar c[2]; + + gles_api_ts->driver->GetTransformFeedbackVarying(obj, + i, sizeof(c), &length, + &sizes[i], &types[i], + c); + + if (length <= 0) { + sizes[i] = 0; + types[i] = 0; + } + } + + *sizes_count = *types_count = sizes_maxcount; +} + void yagl_host_glDeleteObjects(const GLuint *objects, int32_t objects_count) { int i; diff --git a/hw/yagl_apis/gles/yagl_host_gles_calls.h b/hw/yagl_apis/gles/yagl_host_gles_calls.h index b22690f..6f1b800 100644 --- a/hw/yagl_apis/gles/yagl_host_gles_calls.h +++ b/hw/yagl_apis/gles/yagl_host_gles_calls.h @@ -393,6 +393,19 @@ void yagl_host_glGetFloatv(GLenum pname, void yagl_host_glGetString(GLenum name, GLchar *str, int32_t str_maxcount, int32_t *str_count); GLboolean yagl_host_glIsEnabled(GLenum cap); +void yagl_host_glGenTransformFeedbacks(const GLuint *ids, int32_t ids_count); +void yagl_host_glBindTransformFeedback(GLenum target, + GLuint id); +void yagl_host_glBeginTransformFeedback(GLenum primitiveMode); +void yagl_host_glEndTransformFeedback(void); +void yagl_host_glPauseTransformFeedback(void); +void yagl_host_glResumeTransformFeedback(void); +void yagl_host_glTransformFeedbackVaryings(GLuint program, + const GLchar *varyings, int32_t varyings_count, + GLenum bufferMode); +void yagl_host_glGetTransformFeedbackVaryings(GLuint program, + GLsizei *sizes, int32_t sizes_maxcount, int32_t *sizes_count, + GLenum *types, int32_t types_maxcount, int32_t *types_count); void yagl_host_glDeleteObjects(const GLuint *objects, int32_t objects_count); void yagl_host_glBlendEquation(GLenum mode); void yagl_host_glBlendEquationSeparate(GLenum modeRGB, diff --git a/hw/yagl_drivers/gles_ogl/yagl_gles_ogl.c b/hw/yagl_drivers/gles_ogl/yagl_gles_ogl.c index 33d4e61..077bc64 100644 --- a/hw/yagl_drivers/gles_ogl/yagl_gles_ogl.c +++ b/hw/yagl_drivers/gles_ogl/yagl_gles_ogl.c @@ -217,6 +217,15 @@ struct yagl_gles_driver *yagl_gles_ogl_create(struct yagl_dyn_lib *dyn_lib, YAGL_GLES_OGL_GET_PROC(driver, BindBufferRange, glBindBufferRange); YAGL_GLES_OGL_GET_PROC(driver, GetActiveUniformBlockName, glGetActiveUniformBlockName); YAGL_GLES_OGL_GET_PROC(driver, GetActiveUniformBlockiv, glGetActiveUniformBlockiv); + YAGL_GLES_OGL_GET_PROC(driver, GenTransformFeedbacks, glGenTransformFeedbacks); + YAGL_GLES_OGL_GET_PROC(driver, BindTransformFeedback, glBindTransformFeedback); + YAGL_GLES_OGL_GET_PROC(driver, BeginTransformFeedback, glBeginTransformFeedback); + YAGL_GLES_OGL_GET_PROC(driver, EndTransformFeedback, glEndTransformFeedback); + YAGL_GLES_OGL_GET_PROC(driver, PauseTransformFeedback, glPauseTransformFeedback); + YAGL_GLES_OGL_GET_PROC(driver, ResumeTransformFeedback, glResumeTransformFeedback); + YAGL_GLES_OGL_GET_PROC(driver, DeleteTransformFeedbacks, glDeleteTransformFeedbacks); + YAGL_GLES_OGL_GET_PROC(driver, TransformFeedbackVaryings, glTransformFeedbackVaryings); + YAGL_GLES_OGL_GET_PROC(driver, GetTransformFeedbackVarying, glGetTransformFeedbackVarying); } driver->destroy = &yagl_gles_ogl_destroy; diff --git a/hw/yagl_gles_driver.h b/hw/yagl_gles_driver.h index e458b7e..ac57b63 100644 --- a/hw/yagl_gles_driver.h +++ b/hw/yagl_gles_driver.h @@ -91,8 +91,6 @@ struct yagl_gles_driver YAGL_GLES_DRIVER_FUNC4(BufferData, GLenum, GLsizeiptr, const GLvoid*, GLenum, target, size, data, usage) YAGL_GLES_DRIVER_FUNC4(BufferSubData, GLenum, GLintptr, GLsizeiptr, const GLvoid*, target, offset, size, data) YAGL_GLES_DRIVER_FUNC2(DeleteBuffers, GLsizei, const GLuint*, n, buffers) - YAGL_GLES_DRIVER_FUNC3(BindBufferBase, GLenum, GLuint, GLuint, target, index, buffer) - YAGL_GLES_DRIVER_FUNC5(BindBufferRange, GLenum, GLuint, GLuint, GLintptr, GLsizeiptr, target, index, buffer, offset, size) YAGL_GLES_DRIVER_FUNC2(GenTextures, GLsizei, GLuint*, n, textures) YAGL_GLES_DRIVER_FUNC2(BindTexture, GLenum, GLuint, target, texture) YAGL_GLES_DRIVER_FUNC2(DeleteTextures, GLsizei, const GLuint*, n, textures) @@ -180,12 +178,6 @@ struct yagl_gles_driver YAGL_GLES_DRIVER_FUNC2(VertexAttrib3fv, GLuint, const GLfloat*, indx, values) YAGL_GLES_DRIVER_FUNC5(VertexAttrib4f, GLuint, GLfloat, GLfloat, GLfloat, GLfloat, indx, x, y, z, w) YAGL_GLES_DRIVER_FUNC2(VertexAttrib4fv, GLuint, const GLfloat*, indx, values) - YAGL_GLES_DRIVER_FUNC5(GetActiveUniformsiv, GLuint, GLsizei, const GLuint*, GLenum, GLint*, program, uniformCount, uniformIndices, pname, params) - YAGL_GLES_DRIVER_FUNC4(GetUniformIndices, GLuint, GLsizei, const GLchar* const*, GLuint*, program, uniformCount, uniformNames, uniformIndices) - YAGL_GLES_DRIVER_FUNC_RET2(GLuint, GetUniformBlockIndex, GLuint, const GLchar*, program, uniformBlockName); - YAGL_GLES_DRIVER_FUNC3(UniformBlockBinding, GLuint, GLuint, GLuint, program, uniformBlockIndex, uniformBlockBinding); - YAGL_GLES_DRIVER_FUNC5(GetActiveUniformBlockName, GLuint, GLuint, GLsizei, GLsizei*, GLchar*, program, uniformBlockIndex, bufSize, length, uniformBlockName); - YAGL_GLES_DRIVER_FUNC4(GetActiveUniformBlockiv, GLuint, GLuint, GLenum, GLint*, program, uniformBlockIndex, pname, params); YAGL_GLES_DRIVER_FUNC2(GetIntegerv, GLenum, GLint*, pname, params) YAGL_GLES_DRIVER_FUNC2(GetFloatv, GLenum, GLfloat*, pname, params) YAGL_GLES_DRIVER_FUNC_RET1(const GLubyte*, GetString, GLenum, name) @@ -270,6 +262,23 @@ struct yagl_gles_driver YAGL_GLES_DRIVER_FUNC2(GenVertexArrays, GLsizei, GLuint*, n, arrays) YAGL_GLES_DRIVER_FUNC1(BindVertexArray, GLuint, array) YAGL_GLES_DRIVER_FUNC2(DeleteVertexArrays, GLsizei, const GLuint*, n, arrays) + YAGL_GLES_DRIVER_FUNC5(GetActiveUniformsiv, GLuint, GLsizei, const GLuint*, GLenum, GLint*, program, uniformCount, uniformIndices, pname, params) + YAGL_GLES_DRIVER_FUNC4(GetUniformIndices, GLuint, GLsizei, const GLchar* const*, GLuint*, program, uniformCount, uniformNames, uniformIndices) + YAGL_GLES_DRIVER_FUNC_RET2(GLuint, GetUniformBlockIndex, GLuint, const GLchar*, program, uniformBlockName); + YAGL_GLES_DRIVER_FUNC3(UniformBlockBinding, GLuint, GLuint, GLuint, program, uniformBlockIndex, uniformBlockBinding); + YAGL_GLES_DRIVER_FUNC5(GetActiveUniformBlockName, GLuint, GLuint, GLsizei, GLsizei*, GLchar*, program, uniformBlockIndex, bufSize, length, uniformBlockName); + YAGL_GLES_DRIVER_FUNC4(GetActiveUniformBlockiv, GLuint, GLuint, GLenum, GLint*, program, uniformBlockIndex, pname, params); + YAGL_GLES_DRIVER_FUNC3(BindBufferBase, GLenum, GLuint, GLuint, target, index, buffer) + YAGL_GLES_DRIVER_FUNC5(BindBufferRange, GLenum, GLuint, GLuint, GLintptr, GLsizeiptr, target, index, buffer, offset, size) + YAGL_GLES_DRIVER_FUNC2(GenTransformFeedbacks, GLsizei, GLuint*, n, ids) + YAGL_GLES_DRIVER_FUNC2(BindTransformFeedback, GLenum, GLuint, target, id) + YAGL_GLES_DRIVER_FUNC1(BeginTransformFeedback, GLenum, primitiveMode) + YAGL_GLES_DRIVER_FUNC0(EndTransformFeedback) + YAGL_GLES_DRIVER_FUNC0(PauseTransformFeedback) + YAGL_GLES_DRIVER_FUNC0(ResumeTransformFeedback) + YAGL_GLES_DRIVER_FUNC2(DeleteTransformFeedbacks, GLsizei, const GLuint*, n, ids) + YAGL_GLES_DRIVER_FUNC4(TransformFeedbackVaryings, GLuint, GLsizei, const GLchar* const*, GLenum, program, count, varyings, bufferMode) + YAGL_GLES_DRIVER_FUNC7(GetTransformFeedbackVarying, GLuint, GLuint, GLsizei, GLsizei*, GLsizei*, GLenum*, GLchar*, program, index, bufSize, length, size, type, name) /* * @} diff --git a/hw/yagl_transport.c b/hw/yagl_transport.c index 4da1954..cb111e0 100644 --- a/hw/yagl_transport.c +++ b/hw/yagl_transport.c @@ -1,5 +1,8 @@ #include "yagl_transport.h" #include "yagl_mem.h" +#include "yagl_log.h" +#include "yagl_thread.h" +#include "yagl_process.h" typedef enum { @@ -265,3 +268,40 @@ bool yagl_transport_get_in_array(struct yagl_transport *t, return true; } + +const char **yagl_transport_get_out_string_array(const char *data, + int32_t data_count, + int32_t *array_count) +{ + struct yagl_vector v; + char *tmp; + + YAGL_LOG_FUNC_SET(yagl_transport_get_out_string_array); + + if (!data) { + *array_count = 0; + return NULL; + } + + yagl_vector_init(&v, sizeof(char*), 0); + + while (data_count > 0) { + tmp = memchr(data, '\0', data_count); + + if (!tmp) { + YAGL_LOG_ERROR("NULL not found in string array of size %d", + data_count); + break; + } + + yagl_vector_push_back(&v, &data); + + data = tmp + 1; + + data_count -= (tmp - data); + } + + *array_count = yagl_vector_size(&v); + + return (const char**)yagl_vector_detach(&v); +} diff --git a/hw/yagl_transport.h b/hw/yagl_transport.h index 092c1a7..8c80b09 100644 --- a/hw/yagl_transport.h +++ b/hw/yagl_transport.h @@ -87,6 +87,10 @@ bool yagl_transport_get_in_array(struct yagl_transport *t, int32_t *maxcount, int32_t **count); +const char **yagl_transport_get_out_string_array(const char *data, + int32_t data_count, + int32_t *array_count); + static __inline void yagl_transport_advance(struct yagl_transport *t, uint32_t size) { -- 2.7.4