[Mesa-dev] [PATCH 2/3] mesa: Check that all buffers are bound in BeginTransformFeedback.

Ian Romanick idr at freedesktop.org
Tue Jan 3 16:01:43 PST 2012


On 01/03/2012 01:07 PM, Paul Berry wrote:
> On 3 January 2012 12:57, Ian Romanick <idr at freedesktop.org
> <mailto:idr at freedesktop.org>> wrote:
>
>     On 01/02/2012 09:37 PM, Paul Berry wrote:
>
>           From the EXT_transform_feedback spec:
>
>              The error INVALID_OPERATION is generated by
>              BeginTransformFeedbackEXT if any transform feedback buffer
>         object
>              binding point used in transform feedback mode does not have a
>              buffer object bound.
>
>         This required adding a new NumBuffers field to the
>         gl_transform_feedback_info struct, to keep track of how many
>         transform
>         feedback buffers are required by the current program.
>
>         Fixes Piglit tests:
>         - EXT_transform_feedback/api-__errors interleaved_unbound
>         - EXT_transform_feedback/api-__errors separate_unbound_0_1
>         - EXT_transform_feedback/api-__errors separate_unbound_0_2
>         - EXT_transform_feedback/api-__errors separate_unbound_1_2
>         ---
>           src/glsl/linker.cpp               |    7 +++++--
>           src/mesa/main/mtypes.h            |    5 +++++
>           src/mesa/main/__transformfeedback.c |   12 ++++++++++++
>           3 files changed, 22 insertions(+), 2 deletions(-)
>
>         diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
>         index ed9a5d7..43be205 100644
>         --- a/src/glsl/linker.cpp
>         +++ b/src/glsl/linker.cpp
>         @@ -1889,11 +1889,14 @@ store_tfeedback_info(struct gl_context
>         *ctx, struct gl_shader_program *prog,
>                                tfeedback_decl *tfeedback_decls)
>           {
>              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;
>              for (unsigned i = 0; i<  num_tfeedback_decls; ++i) {
>         -      unsigned buffer =
>         -         prog->TransformFeedback.__BufferMode ==
>         GL_SEPARATE_ATTRIBS ? i : 0;
>         +      unsigned buffer = separate_attribs_mode ? i : 0;
>
>
>     Is this actually necessary?  If separate_attribs_mode is false,
>     num_tfeedback_decls is 1, and i can only ever be 0.  Right?
>
>
> No, num_tfeedback_decls is the value of "count" that was passed to
> TransformFeedbackVaryings--it indicates the number of varyings that
> should be captured.  So if separate_attribs_mode is false, and more than
> one varying is being interleaved, then num_tfeedback_decls will be
> greater than 1.

Oh, right.  I misread the line before the loop.  I'll blame it on being 
sick.

Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>


More information about the mesa-dev mailing list