Open Wallby opened 8 months ago
Previously discussed here.. https://github.com/KhronosGroup/glslang/issues/605#issuecomment-1729464528
Note that in your original example, the renaming is not necessary: an entry point is uniquely identified by its name and execution model (i.e. shader type). So having two entry points named "main" in the same module, one being a vertex shader and the other a fragment shader, is valid.
Let’s say one of the input files has more than one entry point, what should be the behaviour there? Does the user need to rename all entry points in that file and provide the new names in order? Or can they just provide n names and only the first n entry points get renamed? Or even provide a map of (old names, shader type) to new names? I do not believe that any debug information will need to be updated, correct?
And I assume that providing that providing the rename option more than once for the same input file would be an error?
Let’s say one of the input files has more than one entry point, what should be the behaviour there? Does the user need to rename all entry points in that file and provide the new names in order? Or can they just provide n names and only the first n entry points get renamed? Or even provide a map of (old names, shader type) to new names? I do not believe that any debug information will need to be updated, correct?
Well for my purpose it doesn't matter as a glslangValidator only allows for compiling a .glsl file if it contains one entry point called main
. Hence I want a .spv file with an entry point called main as well, and then rename it during linking only.
Outputting an error if there is more than one entrypoint in a file would suffice for me too.
Alternative could be a feature to pipe .spvasm files to spirv-as (and then use grep/Select-String to change the entrypoint name before read by spirv-as) and then pipe the output to glslangValidator, but that would be less optimal as that requires compiling twice.
What would also work would be a feature for spirv-reflect that allows renaming functionnames from a .spv file and then piping the output to spirv-link. This would still achieve not having to have two near identical temporary .spv files with only the entrypoint functionname being different.
I.e. the equivalent of
glslangValidator <...> -e vert_main --source-entrypoint main
for spirv-link such that a pipeline that can create a .spv with multiple entrypoints or a .spv with a single entrypoint can first compile every .spv and then call spirv-link to change the entrypoints using the .spv files that don't have a renamed entrypoint.Thus something like..