[Mesa-dev] [PATCH 1/8] mesa: Record transform feedback stride in linker output.
Kenneth Graunke
kenneth at whitecape.org
Wed Dec 14 02:20:02 PST 2011
On 12/13/2011 03:35 PM, Paul Berry wrote:
> This patch adds the field gl_transform_feedback_info::BufferStride,
> which records the total number of components (per vertex) that
> transform feedback is being instructed to store in each buffer. The
> i965 gen6 back-end needs this information in order to set up binding
> tables, and it seems better to have the linker provide this
> information rather than force the back-end to recompute it.
> ---
> src/glsl/linker.cpp | 4 +++-
> src/mesa/main/mtypes.h | 5 +++++
> 2 files changed, 8 insertions(+), 1 deletions(-)
>
> diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
> index b8a7126..5eb2a20 100644
> --- a/src/glsl/linker.cpp
> +++ b/src/glsl/linker.cpp
> @@ -1599,6 +1599,7 @@ tfeedback_decl::store(struct gl_shader_program *prog,
> info->Outputs[info->NumOutputs].NumComponents = this->vector_elements;
> info->Outputs[info->NumOutputs].OutputBuffer = buffer;
> ++info->NumOutputs;
> + info->BufferStride[buffer] += this->vector_elements;
> }
> return true;
> }
> @@ -1863,7 +1864,8 @@ store_tfeedback_info(struct gl_context *ctx, struct gl_shader_program *prog,
> tfeedback_decl *tfeedback_decls)
> {
> unsigned total_tfeedback_components = 0;
> - prog->LinkedTransformFeedback.NumOutputs = 0;
> + memset(&prog->LinkedTransformFeedback, 0,
> + sizeof(prog->LinkedTransformFeedback));
> for (unsigned i = 0; i < num_tfeedback_decls; ++i) {
> unsigned buffer =
> prog->TransformFeedback.BufferMode == GL_SEPARATE_ATTRIBS ? i : 0;
> diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
> index 1934349..d4c600a 100644
> --- a/src/mesa/main/mtypes.h
> +++ b/src/mesa/main/mtypes.h
> @@ -1822,6 +1822,11 @@ struct gl_transform_feedback_info {
> unsigned OutputBuffer;
> unsigned NumComponents;
> } Outputs[MAX_PROGRAM_OUTPUTS];
> +
> + /**
> + * Number of components stored in each buffer.
> + */
> + unsigned BufferStride[MAX_FEEDBACK_ATTRIBS];
> };
>
> /**
I must confess that, looking at this structure alone, I wasn't sure what
the difference between NumComponents (above) and BufferStride was.
But this is definitely useful. With or without improved comments:
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
More information about the mesa-dev
mailing list