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

Paul Berry stereotype441 at gmail.com
Tue Jan 3 13:07:11 PST 2012


On 3 January 2012 12:57, Ian Romanick <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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20120103/db9d4ae6/attachment-0001.htm>


More information about the mesa-dev mailing list