[Mesa-dev] [PATCH 05/14] glsl: Add IR builder support for function calls.

Francisco Jerez currojerez at riseup.net
Wed Oct 23 11:54:17 PDT 2013


Ian Romanick <idr at freedesktop.org> writes:

> On 10/01/2013 07:15 PM, Francisco Jerez wrote:
>>[..]
>> +ir_call *
>> +call(ir_function *f, ir_variable *ret, int num_params, ...)
>
> varargs functions that take an explicit count are very susceptible to
> copy-and-past bugs.  If you copy-and-paste an invocation, add or remove
> a parameter, and forget to change the count, you will be sad.
>
> If possible, I'd much rather see some sort of sentinel to terminate the
> list.  I haven't looked to see how ugly that would be in this case.
> What do you think?
>
Yeah, I'm not especially fond of this parameter arrangement either, I
chose it to match the prototype of builtin_builder::new_sig(), but now I
think it would be a better idea to take the function call arguments as a
linked list of ir_variables.  That's likely to be even more annoying
than variadic parameters in the general case, but it turns out it would
be cleaner for the needs of the builtin builder.

I think I'm just going to make it a local helper function in
builtin_functions.cpp.

Thanks.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 229 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20131023/b2854802/attachment.pgp>


More information about the mesa-dev mailing list