[Mesa-dev] [PATCH 0/7] vbo: introduce a minmax_index cache
Nicolai Hähnle
nhaehnle at gmail.com
Fri Jan 8 07:16:35 PST 2016
Hi Timothy,
On 07.01.2016 23:01, Timothy Arceri wrote:
> On Thu, 2016-01-07 at 19:57 -0500, Nicolai Hähnle wrote:
>> Hi,
>>
>> this series is intended to address a (big) part of the performance
>> problems
>> that occur when games use an index buffer from a VBO together with
>> vertex
>> attributes supplied by user pointer. On a lower-end Radeon (Carrizo),
>> it
>> lifts This War Of Mine (the worst offender I've seen) from basically
>> unplayable
>> to an acceptable ~22fps.
>
> Hi Nicolai,
>
> A while back I added a SSE41 min/max optimisation for the INT path. I
> never added it to BYTE/SHORT as the games I was benchmarking never hit
> those paths. It would be interesting to know which path "This War Of
> Mine" is hitting.
It uses shorts, but as Marek suggested it is indeed the synchronization
which is the main performance killer.
> A quick Google shows Carrizo should have SSE41 right?
Yes, that's correct.
Cheers,
Nicolai
>
>
>
>>
>> There are really two parts to the performance inefficiency:
>> (1) the fact that we have to compute min/max in the first place
>> (2) the fact that games developers like to helpfully declare the
>> index buffer
>> as STATIC_DRAW, which means it ends up in VRAM, making things much
>> worse than
>> they would be with (1) alone.
>>
>> The series does this simply by caching (or memoizing, if you like)
>> the result
>> of vbo_get_minmax_indices. This makes sense since while the caching
>> itself of
>> course has some overhead, it is only used for VBOs - and the people
>> who mix
>> VBO index buffers with non-VBO vertex data seem to do so precisely
>> because
>> their index buffers are static, hence caching is a win.
>>
>> The cache is disabled permanently for VBOs that we detect to be
>> written to by
>> GPU operations. It is invalidated on other writes (Buffer(Sub)Data
>> etc.).
>>
>> I originally considered putting the caching in st/mesa instead of
>> vbo, but that
>> would have required duplicating some of the logic in
>> vbo_get_minmax_indices for
>> iterating over primitives inside the Gallium statetracker. I wanted
>> to avoid
>> this code duplication, hence why I put it in vbo.
>>
>> Please review!
>>
>> Thanks,
>> Nicolai
>> --
>> src/mesa/Makefile.sources | 1 +
>> src/mesa/main/bufferobj.c | 41 +++-
>> src/mesa/main/mtypes.h | 7 +
>> src/mesa/main/transformfeedback.h | 3 +
>> src/mesa/vbo/vbo.h | 3 +
>> src/mesa/vbo/vbo_exec_array.c | 148 ------------
>> src/mesa/vbo/vbo_minmax_index.c | 342
>> ++++++++++++++++++++++++++++
>> src/util/hash_table.c | 25 ++
>> src/util/hash_table.h | 2 +
>> src/util/tests/hash_table/Makefile.am | 1 +
>> src/util/tests/hash_table/clear.c | 91 ++++++++
>> 11 files changed, 507 insertions(+), 157 deletions(-)
>>
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list