diff options
author | Eric Anholt <[email protected]> | 2012-01-02 17:08:13 -0800 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2012-01-05 09:11:29 -0800 |
commit | 9d36c96d6ec9f2c05c8e0b9ef18c5462cddee8c1 (patch) | |
tree | bbf6423de5fc0064dc86ca35f8b81978d2177eb9 /src/mesa/main/transformfeedback.c | |
parent | cc1d8a466a52ae89080f5dec06c1859235643532 (diff) |
mesa: Fix glGetTransformFeedbackVarying().
The current implementation was totally broken -- it was looking in an
unpopulated structure for varyings, and trying to do so using the
current list of varying names, not the list used at link time.
v2: Fix leaking of memory into the program per re-link.
Reviewed-by: Paul Berry <[email protected]>
Diffstat (limited to 'src/mesa/main/transformfeedback.c')
-rw-r--r-- | src/mesa/main/transformfeedback.c | 37 |
1 files changed, 11 insertions, 26 deletions
diff --git a/src/mesa/main/transformfeedback.c b/src/mesa/main/transformfeedback.c index 02681c61583..c2114c22766 100644 --- a/src/mesa/main/transformfeedback.c +++ b/src/mesa/main/transformfeedback.c @@ -694,8 +694,7 @@ _mesa_GetTransformFeedbackVarying(GLuint program, GLuint index, GLsizei *size, GLenum *type, GLchar *name) { const struct gl_shader_program *shProg; - const GLchar *varyingName; - GLint v; + const struct gl_transform_feedback_info *linked_xfb_info; GET_CURRENT_CONTEXT(ctx); shProg = _mesa_lookup_shader_program(ctx, program); @@ -705,36 +704,22 @@ _mesa_GetTransformFeedbackVarying(GLuint program, GLuint index, return; } - if (index >= shProg->TransformFeedback.NumVarying) { + linked_xfb_info = &shProg->LinkedTransformFeedback; + if (index >= linked_xfb_info->NumVarying) { _mesa_error(ctx, GL_INVALID_VALUE, "glGetTransformFeedbackVaryings(index=%u)", index); return; } - varyingName = shProg->TransformFeedback.VaryingNames[index]; + /* return the varying's name and length */ + _mesa_copy_string(name, bufSize, length, + linked_xfb_info->Varyings[index].Name); - v = _mesa_lookup_parameter_index(shProg->Varying, -1, varyingName); - if (v >= 0) { - struct gl_program_parameter *param = &shProg->Varying->Parameters[v]; - - /* return the varying's name and length */ - _mesa_copy_string(name, bufSize, length, varyingName); - - /* return the datatype and value's size (in datatype units) */ - if (type) - *type = param->DataType; - if (size) - *size = param->Size; - } - else { - name[0] = 0; - if (length) - *length = 0; - if (type) - *type = 0; - if (size) - *size = 0; - } + /* return the datatype and value's size (in datatype units) */ + if (type) + *type = linked_xfb_info->Varyings[index].Type; + if (size) + *size = linked_xfb_info->Varyings[index].Size; } |