On Wed Apr 12 21:58:44 2023 +0000, Zebediah Figura wrote:
Honestly, I'm tempted to say that "you used an output semantic in an array variable; that can't work" is the kind of thing that deserves a slightly different error message than "you used an output semantic twice" anyway. Like, if I just saw "line 139: output semantic was already used, previous use at line 139", I feel like that takes a little more mental effort to figure out what I did wrong than "line 139: output semantic used inside of an array". Along those lines, you'd want to just track whether there was an array (with size > 1) when iterating over semantics. I'm open to disagreement on that point, though.
Well, "you used an output semantic in an array variable; that can't work" (or more specifically, that the semantic is used within a struct within an array) isn't the only way that makes the first location the same as the second location.
It can also happen that two input semantics use the same struct, like in the following vertex shader:
``` struct apple { float2 f : SEMANTIC; };
void main(out apple a, out apple b) { a.f = float2(1, 2); b.f = float2(3, 4); } ``` which... I better add as a test.
Would it be a good compromise to make the hlsl_note slightly different when both locations coincide, but keeping it generic?
I am thinking on something like: "This struct field appears more than once in the input/output parameters."