[Mesa-dev] [PATCH 1/2] nir: Use alloca instead of variable length arrays.

Kenneth Graunke kenneth at whitecape.org
Fri Feb 27 11:51:01 PST 2015


On Friday, February 27, 2015 02:04:47 PM Jose Fonseca wrote:
> On 26/02/15 18:07, Brian Paul wrote:
[snip]
> > AFAIK, there's no zeroing version of alloca().
> 
> Yes, I also searched.  And unfortunately inline functions can't be used 
> due to alloca semantics.  I'm not sure if there's any C-preprocessor magic.
> 
> 
> Anyway, depending on the maximum size of these alloca arrays, we might 
> actually need to use malloc, as Windows stack is 1MB by default, plus 
> the OpenGL driver only gets to use whatever stack is left from the 
> application.
> 
> If using C++ on NIR is acceptable, std::vector<> would be a nice 
> solution overall: practically the same syntax/semantics as C99 VLAs, 
> plus no risk of stack overflow.

We're hoping to keep it C99 - malloc and freeing them is probably the
best plan.  Thanks again!

--Ken
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150227/aa845d1d/attachment.sig>


More information about the mesa-dev mailing list