On Mon Apr 10 22:09:15 2023 +0000, Zebediah Figura wrote:
Errors lose precision on which part of the variable is missing the semantics, but this is necessary in order to avoid printing the same error many times, when arrays are involved. It seems that the native compiler also makes this compromise.
I think we can do better, though. We could add a bool field to struct hlsl_field denoting whether the missing-semantic warning has been reported yet, and then just do it in prepend_input_var_copy() / append_output_var_copy(). [Side note: we may want to add a helper, even though it's a one-liner, just to make sure the error messages are always in sync.]
Okay, I am reporting that as an `hlsl_note()` though, since the error will be emitted by the `if (var->is_missing_semantics)` check at the level of `hlsl_emit_bytecode()`.
It was necessary to use `get_array_type()` whose definition we have repeated in many places, so I renamed and moved it to `hlsl.c` in a new commit. Same for `get_array_size()`.