I’m just putting together a quick SPIR(-V) decoder/wrapper, but I haven’t used this instruction before and I’m not fully understanding this member (and I’m not yet sure how to get example code that uses these parameters).
https://www.khronos.org/registry/spir-v/specs/unified1/SPIRV.html#OpSource
Parameters 3 & 4 are optional.
What type is the 3rd parameter? (definitions from the page above)
- [embedded OpString instruction]? Doc says “File is an OpString instruction and is the source-level file name.”
- [word]? Doc says “Optional <id> File”. (where <id> usually means a word).
Also, is it possible that the 3rd parameter is omitted but the 4th is used? If so, how do I disambiguate whether the optional 3rd parameter is omitted.
If it’s #1, I guess I any valid OpString first word is an invalid null-terminated-string word, although this would be a pretty ugly way to disambiguate.
If it’s #2, how should I disambiguate between [an id] vs [the 1st word of a null-terminated-string (which might be 1 word)]?
Either way, does anyone else find the spec slightly ambiguous here?