mesa: Fix extra memset in store_tfeedback_info()
authorPaul Berry <stereotype441@gmail.com>
Thu, 5 Jan 2012 21:06:36 +0000 (13:06 -0800)
committerPaul Berry <stereotype441@gmail.com>
Thu, 5 Jan 2012 21:26:48 +0000 (13:26 -0800)
Commit 9d36c96d6ec9f2c05c8e0b9ef18c5462cddee8c1 (mesa: Fix
glGetTransformFeedbackVarying()) accidentally added an extra memset()
call to the store_tfeedback_info() function, causing
prog->LinkedTransformFeedback.NumBuffers to be erased.

This patch removes the extra memset and rearranges the other
operations in store_tfeedback_info() to be in the correct order.

Fixes piglit tests "EXT_transform_feedback/api-errors *unbound*"

Reviewed-by: Eric Anholt <eric@anholt.net>
src/glsl/linker.cpp

index 3dd088324ab1718da42ac20a441ee8c19eac5329..128bbd54263a08e6cb98114932dc8106fd3f8bab 100644 (file)
@@ -1884,16 +1884,15 @@ store_tfeedback_info(struct gl_context *ctx, struct gl_shader_program *prog,
    unsigned total_tfeedback_components = 0;
    bool separate_attribs_mode =
       prog->TransformFeedback.BufferMode == GL_SEPARATE_ATTRIBS;
-   memset(&prog->LinkedTransformFeedback, 0,
-          sizeof(prog->LinkedTransformFeedback));
-   prog->LinkedTransformFeedback.NumBuffers =
-      separate_attribs_mode ? num_tfeedback_decls : 1;
 
    ralloc_free(prog->LinkedTransformFeedback.Varyings);
 
    memset(&prog->LinkedTransformFeedback, 0,
           sizeof(prog->LinkedTransformFeedback));
 
+   prog->LinkedTransformFeedback.NumBuffers =
+      separate_attribs_mode ? num_tfeedback_decls : 1;
+
    prog->LinkedTransformFeedback.Varyings =
       rzalloc_array(prog->LinkedTransformFeedback.Varyings,
                    struct gl_transform_feedback_varying_info,