[Mesa-dev] [PATCH 2/2] i965: Implement ARB_indirect_parameters

Ilia Mirkin imirkin at alum.mit.edu
Thu Aug 31 18:26:52 UTC 2017

On Thu, Aug 31, 2017 at 1:45 PM, Bas Nieuwenhuizen
<bas at basnieuwenhuizen.nl> wrote:
> On Wed, Aug 30, 2017, at 14:59, Ilia Mirkin wrote:
>> On Wed, Aug 30, 2017 at 3:17 AM, Bas Nieuwenhuizen
>> <bas at basnieuwenhuizen.nl> wrote:
>> > So as a random drive-by review, I think the risk in this implementation
>> > is that apps just set maxdrawcount to some high value . If I'm reading
>> > the spec correctly there is no real bound on the value except for the
>> > max-representable value for the integer.  Also AFAIK the AMD and NVidia
>> > implementation don't really get slower if you specify maxdrawcount very
>> Can't speak for AMD, but this is actually extremely similar (in
>> principle) to how this is handled on NVIDIA. It's a little cleaner
>> since there's a nice macro, but since macros can't have a variable
>> number of arguments, you have to feed it maxdrawcount args. Admittedly
>> this is the nouveau impl, but I'm almost certain that the blob does it
>> in a similar way.
> I thought, you had a macro that looped, but seems that was a
> misunderstanding on my side.  If nvidia does it that way, then I suppose
> there is little risk of games expecting something more efficient. Never
> mind my comments then.

There indeed is a macro that loops. However that macro takes a number
of parameters determined at the time of cmd stream generation. Also
the indirect draw arguments have to be added into the cmd stream (via
IB references). Here's how nouveau does it:


I don't remember if I looked precisely at what NVIDIA does, but I
definitely can't think of another way. Even if you use the command
which takes the argument length as a separate word, that won't be
right since it's count * N arguments. macros can't read arbitrary
things either, it has to come out of the cmdstream.


More information about the mesa-dev mailing list