diff options
| author | David A Roberts <d@vidr.cc> | 2025-02-19 18:04:03 +1000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-19 00:04:03 -0800 |
| commit | 7315b33cf8dbf7759b05ff47612478b71238fa19 (patch) | |
| tree | 1bda5df82197c6f49bf2f9f8950fbac498e27d1f /source/slang/slang-reflection-json.cpp | |
| parent | e9a63b2b3822bbc533130ead0ab8ee03b4a4250a (diff) | |
Add userAttribs to entryPoints in reflection JSON (#6366)
Diffstat (limited to 'source/slang/slang-reflection-json.cpp')
| -rw-r--r-- | source/slang/slang-reflection-json.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/source/slang/slang-reflection-json.cpp b/source/slang/slang-reflection-json.cpp index be6539246..993832ad6 100644 --- a/source/slang/slang-reflection-json.cpp +++ b/source/slang/slang-reflection-json.cpp @@ -328,6 +328,22 @@ static void emitUserAttributes(PrettyWriter& writer, slang::VariableReflection* writer << "]"; } } +static void emitUserAttributes(PrettyWriter& writer, slang::FunctionReflection* func) +{ + auto attribCount = func->getUserAttributeCount(); + if (attribCount) + { + writer << ",\n\"userAttribs\": ["; + for (unsigned int i = 0; i < attribCount; i++) + { + if (i > 0) + writer << ",\n"; + auto attrib = func->getUserAttributeByIndex(i); + emitUserAttributeJSON(writer, attrib); + } + writer << "]"; + } +} static void emitReflectionVarLayoutJSON(PrettyWriter& writer, slang::VariableLayoutReflection* var) { @@ -1091,6 +1107,8 @@ static void emitReflectionEntryPointJSON( writer << "\n]"; } + emitUserAttributes(writer, entryPoint->getFunction()); + writer.dedent(); writer << "\n}"; } |
