This patch tries to attach debug location of a branch/return instruction to its predecessor or the closing brace. If none could be found, no debug info should be emitted.
It is invalid if the same decoration is applied to the same id multiple
times. This adds a check before adding a decoration that the decoration
is not already in the list. If it is, then the duplicate is not added.
Fixes#3627
The file and source text was not being set correctly in the test output.
This change makes the test fixture consistent with the command line
behavior, "-gVS", which was my original intent when I added these tests.
- Correctly populate the field `currentFileId` with the presence of include directive
- Support lazy OpLine/OpDebugLine generation only when a real instruction is added instead of a debug location is set
- Improve the debug location tracking to per-block instead of just per-builder
- A few bug fixes related to debug source info
1. Pull OpDebugFunction, OpDebugScope and OpDebugVariable for params out
of makeFunctionEntry.
2. Put above in a separate function called setupDebugFunctionEntry,
which also accept line number and set it correctly in builder.
3. Call setupDebugFunctionEntry in makeFunction. Also special case
handle entry function since it's created ealier elsewhere.
Previously, the type names in the nonsemantic shader debug info would be
"int", "uint", or "float" for all numeric types. This change makes the
correct names such as "int8_t" or "float16_t" get emitted.
From the command line, the debug options "stack", with -gVS enabling all
of generateDebugInfo, emitNonSemanticShaderDebugInfo and
emitNonSemanticShaderDebugSource, however the programmatic interface
allows setting the latter options without the former. In this case, the
string corresponding to the source filename never gets emitted and some
debuginfo instructions end up with zero ID operands, resulting in
invalid SPIR-V.
Fixes#3240