[Mesa-dev] [PATCH 1/8] mesa: Record transform feedback stride in linker output.

Paul Berry stereotype441 at gmail.com
Wed Dec 14 08:30:30 PST 2011


On 13 December 2011 15:53, Brian Paul <brian.e.paul at gmail.com> wrote:

> On Tue, Dec 13, 2011 at 4:35 PM, Paul Berry <stereotype441 at gmail.com>
> 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];
> >  };
>
> Minor nit: I'd use a single line comment there: /** Number of
> components... */ to be consistent with other comments.
>

Good point.  Considering Ken's confusion, though, I think I'll expand the
comment to make it clearer what's going on.


>
> The rest looks OK to me otherwise.  Reviewed-by: Brian Paul
> <brianp at vmware.com>  But if you have any doubts, another one of the
> GLSL people should probably review the rest too.
>
> -Brian
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20111214/218652d4/attachment.htm>


More information about the mesa-dev mailing list