[Mesa-dev] [PATCH 19/23] glsl: Add image built-in function generator.
Francisco Jerez
currojerez at riseup.net
Fri Dec 13 05:39:23 PST 2013
Kenneth Graunke <kenneth at whitecape.org> writes:
> On 11/26/2013 12:02 AM, Francisco Jerez wrote:
> [snip]
>> + add_image_function("imageLoad",
>> + image_builtin_builder(*this)
>> + .emit_stub("__intrinsic_image_load")
>> + .has_return()
>> + .has_vector_data_type()
>> + .has_float_data_type()
>> + .read_only());
>
> I agree with Paul...I'm not a huge fan of using this pattern here.
>
> Using true/false, i.e.
> add_image_function("imageLoad", true, true, true, true, false, ...);
> is clearly awful.
>
> But what about using a flags bitfield? Something like:
>
> enum image_function_flags {
> RETURNS_DATA = (1 << 0),
> HAS_VECTOR_DATA_TYPE = (1 << 1),
> SUPPORTS_FLOATING_POINT_IMAGES = (1 << 2),
> READ_ONLY = (1 << 3),
> EMIT_STUB = (1 << 4),
> };
>
> and then:
>
> void
> add_image_function(const char *name,
> unsigned num_arguments,
> uint32_t flags);
>
> i.e.
> add_image_function("imageLoad", 0,
> RETURNS_DATA |
> HAS_VECTOR_DATA_TYPE |
> SUPPORTS_FLOATING_POINT_IMAGES |
> READ_ONLY);
>
> That remains readable, like your code, but follows an extremely common
> pattern we already use all over the place.
>
That would be a reasonable solution too, I'll have a look into it.
Thanks.
> --Ken
-------------- 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/20131213/0867ccb9/attachment.pgp>
More information about the mesa-dev
mailing list