On Mon Dec 19 00:33:24 2022 +0000, Zebediah Figura wrote:
I hate to bikeshed this more, but I feel like this could be prettier. Partly because elementwise_intrinsic_convert_args() has a bool argument that's not maximally intuitive, but also because now it's not as modular as it could be. How about something like this?
void convert_args(ctx, params, type, loc) { for (...) params->args[i] = add_implicit_conversion(...); } struct hlsl_type *elementwise_intrinsic_get_common_type(ctx, params, loc) { ... } void elementwise_intrinsic_convert_args(ctx, params, loc) { type = elementwise_intrinsic_get_common_type(ctx, params, loc); return convert_args(ctx, params, type); } void elementwise_intrinsic_float_convert_args(ctx, params, loc) { type = elementwise_intrinsic_get_common_type(ctx, params, loc); type = hlsl_get_numeric_type(ctx, type->type, HLSL_TYPE_FLOAT, type->dimx, type->dimy); return convert_args(ctx, params, type); }
Not dissimilar from the way parts of the current code are organized, in particular intrinsic_float_convert_arg().
I agree this is better :-)