Zebediah Figura (@zfigura) commented about libs/vkd3d-shader/hlsl.y:
+ if (type->class != HLSL_CLASS_SCALAR && type->class != HLSL_CLASS_MATRIX) + { + hlsl_error(ctx, loc, VKD3D_SHADER_ERROR_HLSL_INVALID_TYPE, "Invalid argument type."); + return false; + } + + dim = min(type->dimx, type->dimy); + if (dim == 1) + { + if (!(arg = intrinsic_float_convert_arg(ctx, params, arg, loc))) + return false; + return hlsl_add_load_component(ctx, params->instrs, arg, 0, loc); + } + + if (!(body = hlsl_sprintf_alloc(ctx, templates[dim], type->name))) + return false; You already need to cast to float for dim == 1, so it seems to me it'd be the same amount of code to just always emit a cast to the requisite float matrix type, taking care of the base type conversion and casting down to a square matrix at once. Then you don't need to encode the type in the function body.
-- https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/329#note_44458