[Mesa-dev] Question about min_index/max_index calculation

Marek Olšák maraeo at gmail.com
Sun Mar 18 04:59:24 UTC 2018


The index bounds are computed only when they are needed for uploading
vertices that are passed via a CPU pointer (user_buffer). In all other
cases, computing the index bounds has a performance cost, which can be very
significant.

If you rely on u_vbuf to upload vertices for you, you shouldn't need the
index bounds.

Marek

On Sat, Mar 17, 2018 at 2:12 PM, Erico Nunes <nunes.erico at gmail.com> wrote:

> Hi all,
>
> I have been working to add indexed drawing/glDrawElements support to
> the mesa-lima driver currently in development
> (https://github.com/yuq/mesa-lima).
> For that implementation, it seems that we need to have the minimum and
> maximum index values from the index buffer available in order to set
> up a proper command stream.
> Mesa provides these values in pipe_draw_info.min_index and
> pipe_draw_info.max_index, however in some cases we noticed that it
> decides to not calculate those. This happens because of
> st_context.draw_needs_minmax_index being false after evaluating the
> vertex data. In those cases, min_index gets to be 0 and max_index gets
> to be 0xffffffff.
> According to the gallium documentation, this seems to be on purpose
> and apparently drivers should be able to handle the 0 and 0xffffffff
> case and be able to render anyway. However, we haven't figured out a
> way to do the render anyway with 0 and 0xffffffff.
>
> For us it would be interesting to always have mesa calculate those
> values for indexed drawing. We haven't been able to figure out a way
> to do that without changing the mesa generic code. Is there some way
> we could accomplish that in driver specific code?
> Otherwise, can you provide some advice on how to best handle this?
>
> Using mesa 17.3 and kmscube with the following patch is one way to
> reproduce st_context.draw_needs_minmax_index not being set.
> https://gist.githubusercontent.com/enunes/366398fbee3d194deb
> 3a46ef9c2ca78d/raw/82a2c8084236e35635b7a247609213d0068974e3/kmscube.patch
> The only way that this works for us with the current implementation is
> by hacking st_context.draw_needs_minmax_index to be always true in
> some way.
>
> Thanks
>
> Erico
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180318/57979c5c/attachment.html>


More information about the mesa-dev mailing list