On 13 December 2011 15:53, Brian Paul <span dir="ltr"><<a href="mailto:brian.e.paul@gmail.com">brian.e.paul@gmail.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5">On Tue, Dec 13, 2011 at 4:35 PM, Paul Berry <<a href="mailto:stereotype441@gmail.com">stereotype441@gmail.com</a>> wrote:<br>
> This patch adds the field gl_transform_feedback_info::BufferStride,<br>
> which records the total number of components (per vertex) that<br>
> transform feedback is being instructed to store in each buffer. The<br>
> i965 gen6 back-end needs this information in order to set up binding<br>
> tables, and it seems better to have the linker provide this<br>
> information rather than force the back-end to recompute it.<br>
> ---<br>
> src/glsl/linker.cpp | 4 +++-<br>
> src/mesa/main/mtypes.h | 5 +++++<br>
> 2 files changed, 8 insertions(+), 1 deletions(-)<br>
><br>
> diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp<br>
> index b8a7126..5eb2a20 100644<br>
> --- a/src/glsl/linker.cpp<br>
> +++ b/src/glsl/linker.cpp<br>
> @@ -1599,6 +1599,7 @@ tfeedback_decl::store(struct gl_shader_program *prog,<br>
> info->Outputs[info->NumOutputs].NumComponents = this->vector_elements;<br>
> info->Outputs[info->NumOutputs].OutputBuffer = buffer;<br>
> ++info->NumOutputs;<br>
> + info->BufferStride[buffer] += this->vector_elements;<br>
> }<br>
> return true;<br>
> }<br>
> @@ -1863,7 +1864,8 @@ store_tfeedback_info(struct gl_context *ctx, struct gl_shader_program *prog,<br>
> tfeedback_decl *tfeedback_decls)<br>
> {<br>
> unsigned total_tfeedback_components = 0;<br>
> - prog->LinkedTransformFeedback.NumOutputs = 0;<br>
> + memset(&prog->LinkedTransformFeedback, 0,<br>
> + sizeof(prog->LinkedTransformFeedback));<br>
> for (unsigned i = 0; i < num_tfeedback_decls; ++i) {<br>
> unsigned buffer =<br>
> prog->TransformFeedback.BufferMode == GL_SEPARATE_ATTRIBS ? i : 0;<br>
> diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h<br>
> index 1934349..d4c600a 100644<br>
> --- a/src/mesa/main/mtypes.h<br>
> +++ b/src/mesa/main/mtypes.h<br>
> @@ -1822,6 +1822,11 @@ struct gl_transform_feedback_info {<br>
> unsigned OutputBuffer;<br>
> unsigned NumComponents;<br>
> } Outputs[MAX_PROGRAM_OUTPUTS];<br>
> +<br>
> + /**<br>
> + * Number of components stored in each buffer.<br>
> + */<br>
> + unsigned BufferStride[MAX_FEEDBACK_ATTRIBS];<br>
> };<br>
<br>
</div></div>Minor nit: I'd use a single line comment there: /** Number of<br>
components... */ to be consistent with other comments.<br></blockquote><div><br>Good point. Considering Ken's confusion, though, I think I'll expand the comment to make it clearer what's going on.<br> </div>
<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
The rest looks OK to me otherwise. Reviewed-by: Brian Paul<br>
<<a href="mailto:brianp@vmware.com">brianp@vmware.com</a>> But if you have any doubts, another one of the<br>
GLSL people should probably review the rest too.<br>
<span class="HOEnZb"><font color="#888888"><br>
-Brian<br>
</font></span></blockquote></div><br>