spirv: Let spirv2nir find out the shader to use
Previous behavior was to default to "main"/fs, this wasn't nice
when the SPIR-V module had a single shader that didn't match that spec.
New behavior is to look at the available shaders:
- if there's only one, use just use it
- if multiple, narrow down using --stage and --entry as criteria
- if still multiple after narrowing down, print the list and fail
Note you can use just one --stage or --entry if that already narrows
down to a single match. Note that in SPIR-V it is valid to have a
shader module with two shaders sharing the same entry-point name but
different stages. Because of that in rare cases both --stage and
--entry will be needed.
This patch should remove the need of using --stage and --entry for most
of the uses of spirv2nir.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25461>