It might be nice to guarantee an upper bound of output_signature->element_count. That might require representing "varyings" in a way that omits unused registers, but that might not be a bad thing.
I originally was going to write that, but decided that since I was indexing the array by register_index, it wouldn't work. But on reflection there's no reason we can't index the array by the *signature* index, so yeah, that'd be better.
Hmm, there is one extra snag here: PS inputs not written (at all) by the VS. wined3d cares enough to explicitly zero these, so I assume there are applications that care.
From the perspective of next_stage_info, I think the simple thing to do is say that varying_map is still indexed by output signature index, but also that it can have extra entries at the end for PS inputs not written by the VS.
From the perspective of vkd3d_shader_build_varying_map(), that means we can't just say that the size is output_signature->element_count; it might be greater than that. Allocation is possible but I'm a little resistant to that, since in practice the user should just be able to say that sm1 has a maximum inter-stage varying count of 12, provide that array, and call the function once [as my wined3d PoC does].
Unless you meant to write "an upper bound of input_signature->element_count" [which may make more sense given your second sentence]? That'd work, though it'd be meaner to remap_output_signature().