Kenneth Graunke <kenn...@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
pgpGtZjz9aAOb.pgp
Description: PGP signature
_______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev