From dc39d843d21898752ce5d79804ff9f638595d3a9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tapani=20P=C3=A4lli?= Date: Thu, 12 Mar 2015 12:08:56 +0200 Subject: [PATCH] mesa: refactor GetTransformFeedbackVarying MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Tapani Pälli Reviewed-by: Martin Peres --- src/mesa/main/transformfeedback.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/mesa/main/transformfeedback.c b/src/mesa/main/transformfeedback.c index 0a6d00cb013..103011ce572 100644 --- a/src/mesa/main/transformfeedback.c +++ b/src/mesa/main/transformfeedback.c @@ -920,7 +920,7 @@ _mesa_GetTransformFeedbackVarying(GLuint program, GLuint index, GLsizei *size, GLenum *type, GLchar *name) { const struct gl_shader_program *shProg; - const struct gl_transform_feedback_info *linked_xfb_info; + struct gl_program_resource *res; GET_CURRENT_CONTEXT(ctx); shProg = _mesa_lookup_shader_program(ctx, program); @@ -930,22 +930,27 @@ _mesa_GetTransformFeedbackVarying(GLuint program, GLuint index, return; } - linked_xfb_info = &shProg->LinkedTransformFeedback; - if (index >= (GLuint) linked_xfb_info->NumVarying) { + res = _mesa_program_resource_find_index((struct gl_shader_program *) shProg, + GL_TRANSFORM_FEEDBACK_VARYING, + index); + if (!res) { _mesa_error(ctx, GL_INVALID_VALUE, "glGetTransformFeedbackVarying(index=%u)", index); return; } /* return the varying's name and length */ - _mesa_copy_string(name, bufSize, length, - linked_xfb_info->Varyings[index].Name); + _mesa_copy_string(name, bufSize, length, _mesa_program_resource_name(res)); /* return the datatype and value's size (in datatype units) */ if (type) - *type = linked_xfb_info->Varyings[index].Type; + _mesa_program_resource_prop((struct gl_shader_program *) shProg, + res, index, GL_TYPE, (GLint*) type, + "glGetTransformFeedbackVarying"); if (size) - *size = linked_xfb_info->Varyings[index].Size; + _mesa_program_resource_prop((struct gl_shader_program *) shProg, + res, index, GL_ARRAY_SIZE, (GLint*) size, + "glGetTransformFeedbackVarying"); } -- 2.30.2