[Mesa-dev] [PATCH 1/3] vbo: implement uploading of current attribs

Marek Olšák maraeo at gmail.com
Mon Oct 29 16:53:27 PDT 2012


On Mon, Oct 29, 2012 at 10:55 PM, Eric Anholt <eric at anholt.net> wrote:
> Marek Olšák <maraeo at gmail.com> writes:
>
>> The driver chooses which attrib should be uploaded by calling
>> vbo_get_current_attrib_buffer.
>>
>> The reason for this is we can track which current attribs are dirty and skip
>> uploading accordingly. Before, we had to upload the attribs every draw call,
>> which wasn't very effective.
>>
>> Stats for a whole run of the Nexuiz demo2 benchmark:
>>   Without the following st/mesa patch:
>>   - 21099 zero-stride vertices uploaded in u_vbuf.
>>   With the st/mesa patch:
>>   - 2474 zero-stride vertices uploaded in vbo.
>
> How about actual performance stats?  It seems like this might help, but
> I'm always dubious of +LOC without stats.

The difference isn't measurable, not even with the gallium no-op
driver, but I didn't know until I implemented this. Profiling shows
that Nexuiz spends only 19% of time in glDrawRangeElements, so I guess
any small CPU optimization wouldn't be measurable anyway.

>
> I think there are updates to Current.Attrib that were missed in the
> flagging, grepping for that: _mesa_update_color_material() calls.

The material colors are never bound as vertex inputs, therefore their
flagging isn't really useful for this case. Maybe materials shouldn't
be managed by the vbo module at all.

>
> Also it seems like there must be something else that needs flagging, but
> I can't find it.  Isn't copy_to_current about the transition from
> per-vertex varying attributes to a uniform per draw call attribute, and
> unused if you're only updating the current attribute in between
> beginend/drawarrays?

Frankly, I thought for a moment that I knew how it worked, but now
again I've got no idea, it looks too complicated and I am too tired
for today. copy_to_current is the only place which flags
_NEW_CURRENT_ATTRIB, so it must be the right place for flagging.

I am not going to push the patch yet. I need to think this through.

I guess it would be way simplier if there were separate ATTR macros
for beginend and drawarrays.

Marek


More information about the mesa-dev mailing list