[Mesa-dev] [PATCH 1/2] st/mesa: fix max_offset computation for base vertex

Marek Olšák maraeo at gmail.com
Tue Apr 3 12:36:42 PDT 2012


On Tue, Apr 3, 2012 at 6:13 PM, Brian Paul <brianp at vmware.com> wrote:
>> Hi Brian,
>>
>> the !new_array test should stay there, because redefine_user_buffer
>> should only be called if st_validate_varrays wasn't. If new_array is
>> TRUE, we call st_validate_varrays. If it's FALSE, we call
>> redefine_user_buffer. We shouldn't and don't need to call both.
>
>
> That's not what I found.  To fix the piglit test in question we have to call
> pipe->redefine_user_buffer() for both drawing calls since we're accessing
> different ranges of user-space memory for the two calls.
>
> IIRC, st_validate_varrays() is invoked for the second drawing call, but it
> doesn't call pipe->redefine_user_buffer()

st_validate_varrays sets width0 of all user buffers to some initial
value (see all occurences of pipe_user_buffer_create).
redefine_user_buffer only updates it (no driver does anything else
than just updating width0). Therefore, st_validate_varrays sets a
wrong width0 and should be fixed in the same way like you fixed it for
redefine_user_buffer. Basically, the numbers we set in
pipe_user_buffer_create and redefine_user_buffer should lead to the
same width0.

I was once proposing to just set width0 of all user vertex buffers to
~0, so that we don't have to do these useless computations, but that
was NAK'd back then.

>> The vbo module doesn't always set _NEW_ARRAY. For example, I get
>> new_array==FALSE with the game Torcs.
>
>
> The piglit test causes _NEW_ARRAY to be set for both drawing calls.

Yes. The optimization of not setting _NEW_ARRAY currently works only
with a fixed-function vertex program.

Marek


More information about the mesa-dev mailing list